From: bangerth Date: Fri, 11 Dec 2009 01:06:50 +0000 (+0000) Subject: Import boost 1.41. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=740274139aba4fb187947976258a900723afe512;p=dealii-svn.git Import boost 1.41. git-svn-id: https://svn.dealii.org/trunk@20225 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/contrib/boost/include/boost/algorithm/minmax.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/minmax.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/minmax.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/minmax.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/minmax_element.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/minmax_element.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/minmax_element.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/minmax_element.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/case_conv.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/case_conv.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/algorithm/string/case_conv.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/case_conv.hpp index 536c022a67..683340b8ec 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/case_conv.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/case_conv.hpp @@ -59,7 +59,7 @@ namespace boost { { return ::boost::algorithm::detail::transform_range_copy( Output, - as_literal(Input), + ::boost::as_literal(Input), ::boost::algorithm::detail::to_lowerF< typename range_value::type >(Loc)); } @@ -93,7 +93,7 @@ namespace boost { const std::locale& Loc=std::locale()) { ::boost::algorithm::detail::transform_range( - as_literal(Input), + ::boost::as_literal(Input), ::boost::algorithm::detail::to_lowerF< typename range_value::type >(Loc)); } @@ -124,7 +124,7 @@ namespace boost { { return ::boost::algorithm::detail::transform_range_copy( Output, - as_literal(Input), + ::boost::as_literal(Input), ::boost::algorithm::detail::to_upperF< typename range_value::type >(Loc)); } @@ -158,7 +158,7 @@ namespace boost { const std::locale& Loc=std::locale()) { ::boost::algorithm::detail::transform_range( - as_literal(Input), + ::boost::as_literal(Input), ::boost::algorithm::detail::to_upperF< typename range_value::type >(Loc)); } diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/classification.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/classification.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/algorithm/string/classification.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/classification.hpp index 33ff9be107..ca43602d47 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/classification.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/classification.hpp @@ -202,7 +202,7 @@ namespace boost { BOOST_STRING_TYPENAME range_value::type> is_any_of( const RangeT& Set ) { - iterator_range::type> lit_set(as_literal(Set)); + iterator_range::type> lit_set(boost::as_literal(Set)); return detail::is_any_ofF::type>(lit_set); } diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/compare.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/compare.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/compare.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/compare.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/concept.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/concept.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/concept.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/concept.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/config.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/config.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/config.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/config.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/constants.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/constants.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/constants.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/constants.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/case_conv.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/case_conv.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/case_conv.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/case_conv.hpp index 5253454fe0..3440c27309 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/detail/case_conv.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/case_conv.hpp @@ -105,10 +105,10 @@ namespace boost { FunctorT Functor) { return SequenceT( - make_transform_iterator( + ::boost::make_transform_iterator( ::boost::begin(Input), Functor), - make_transform_iterator( + ::boost::make_transform_iterator( ::boost::end(Input), Functor)); } diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/classification.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/classification.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/classification.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/classification.hpp index 1db5d295fd..9a34bf0059 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/detail/classification.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/classification.hpp @@ -171,7 +171,7 @@ namespace boost { // Check what kind of storage are we using right now if(use_fixed_storage(m_Size)) { - // Using fixed storage, allocate new + // Using fixed storage, allocate new set_value_type* pTemp=new set_value_type[Other.m_Size]; DestStorage=pTemp; m_Storage.m_dynSet=pTemp; diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/find_format.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/find_format.hpp similarity index 93% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/find_format.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/find_format.hpp index 8fb625ee98..0d8b104525 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/detail/find_format.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/find_format.hpp @@ -24,26 +24,7 @@ namespace boost { // find_format_copy (iterator variant) implementation -------------------------------// - template< - typename OutputIteratorT, - typename InputT, - typename FormatterT, - typename FindResultT > - inline OutputIteratorT find_format_copy_impl( - OutputIteratorT Output, - const InputT& Input, - FormatterT Formatter, - const FindResultT& FindResult ) - { - return find_format_copy_impl2( - Output, - Input, - Formatter, - FindResult, - Formatter(FindResult) ); - } - - template< + template< typename OutputIteratorT, typename InputT, typename FormatterT, @@ -83,25 +64,29 @@ namespace boost { return Output; } -// find_format_copy implementation --------------------------------------------------// - template< - typename InputT, + typename OutputIteratorT, + typename InputT, typename FormatterT, typename FindResultT > - inline InputT find_format_copy_impl( + inline OutputIteratorT find_format_copy_impl( + OutputIteratorT Output, const InputT& Input, FormatterT Formatter, - const FindResultT& FindResult) - { - return find_format_copy_impl2( + const FindResultT& FindResult ) + { + return ::boost::algorithm::detail::find_format_copy_impl2( + Output, Input, Formatter, FindResult, Formatter(FindResult) ); } - template< + +// find_format_copy implementation --------------------------------------------------// + + template< typename InputT, typename FormatterT, typename FindResultT, @@ -138,24 +123,24 @@ namespace boost { return Output; } -// replace implementation ----------------------------------------------------// - - template< - typename InputT, + template< + typename InputT, typename FormatterT, typename FindResultT > - inline void find_format_impl( - InputT& Input, + inline InputT find_format_copy_impl( + const InputT& Input, FormatterT Formatter, const FindResultT& FindResult) { - find_format_impl2( + return ::boost::algorithm::detail::find_format_copy_impl2( Input, Formatter, FindResult, Formatter(FindResult) ); } + // replace implementation ----------------------------------------------------// + template< typename InputT, typename FormatterT, @@ -183,7 +168,23 @@ namespace boost { } // Replace match - replace( Input, M.begin(), M.end(), M.format_result() ); + ::boost::algorithm::detail::replace( Input, M.begin(), M.end(), M.format_result() ); + } + + template< + typename InputT, + typename FormatterT, + typename FindResultT > + inline void find_format_impl( + InputT& Input, + FormatterT Formatter, + const FindResultT& FindResult) + { + ::boost::algorithm::detail::find_format_impl2( + Input, + Formatter, + FindResult, + Formatter(FindResult) ); } } // namespace detail diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/find_format_all.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/find_format_all.hpp similarity index 90% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/find_format_all.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/find_format_all.hpp index 9533be6094..36edf56c31 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/detail/find_format_all.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/find_format_all.hpp @@ -24,29 +24,7 @@ namespace boost { // find_format_all_copy (iterator variant) implementation ---------------------------// - template< - typename OutputIteratorT, - typename InputT, - typename FinderT, - typename FormatterT, - typename FindResultT > - inline OutputIteratorT find_format_all_copy_impl( - OutputIteratorT Output, - const InputT& Input, - FinderT Finder, - FormatterT Formatter, - const FindResultT& FindResult ) - { - return find_format_all_copy_impl2( - Output, - Input, - Finder, - Formatter, - FindResult, - Formatter(FindResult) ); - } - - template< + template< typename OutputIteratorT, typename InputT, typename FinderT, @@ -94,20 +72,21 @@ namespace boost { return Output; } -// find_format_all_copy implementation ----------------------------------------------// - template< - typename InputT, + typename OutputIteratorT, + typename InputT, typename FinderT, typename FormatterT, typename FindResultT > - inline InputT find_format_all_copy_impl( + inline OutputIteratorT find_format_all_copy_impl( + OutputIteratorT Output, const InputT& Input, FinderT Finder, FormatterT Formatter, - const FindResultT& FindResult) - { - return find_format_all_copy_impl2( + const FindResultT& FindResult ) + { + return ::boost::algorithm::detail::find_format_all_copy_impl2( + Output, Input, Finder, Formatter, @@ -115,7 +94,9 @@ namespace boost { Formatter(FindResult) ); } - template< + // find_format_all_copy implementation ----------------------------------------------// + + template< typename InputT, typename FinderT, typename FormatterT, @@ -159,25 +140,23 @@ namespace boost { } // Copy the rest of the sequence - insert( Output, ::boost::end(Output), LastMatch, ::boost::end(Input) ); + ::boost::algorithm::detail::insert( Output, ::boost::end(Output), LastMatch, ::boost::end(Input) ); return Output; } -// find_format_all implementation ------------------------------------------------// - - template< - typename InputT, + template< + typename InputT, typename FinderT, typename FormatterT, typename FindResultT > - inline void find_format_all_impl( - InputT& Input, + inline InputT find_format_all_copy_impl( + const InputT& Input, FinderT Finder, FormatterT Formatter, - FindResultT FindResult) + const FindResultT& FindResult) { - find_format_all_impl2( + return ::boost::algorithm::detail::find_format_all_copy_impl2( Input, Finder, Formatter, @@ -185,6 +164,8 @@ namespace boost { Formatter(FindResult) ); } + // find_format_all implementation ------------------------------------------------// + template< typename InputT, typename FinderT, @@ -230,14 +211,14 @@ namespace boost { SearchIt=M.end(); // Copy formated replace to the storage - copy_to_storage( Storage, M.format_result() ); + ::boost::algorithm::detail::copy_to_storage( Storage, M.format_result() ); // Find range for a next match M=Finder( SearchIt, ::boost::end(Input) ); } // process the last segment - InsertIt=process_segment( + InsertIt=::boost::algorithm::detail::process_segment( Storage, Input, InsertIt, @@ -247,15 +228,34 @@ namespace boost { if ( Storage.empty() ) { // Truncate input - erase( Input, InsertIt, ::boost::end(Input) ); + ::boost::algorithm::detail::erase( Input, InsertIt, ::boost::end(Input) ); } else { // Copy remaining data to the end of input - insert( Input, ::boost::end(Input), Storage.begin(), Storage.end() ); + ::boost::algorithm::detail::insert( Input, ::boost::end(Input), Storage.begin(), Storage.end() ); } } + template< + typename InputT, + typename FinderT, + typename FormatterT, + typename FindResultT > + inline void find_format_all_impl( + InputT& Input, + FinderT Finder, + FormatterT Formatter, + FindResultT FindResult) + { + ::boost::algorithm::detail::find_format_all_impl2( + Input, + Finder, + Formatter, + FindResult, + Formatter(FindResult) ); + } + } // namespace detail } // namespace algorithm } // namespace boost diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/find_format_store.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/find_format_store.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/find_format_store.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/find_format_store.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/find_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/find_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/find_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/find_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/finder.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/finder.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/finder.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/finder.hpp index c6d0752bb1..45bcb7d3d6 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/detail/finder.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/finder.hpp @@ -382,7 +382,7 @@ namespace boost { typedef BOOST_STRING_TYPENAME boost::detail:: iterator_traits::iterator_category category; - return find_head_impl( Begin, End, N, category() ); + return ::boost::algorithm::detail::find_head_impl( Begin, End, N, category() ); } template< typename ForwardIteratorT > @@ -456,7 +456,7 @@ namespace boost { typedef BOOST_STRING_TYPENAME boost::detail:: iterator_traits::iterator_category category; - return find_tail_impl( Begin, End, N, category() ); + return ::boost::algorithm::detail::find_tail_impl( Begin, End, N, category() ); } @@ -484,14 +484,14 @@ namespace boost { { if(m_N>=0) { - return find_head_impl( Begin, End, m_N ); + return ::boost::algorithm::detail::find_head_impl( Begin, End, m_N ); } else { iterator_range Res= - find_tail_impl( Begin, End, -m_N ); + ::boost::algorithm::detail::find_tail_impl( Begin, End, -m_N ); - return make_iterator_range(Begin, Res.begin()); + return ::boost::make_iterator_range(Begin, Res.begin()); } } @@ -522,14 +522,14 @@ namespace boost { { if(m_N>=0) { - return find_tail_impl( Begin, End, m_N ); + return ::boost::algorithm::detail::find_tail_impl( Begin, End, m_N ); } else { iterator_range Res= - find_head_impl( Begin, End, -m_N ); + ::boost::algorithm::detail::find_head_impl( Begin, End, -m_N ); - return make_iterator_range(Res.end(), End); + return ::boost::make_iterator_range(Res.end(), End); } } diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/finder_regex.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/finder_regex.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/finder_regex.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/finder_regex.hpp index 1eeda011e2..673d93a538 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/detail/finder_regex.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/finder_regex.hpp @@ -98,7 +98,7 @@ namespace boost { // instantiate match result match_results result; // search for a match - if ( regex_search( Begin, End, result, m_Rx, m_MatchFlags ) ) + if ( ::boost::regex_search( Begin, End, result, m_Rx, m_MatchFlags ) ) { // construct a result return result_type( result ); diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/formatter.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/formatter.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/formatter.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/formatter.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/formatter_regex.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/formatter_regex.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/formatter_regex.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/formatter_regex.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/predicate.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/predicate.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/predicate.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/predicate.hpp index a04b5b1ea0..5acf3cc663 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/detail/predicate.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/predicate.hpp @@ -63,7 +63,7 @@ namespace boost { iterator_range Result =last_finder( - make_iterator_range(SubBegin, SubEnd), + ::boost::make_iterator_range(SubBegin, SubEnd), Comp)(Begin, End); return !Result.empty() && Result.end()==End; diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/replace_storage.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/replace_storage.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/replace_storage.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/replace_storage.hpp index 7aff247a9f..db35e4c53b 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/detail/replace_storage.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/replace_storage.hpp @@ -68,7 +68,7 @@ namespace boost { ForwardIteratorT SegmentEnd ) { // Copy data from the storage until the beginning of the segment - ForwardIteratorT It=move_from_storage( Storage, InsertIt, SegmentBegin ); + ForwardIteratorT It=::boost::algorithm::detail::move_from_storage( Storage, InsertIt, SegmentBegin ); // 3 cases are possible : // a) Storage is empty, It==SegmentBegin @@ -125,7 +125,7 @@ namespace boost { { // Call replace to do the job - replace( Input, InsertIt, SegmentBegin, Storage ); + ::boost::algorithm::detail::replace( Input, InsertIt, SegmentBegin, Storage ); // Empty the storage Storage.clear(); // Iterators were not changed, simply return the end of segment diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/sequence.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/sequence.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/sequence.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/sequence.hpp index de01350cb4..dc47409115 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/detail/sequence.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/sequence.hpp @@ -41,7 +41,7 @@ namespace boost { BOOST_STRING_TYPENAME InputT::iterator At, const InsertT& Insert ) { - insert( Input, At, ::boost::begin(Insert), ::boost::end(Insert) ); + ::boost::algorithm::detail::insert( Input, At, ::boost::begin(Insert), ::boost::end(Insert) ); } // erase helper ---------------------------------------------------// @@ -184,11 +184,11 @@ namespace boost { { if(From!=To) { - replace( Input, From, To, ::boost::begin(Insert), ::boost::end(Insert) ); + ::boost::algorithm::detail::replace( Input, From, To, ::boost::begin(Insert), ::boost::end(Insert) ); } else { - insert( Input, From, ::boost::begin(Insert), ::boost::end(Insert) ); + ::boost::algorithm::detail::insert( Input, From, ::boost::begin(Insert), ::boost::end(Insert) ); } } diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/trim.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/trim.hpp similarity index 93% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/trim.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/trim.hpp index 8e5c0fb438..1233e49d30 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/detail/trim.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/trim.hpp @@ -20,36 +20,6 @@ namespace boost { // trim iterator helper -----------------------------------------------// - // Search for first non matching character from the beginning of the sequence - template< typename ForwardIteratorT, typename PredicateT > - inline ForwardIteratorT trim_begin( - ForwardIteratorT InBegin, - ForwardIteratorT InEnd, - PredicateT IsSpace ) - { - ForwardIteratorT It=InBegin; - for(; It!=InEnd; ++It ) - { - if (!IsSpace(*It)) - return It; - } - - return It; - } - - // Search for first non matching character from the end of the sequence - template< typename ForwardIteratorT, typename PredicateT > - inline ForwardIteratorT trim_end( - ForwardIteratorT InBegin, - ForwardIteratorT InEnd, - PredicateT IsSpace ) - { - typedef BOOST_STRING_TYPENAME boost::detail:: - iterator_traits::iterator_category category; - - return trim_end_iter_select( InBegin, InEnd, IsSpace, category() ); - } - template< typename ForwardIteratorT, typename PredicateT > inline ForwardIteratorT trim_end_iter_select( ForwardIteratorT InBegin, @@ -86,6 +56,36 @@ namespace boost { return InBegin; } + // Search for first non matching character from the beginning of the sequence + template< typename ForwardIteratorT, typename PredicateT > + inline ForwardIteratorT trim_begin( + ForwardIteratorT InBegin, + ForwardIteratorT InEnd, + PredicateT IsSpace ) + { + ForwardIteratorT It=InBegin; + for(; It!=InEnd; ++It ) + { + if (!IsSpace(*It)) + return It; + } + + return It; + } + + // Search for first non matching character from the end of the sequence + template< typename ForwardIteratorT, typename PredicateT > + inline ForwardIteratorT trim_end( + ForwardIteratorT InBegin, + ForwardIteratorT InEnd, + PredicateT IsSpace ) + { + typedef BOOST_STRING_TYPENAME boost::detail:: + iterator_traits::iterator_category category; + + return ::boost::algorithm::detail::trim_end_iter_select( InBegin, InEnd, IsSpace, category() ); + } + } // namespace detail } // namespace algorithm diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/detail/util.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/util.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/detail/util.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/detail/util.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/erase.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/erase.hpp similarity index 81% rename from deal.II/contrib/boost/include/boost/algorithm/string/erase.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/erase.hpp index b50323b433..0951b8ae3e 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/erase.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/erase.hpp @@ -54,11 +54,11 @@ namespace boost { BOOST_STRING_TYPENAME range_const_iterator::type>& SearchRange ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - range_finder(SearchRange), - empty_formatter(Input) ); + ::boost::algorithm::range_finder(SearchRange), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase range algorithm @@ -72,10 +72,10 @@ namespace boost { BOOST_STRING_TYPENAME range_const_iterator::type>& SearchRange ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - range_finder(SearchRange), - empty_formatter(Input) ); + ::boost::algorithm::range_finder(SearchRange), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase range algorithm @@ -93,10 +93,10 @@ namespace boost { BOOST_STRING_TYPENAME range_iterator::type>& SearchRange ) { - find_format( + ::boost::algorithm::find_format( Input, - range_finder(SearchRange), - empty_formatter(Input) ); + ::boost::algorithm::range_finder(SearchRange), + ::boost::algorithm::empty_formatter(Input) ); } // erase_first --------------------------------------------------------// @@ -124,11 +124,11 @@ namespace boost { const Range1T& Input, const Range2T& Search ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - first_finder(Search), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase first algorithm @@ -140,10 +140,10 @@ namespace boost { const SequenceT& Input, const RangeT& Search ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - first_finder(Search), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase first algorithm @@ -159,10 +159,10 @@ namespace boost { SequenceT& Input, const RangeT& Search ) { - find_format( + ::boost::algorithm::find_format( Input, - first_finder(Search), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::empty_formatter(Input) ); } // erase_first ( case insensitive ) ------------------------------------// @@ -193,11 +193,11 @@ namespace boost { const Range2T& Search, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - first_finder(Search, is_iequal(Loc)), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase first algorithm ( case insensitive ) @@ -210,10 +210,10 @@ namespace boost { const RangeT& Search, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - first_finder(Search, is_iequal(Loc)), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase first algorithm ( case insensitive ) @@ -231,10 +231,10 @@ namespace boost { const RangeT& Search, const std::locale& Loc=std::locale() ) { - find_format( + ::boost::algorithm::find_format( Input, - first_finder(Search, is_iequal(Loc)), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::empty_formatter(Input) ); } // erase_last --------------------------------------------------------// @@ -262,11 +262,11 @@ namespace boost { const Range1T& Input, const Range2T& Search ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - last_finder(Search), - empty_formatter(Input) ); + ::boost::algorithm::last_finder(Search), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase last algorithm @@ -278,10 +278,10 @@ namespace boost { const SequenceT& Input, const RangeT& Search ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - last_finder(Search), - empty_formatter(Input) ); + ::boost::algorithm::last_finder(Search), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase last algorithm @@ -297,10 +297,10 @@ namespace boost { SequenceT& Input, const RangeT& Search ) { - find_format( + ::boost::algorithm::find_format( Input, - last_finder(Search), - empty_formatter(Input) ); + ::boost::algorithm::last_finder(Search), + ::boost::algorithm::empty_formatter(Input) ); } // erase_last ( case insensitive ) ------------------------------------// @@ -331,11 +331,11 @@ namespace boost { const Range2T& Search, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - last_finder(Search, is_iequal(Loc)), - empty_formatter(Input) ); + ::boost::algorithm::last_finder(Search, is_iequal(Loc)), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase last algorithm ( case insensitive ) @@ -348,10 +348,10 @@ namespace boost { const RangeT& Search, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - last_finder(Search, is_iequal(Loc)), - empty_formatter(Input) ); + ::boost::algorithm::last_finder(Search, is_iequal(Loc)), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase last algorithm ( case insensitive ) @@ -369,10 +369,10 @@ namespace boost { const RangeT& Search, const std::locale& Loc=std::locale() ) { - find_format( + ::boost::algorithm::find_format( Input, - last_finder(Search, is_iequal(Loc)), - empty_formatter(Input) ); + ::boost::algorithm::last_finder(Search, is_iequal(Loc)), + ::boost::algorithm::empty_formatter(Input) ); } // erase_nth --------------------------------------------------------------------// @@ -404,11 +404,11 @@ namespace boost { const Range2T& Search, int Nth ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - nth_finder(Search, Nth), - empty_formatter(Input) ); + ::boost::algorithm::nth_finder(Search, Nth), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase nth algorithm @@ -421,10 +421,10 @@ namespace boost { const RangeT& Search, int Nth ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - nth_finder(Search, Nth), - empty_formatter(Input) ); + ::boost::algorithm::nth_finder(Search, Nth), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase nth algorithm @@ -443,10 +443,10 @@ namespace boost { const RangeT& Search, int Nth ) { - find_format( + ::boost::algorithm::find_format( Input, - nth_finder(Search, Nth), - empty_formatter(Input) ); + ::boost::algorithm::nth_finder(Search, Nth), + ::boost::algorithm::empty_formatter(Input) ); } // erase_nth ( case insensitive ) ---------------------------------------------// @@ -480,11 +480,11 @@ namespace boost { int Nth, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - nth_finder(Search, Nth, is_iequal(Loc)), - empty_formatter(Input) ); + ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase nth algorithm @@ -498,9 +498,9 @@ namespace boost { int Nth, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - nth_finder(Search, Nth, is_iequal(Loc)), + ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)), empty_formatter(Input) ); } @@ -522,10 +522,10 @@ namespace boost { int Nth, const std::locale& Loc=std::locale() ) { - find_format( + ::boost::algorithm::find_format( Input, - nth_finder(Search, Nth, is_iequal(Loc)), - empty_formatter(Input) ); + ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)), + ::boost::algorithm::empty_formatter(Input) ); } @@ -555,11 +555,11 @@ namespace boost { const Range1T& Input, const Range2T& Search ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Output, Input, - first_finder(Search), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase all algorithm @@ -571,10 +571,10 @@ namespace boost { const SequenceT& Input, const RangeT& Search ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Input, - first_finder(Search), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase all algorithm @@ -590,10 +590,10 @@ namespace boost { SequenceT& Input, const RangeT& Search ) { - find_format_all( + ::boost::algorithm::find_format_all( Input, - first_finder(Search), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::empty_formatter(Input) ); } // erase_all ( case insensitive ) ------------------------------------// @@ -624,11 +624,11 @@ namespace boost { const Range2T& Search, const std::locale& Loc=std::locale() ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Output, Input, - first_finder(Search, is_iequal(Loc)), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase all algorithm ( case insensitive ) @@ -641,10 +641,10 @@ namespace boost { const RangeT& Search, const std::locale& Loc=std::locale() ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Input, - first_finder(Search, is_iequal(Loc)), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::empty_formatter(Input) ); } //! Erase all algorithm ( case insensitive ) @@ -662,10 +662,10 @@ namespace boost { const RangeT& Search, const std::locale& Loc=std::locale() ) { - find_format_all( + ::boost::algorithm::find_format_all( Input, - first_finder(Search, is_iequal(Loc)), - empty_formatter(Input) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::empty_formatter(Input) ); } // erase_head --------------------------------------------------------------------// @@ -696,11 +696,11 @@ namespace boost { const RangeT& Input, int N ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - head_finder(N), - empty_formatter( Input ) ); + ::boost::algorithm::head_finder(N), + ::boost::algorithm::empty_formatter( Input ) ); } //! Erase head algorithm @@ -712,10 +712,10 @@ namespace boost { const SequenceT& Input, int N ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - head_finder(N), - empty_formatter( Input ) ); + ::boost::algorithm::head_finder(N), + ::boost::algorithm::empty_formatter( Input ) ); } //! Erase head algorithm @@ -734,10 +734,10 @@ namespace boost { SequenceT& Input, int N ) { - find_format( + ::boost::algorithm::find_format( Input, - head_finder(N), - empty_formatter( Input ) ); + ::boost::algorithm::head_finder(N), + ::boost::algorithm::empty_formatter( Input ) ); } // erase_tail --------------------------------------------------------------------// @@ -768,11 +768,11 @@ namespace boost { const RangeT& Input, int N ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - tail_finder(N), - empty_formatter( Input ) ); + ::boost::algorithm::tail_finder(N), + ::boost::algorithm::empty_formatter( Input ) ); } //! Erase tail algorithm @@ -784,10 +784,10 @@ namespace boost { const SequenceT& Input, int N ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - tail_finder(N), - empty_formatter( Input ) ); + ::boost::algorithm::tail_finder(N), + ::boost::algorithm::empty_formatter( Input ) ); } //! Erase tail algorithm @@ -806,10 +806,10 @@ namespace boost { SequenceT& Input, int N ) { - find_format( + ::boost::algorithm::find_format( Input, - tail_finder(N), - empty_formatter( Input ) ); + ::boost::algorithm::tail_finder(N), + ::boost::algorithm::empty_formatter( Input ) ); } } // namespace algorithm diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/find.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/find.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/algorithm/string/find.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/find.hpp index 4196585be0..b282d1a59f 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/find.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/find.hpp @@ -53,7 +53,7 @@ namespace boost { RangeT& Input, const FinderT& Finder) { - iterator_range::type> lit_input(as_literal(Input)); + iterator_range::type> lit_input(::boost::as_literal(Input)); return Finder(::boost::begin(lit_input),::boost::end(lit_input)); } @@ -81,7 +81,7 @@ namespace boost { Range1T& Input, const Range2T& Search) { - return find(Input, first_finder(Search)); + return ::boost::algorithm::find(Input, ::boost::algorithm::first_finder(Search)); } //! Find first algorithm ( case insensitive ) @@ -108,7 +108,7 @@ namespace boost { const Range2T& Search, const std::locale& Loc=std::locale()) { - return find(Input, first_finder(Search,is_iequal(Loc))); + return ::boost::algorithm::find(Input, ::boost::algorithm::first_finder(Search,is_iequal(Loc))); } // find_last -----------------------------------------------// @@ -134,7 +134,7 @@ namespace boost { Range1T& Input, const Range2T& Search) { - return find(Input, last_finder(Search)); + return ::boost::algorithm::find(Input, ::boost::algorithm::last_finder(Search)); } //! Find last algorithm ( case insensitive ) @@ -161,7 +161,7 @@ namespace boost { const Range2T& Search, const std::locale& Loc=std::locale()) { - return find(Input, last_finder(Search, is_iequal(Loc))); + return ::boost::algorithm::find(Input, ::boost::algorithm::last_finder(Search, is_iequal(Loc))); } // find_nth ----------------------------------------------------------------------// @@ -189,7 +189,7 @@ namespace boost { const Range2T& Search, int Nth) { - return find(Input, nth_finder(Search,Nth)); + return ::boost::algorithm::find(Input, ::boost::algorithm::nth_finder(Search,Nth)); } //! Find n-th algorithm ( case insensitive ). @@ -220,7 +220,7 @@ namespace boost { int Nth, const std::locale& Loc=std::locale()) { - return find(Input, nth_finder(Search,Nth,is_iequal(Loc))); + return ::boost::algorithm::find(Input, ::boost::algorithm::nth_finder(Search,Nth,is_iequal(Loc))); } // find_head ----------------------------------------------------------------------// @@ -250,7 +250,7 @@ namespace boost { RangeT& Input, int N) { - return find(Input, head_finder(N)); + return ::boost::algorithm::find(Input, ::boost::algorithm::head_finder(N)); } // find_tail ----------------------------------------------------------------------// @@ -281,7 +281,7 @@ namespace boost { RangeT& Input, int N) { - return find(Input, tail_finder(N)); + return ::boost::algorithm::find(Input, ::boost::algorithm::tail_finder(N)); } // find_token --------------------------------------------------------------------// @@ -311,7 +311,7 @@ namespace boost { PredicateT Pred, token_compress_mode_type eCompress=token_compress_off) { - return find(Input, token_finder(Pred, eCompress)); + return ::boost::algorithm::find(Input, ::boost::algorithm::token_finder(Pred, eCompress)); } } // namespace algorithm diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/find_format.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/find_format.hpp similarity index 82% rename from deal.II/contrib/boost/include/boost/algorithm/string/find_format.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/find_format.hpp index 7cbaf34fbd..ef0373912a 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/find_format.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/find_format.hpp @@ -62,15 +62,18 @@ namespace boost { FormatterT Formatter ) { // Concept check - function_requires< - FinderConcept::type> >(); - function_requires< + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); - iterator_range::type> lit_input(as_literal(Input)); + iterator_range::type> lit_input(::boost::as_literal(Input)); return detail::find_format_copy_impl( Output, @@ -93,13 +96,16 @@ namespace boost { FormatterT Formatter ) { // Concept check - function_requires< - FinderConcept::type> >(); - function_requires< + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); return detail::find_format_copy_impl( Input, @@ -126,13 +132,16 @@ namespace boost { FormatterT Formatter) { // Concept check - function_requires< - FinderConcept::type> >(); - function_requires< + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); detail::find_format_impl( Input, @@ -172,15 +181,18 @@ namespace boost { FormatterT Formatter) { // Concept check - function_requires< - FinderConcept::type> >(); - function_requires< + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); - iterator_range::type> lit_input(as_literal(Input)); + iterator_range::type> lit_input(::boost::as_literal(Input)); return detail::find_format_all_copy_impl( Output, @@ -204,13 +216,16 @@ namespace boost { FormatterT Formatter ) { // Concept check - function_requires< - FinderConcept::type> >(); - function_requires< + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); return detail::find_format_all_copy_impl( Input, @@ -239,13 +254,16 @@ namespace boost { FormatterT Formatter ) { // Concept check - function_requires< - FinderConcept::type> >(); - function_requires< + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( FormatterConcept< FormatterT, - FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> >(); + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); detail::find_format_all_impl( Input, diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/find_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/find_iterator.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/algorithm/string/find_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/find_iterator.hpp index 211b87c138..4224a196bd 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/find_iterator.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/find_iterator.hpp @@ -113,8 +113,8 @@ namespace boost { FinderT Finder ) : detail::find_iterator_base(Finder,0) { - iterator_range::type> lit_col(as_literal(Col)); - m_Match=make_iterator_range(::boost::begin(lit_col), ::boost::begin(lit_col)); + iterator_range::type> lit_col(::boost::as_literal(Col)); + m_Match=::boost::make_iterator_range(::boost::begin(lit_col), ::boost::begin(lit_col)); m_End=::boost::end(lit_col); increment(); @@ -273,7 +273,7 @@ namespace boost { detail::find_iterator_base(Finder,0), m_bEof(false) { - iterator_range::type> lit_col(as_literal(Col)); + iterator_range::type> lit_col(::boost::as_literal(Col)); m_Match=make_iterator_range(::boost::begin(lit_col), ::boost::begin(lit_col)); m_Next=::boost::begin(lit_col); m_End=::boost::end(lit_col); diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/finder.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/finder.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/algorithm/string/finder.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/finder.hpp index c936ddb29e..4c7ac38b04 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/finder.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/finder.hpp @@ -56,7 +56,7 @@ namespace boost { detail::first_finderF< BOOST_STRING_TYPENAME range_const_iterator::type, - is_equal>( as_literal(Search), is_equal() ) ; + is_equal>( ::boost::as_literal(Search), is_equal() ) ; } //! "First" finder @@ -74,7 +74,7 @@ namespace boost { detail::first_finderF< BOOST_STRING_TYPENAME range_const_iterator::type, - PredicateT>( as_literal(Search), Comp ); + PredicateT>( ::boost::as_literal(Search), Comp ); } //! "Last" finder @@ -97,7 +97,7 @@ namespace boost { detail::last_finderF< BOOST_STRING_TYPENAME range_const_iterator::type, - is_equal>( as_literal(Search), is_equal() ); + is_equal>( ::boost::as_literal(Search), is_equal() ); } //! "Last" finder /*! @@ -113,7 +113,7 @@ namespace boost { detail::last_finderF< BOOST_STRING_TYPENAME range_const_iterator::type, - PredicateT>( as_literal(Search), Comp ) ; + PredicateT>( ::boost::as_literal(Search), Comp ) ; } //! "Nth" finder @@ -139,7 +139,7 @@ namespace boost { detail::nth_finderF< BOOST_STRING_TYPENAME range_const_iterator::type, - is_equal>( as_literal(Search), Nth, is_equal() ) ; + is_equal>( ::boost::as_literal(Search), Nth, is_equal() ) ; } //! "Nth" finder /*! @@ -158,7 +158,7 @@ namespace boost { detail::nth_finderF< BOOST_STRING_TYPENAME range_const_iterator::type, - PredicateT>( as_literal(Search), Nth, Comp ); + PredicateT>( ::boost::as_literal(Search), Nth, Comp ); } //! "Head" finder diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/formatter.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/formatter.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/algorithm/string/formatter.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/formatter.hpp index e04a50f42c..50006df102 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/formatter.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/formatter.hpp @@ -50,7 +50,7 @@ namespace boost { { return detail::const_formatF< iterator_range< - BOOST_STRING_TYPENAME range_const_iterator::type> >(as_literal(Format)); + BOOST_STRING_TYPENAME range_const_iterator::type> >(::boost::as_literal(Format)); } //! Identity formatter diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/iter_find.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/iter_find.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/algorithm/string/iter_find.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/iter_find.hpp index 525109b9fe..9e0245f1a7 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/iter_find.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/iter_find.hpp @@ -74,11 +74,13 @@ namespace boost { RangeT& Input, FinderT Finder ) { - function_requires< - FinderConcept::type> >(); + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_iterator::type> + )); - iterator_range::type> lit_input(as_literal(Input)); + iterator_range::type> lit_input(::boost::as_literal(Input)); typedef BOOST_STRING_TYPENAME range_iterator::type input_iterator_type; @@ -94,12 +96,12 @@ namespace boost { transform_iter_type; transform_iter_type itBegin= - make_transform_iterator( + ::boost::make_transform_iterator( find_iterator_type( ::boost::begin(lit_input), InputEnd, Finder ), copy_range_type()); transform_iter_type itEnd= - make_transform_iterator( + ::boost::make_transform_iterator( find_iterator_type(), copy_range_type()); @@ -143,11 +145,12 @@ namespace boost { RangeT& Input, FinderT Finder ) { - function_requires< + BOOST_CONCEPT_ASSERT(( FinderConcept::type> >(); + BOOST_STRING_TYPENAME range_iterator::type> + )); - iterator_range::type> lit_input(as_literal(Input)); + iterator_range::type> lit_input(::boost::as_literal(Input)); typedef BOOST_STRING_TYPENAME range_iterator::type input_iterator_type; @@ -163,12 +166,12 @@ namespace boost { transform_iter_type; transform_iter_type itBegin= - make_transform_iterator( + ::boost::make_transform_iterator( find_iterator_type( ::boost::begin(lit_input), InputEnd, Finder ), copy_range_type() ); transform_iter_type itEnd= - make_transform_iterator( + ::boost::make_transform_iterator( find_iterator_type(), copy_range_type() ); diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/join.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/join.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/algorithm/string/join.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/join.hpp index b215598913..b871eb44f6 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/join.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/join.hpp @@ -68,7 +68,7 @@ namespace boost { for(;itBegin!=itEnd; ++itBegin) { // Add separator - detail::insert(Result, ::boost::end(Result), as_literal(Separator)); + detail::insert(Result, ::boost::end(Result), ::boost::as_literal(Separator)); // Add element detail::insert(Result, ::boost::end(Result), *itBegin); } @@ -123,7 +123,7 @@ namespace boost { if(Pred(*itBegin)) { // Add separator - detail::insert(Result, ::boost::end(Result), as_literal(Separator)); + detail::insert(Result, ::boost::end(Result), ::boost::as_literal(Separator)); // Add element detail::insert(Result, ::boost::end(Result), *itBegin); } diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/predicate.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/predicate.hpp similarity index 90% rename from deal.II/contrib/boost/include/boost/algorithm/string/predicate.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/predicate.hpp index 8b62086441..6642f427d1 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/predicate.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/predicate.hpp @@ -59,8 +59,8 @@ namespace boost { const Range2T& Test, PredicateT Comp) { - iterator_range::type> lit_input(as_literal(Input)); - iterator_range::type> lit_test(as_literal(Test)); + iterator_range::type> lit_input(::boost::as_literal(Input)); + iterator_range::type> lit_test(::boost::as_literal(Test)); typedef BOOST_STRING_TYPENAME range_const_iterator::type Iterator1T; @@ -92,7 +92,7 @@ namespace boost { const Range1T& Input, const Range2T& Test) { - return starts_with(Input, Test, is_equal()); + return ::boost::algorithm::starts_with(Input, Test, is_equal()); } //! 'Starts with' predicate ( case insensitive ) @@ -114,7 +114,7 @@ namespace boost { const Range2T& Test, const std::locale& Loc=std::locale()) { - return starts_with(Input, Test, is_iequal(Loc)); + return ::boost::algorithm::starts_with(Input, Test, is_iequal(Loc)); } @@ -141,8 +141,8 @@ namespace boost { const Range2T& Test, PredicateT Comp) { - iterator_range::type> lit_input(as_literal(Input)); - iterator_range::type> lit_test(as_literal(Test)); + iterator_range::type> lit_input(::boost::as_literal(Input)); + iterator_range::type> lit_test(::boost::as_literal(Test)); typedef BOOST_STRING_TYPENAME range_const_iterator::type Iterator1T; @@ -169,7 +169,7 @@ namespace boost { const Range1T& Input, const Range2T& Test) { - return ends_with(Input, Test, is_equal()); + return ::boost::algorithm::ends_with(Input, Test, is_equal()); } //! 'Ends with' predicate ( case insensitive ) @@ -191,7 +191,7 @@ namespace boost { const Range2T& Test, const std::locale& Loc=std::locale()) { - return ends_with(Input, Test, is_iequal(Loc)); + return ::boost::algorithm::ends_with(Input, Test, is_iequal(Loc)); } // contains predicate -----------------------------------------------// @@ -215,17 +215,17 @@ namespace boost { const Range2T& Test, PredicateT Comp) { - iterator_range::type> lit_input(as_literal(Input)); - iterator_range::type> lit_test(as_literal(Test)); + iterator_range::type> lit_input(::boost::as_literal(Input)); + iterator_range::type> lit_test(::boost::as_literal(Test)); - if (empty(lit_test)) + if (::boost::empty(lit_test)) { // Empty range is contained always return true; } // Use the temporary variable to make VACPP happy - bool bResult=(first_finder(lit_test,Comp)(::boost::begin(lit_input), ::boost::end(lit_input))); + bool bResult=(::boost::algorithm::first_finder(lit_test,Comp)(::boost::begin(lit_input), ::boost::end(lit_input))); return bResult; } @@ -238,7 +238,7 @@ namespace boost { const Range1T& Input, const Range2T& Test) { - return contains(Input, Test, is_equal()); + return ::boost::algorithm::contains(Input, Test, is_equal()); } //! 'Contains' predicate ( case insensitive ) @@ -259,7 +259,7 @@ namespace boost { const Range2T& Test, const std::locale& Loc=std::locale()) { - return contains(Input, Test, is_iequal(Loc)); + return ::boost::algorithm::contains(Input, Test, is_iequal(Loc)); } // equals predicate -----------------------------------------------// @@ -286,8 +286,8 @@ namespace boost { const Range2T& Test, PredicateT Comp) { - iterator_range::type> lit_input(as_literal(Input)); - iterator_range::type> lit_test(as_literal(Test)); + iterator_range::type> lit_input(::boost::as_literal(Input)); + iterator_range::type> lit_test(::boost::as_literal(Test)); typedef BOOST_STRING_TYPENAME range_const_iterator::type Iterator1T; @@ -319,7 +319,7 @@ namespace boost { const Range1T& Input, const Range2T& Test) { - return equals(Input, Test, is_equal()); + return ::boost::algorithm::equals(Input, Test, is_equal()); } //! 'Equals' predicate ( case insensitive ) @@ -343,7 +343,7 @@ namespace boost { const Range2T& Test, const std::locale& Loc=std::locale()) { - return equals(Input, Test, is_iequal(Loc)); + return ::boost::algorithm::equals(Input, Test, is_iequal(Loc)); } // lexicographical_compare predicate -----------------------------// @@ -372,8 +372,8 @@ namespace boost { const Range2T& Arg2, PredicateT Pred) { - iterator_range::type> lit_arg1(as_literal(Arg1)); - iterator_range::type> lit_arg2(as_literal(Arg2)); + iterator_range::type> lit_arg1(::boost::as_literal(Arg1)); + iterator_range::type> lit_arg2(::boost::as_literal(Arg2)); return std::lexicographical_compare( ::boost::begin(lit_arg1), @@ -392,7 +392,7 @@ namespace boost { const Range1T& Arg1, const Range2T& Arg2) { - return lexicographical_compare(Arg1, Arg2, is_less()); + return ::boost::algorithm::lexicographical_compare(Arg1, Arg2, is_less()); } //! Lexicographical compare predicate (case-insensitive) @@ -417,7 +417,7 @@ namespace boost { const Range2T& Arg2, const std::locale& Loc=std::locale()) { - return lexicographical_compare(Arg1, Arg2, is_iless(Loc)); + return ::boost::algorithm::lexicographical_compare(Arg1, Arg2, is_iless(Loc)); } @@ -439,7 +439,7 @@ namespace boost { const RangeT& Input, PredicateT Pred) { - iterator_range::type> lit_input(as_literal(Input)); + iterator_range::type> lit_input(::boost::as_literal(Input)); typedef BOOST_STRING_TYPENAME range_const_iterator::type Iterator1T; diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/predicate_facade.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/predicate_facade.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/predicate_facade.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/predicate_facade.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/regex.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/regex.hpp similarity index 87% rename from deal.II/contrib/boost/include/boost/algorithm/string/regex.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/regex.hpp index b723204eff..0a4c38bd77 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/regex.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/regex.hpp @@ -60,9 +60,9 @@ namespace boost { const basic_regex& Rx, match_flag_type Flags=match_default ) { - iterator_range::type> lit_input(as_literal(Input)); + iterator_range::type> lit_input(::boost::as_literal(Input)); - return regex_finder(Rx,Flags)( + return ::boost::algorithm::regex_finder(Rx,Flags)( ::boost::begin(lit_input), ::boost::end(lit_input) ); } @@ -98,11 +98,11 @@ namespace boost { const std::basic_string& Format, match_flag_type Flags=match_default | format_default ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - regex_finder( Rx, Flags ), - regex_formatter( Format, Flags ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::regex_formatter( Format, Flags ) ); } //! Replace regex algorithm @@ -120,10 +120,10 @@ namespace boost { const std::basic_string& Format, match_flag_type Flags=match_default | format_default ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - regex_finder( Rx, Flags ), - regex_formatter( Format, Flags ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::regex_formatter( Format, Flags ) ); } //! Replace regex algorithm @@ -147,10 +147,10 @@ namespace boost { const std::basic_string& Format, match_flag_type Flags=match_default | format_default ) { - find_format( + ::boost::algorithm::find_format( Input, - regex_finder( Rx, Flags ), - regex_formatter( Format, Flags ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::regex_formatter( Format, Flags ) ); } // replace_all_regex --------------------------------------------------------------------// @@ -184,11 +184,11 @@ namespace boost { const std::basic_string& Format, match_flag_type Flags=match_default | format_default ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Output, Input, - regex_finder( Rx, Flags ), - regex_formatter( Format, Flags ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::regex_formatter( Format, Flags ) ); } //! Replace all regex algorithm @@ -206,10 +206,10 @@ namespace boost { const std::basic_string& Format, match_flag_type Flags=match_default | format_default ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Input, - regex_finder( Rx, Flags ), - regex_formatter( Format, Flags ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::regex_formatter( Format, Flags ) ); } //! Replace all regex algorithm @@ -233,10 +233,10 @@ namespace boost { const std::basic_string& Format, match_flag_type Flags=match_default | format_default ) { - find_format_all( + ::boost::algorithm::find_format_all( Input, - regex_finder( Rx, Flags ), - regex_formatter( Format, Flags ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::regex_formatter( Format, Flags ) ); } // erase_regex --------------------------------------------------------------------// @@ -267,11 +267,11 @@ namespace boost { const basic_regex& Rx, match_flag_type Flags=match_default ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - regex_finder( Rx, Flags ), - empty_formatter( Input ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::empty_formatter( Input ) ); } //! Erase regex algorithm @@ -287,10 +287,10 @@ namespace boost { const basic_regex& Rx, match_flag_type Flags=match_default ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - regex_finder( Rx, Flags ), - empty_formatter( Input ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::empty_formatter( Input ) ); } //! Erase regex algorithm @@ -311,10 +311,10 @@ namespace boost { const basic_regex& Rx, match_flag_type Flags=match_default ) { - find_format( + ::boost::algorithm::find_format( Input, - regex_finder( Rx, Flags ), - empty_formatter( Input ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::empty_formatter( Input ) ); } // erase_all_regex --------------------------------------------------------------------// @@ -346,11 +346,11 @@ namespace boost { const basic_regex& Rx, match_flag_type Flags=match_default ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Output, Input, - regex_finder( Rx, Flags ), - empty_formatter( Input ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::empty_formatter( Input ) ); } //! Erase all regex algorithm @@ -366,10 +366,10 @@ namespace boost { const basic_regex& Rx, match_flag_type Flags=match_default ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Input, - regex_finder( Rx, Flags ), - empty_formatter( Input ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::empty_formatter( Input ) ); } //! Erase all regex algorithm @@ -390,10 +390,10 @@ namespace boost { const basic_regex& Rx, match_flag_type Flags=match_default ) { - find_format_all( + ::boost::algorithm::find_format_all( Input, - regex_finder( Rx, Flags ), - empty_formatter( Input ) ); + ::boost::algorithm::regex_finder( Rx, Flags ), + ::boost::algorithm::empty_formatter( Input ) ); } // find_all_regex ------------------------------------------------------------------// @@ -431,10 +431,10 @@ namespace boost { const basic_regex& Rx, match_flag_type Flags=match_default ) { - return iter_find( + return ::boost::algorithm::iter_find( Result, Input, - regex_finder(Rx,Flags) ); + ::boost::algorithm::regex_finder(Rx,Flags) ); } // split_regex ------------------------------------------------------------------// @@ -472,10 +472,10 @@ namespace boost { const basic_regex& Rx, match_flag_type Flags=match_default ) { - return iter_split( + return ::boost::algorithm::iter_split( Result, Input, - regex_finder(Rx,Flags) ); + ::boost::algorithm::regex_finder(Rx,Flags) ); } // join_if ------------------------------------------------------------------// @@ -525,7 +525,7 @@ namespace boost { // Roll to the first element that will be added while( itBegin!=itEnd && - !regex_match(::boost::begin(*itBegin), ::boost::end(*itBegin), Rx, Flags)) ++itBegin; + !::boost::regex_match(::boost::begin(*itBegin), ::boost::end(*itBegin), Rx, Flags)) ++itBegin; // Add this element if(itBegin!=itEnd) @@ -536,10 +536,10 @@ namespace boost { for(;itBegin!=itEnd; ++itBegin) { - if(regex_match(::boost::begin(*itBegin), ::boost::end(*itBegin), Rx, Flags)) + if(::boost::regex_match(::boost::begin(*itBegin), ::boost::end(*itBegin), Rx, Flags)) { // Add separator - detail::insert(Result, ::boost::end(Result), as_literal(Separator)); + detail::insert(Result, ::boost::end(Result), ::boost::as_literal(Separator)); // Add element detail::insert(Result, ::boost::end(Result), *itBegin); } @@ -593,7 +593,7 @@ namespace boost { // Roll to the first element that will be added while( itBegin!=itEnd && - !regex_match(::boost::begin(*itBegin), ::boost::end(*itBegin), Rx, Flags)) ++itBegin; + !::boost::regex_match(::boost::begin(*itBegin), ::boost::end(*itBegin), Rx, Flags)) ++itBegin; // Add this element if(itBegin!=itEnd) @@ -604,10 +604,10 @@ namespace boost { for(;itBegin!=itEnd; ++itBegin) { - if(regex_match(::boost::begin(*itBegin), ::boost::end(*itBegin), Rx, Flags)) + if(::boost::regex_match(::boost::begin(*itBegin), ::boost::end(*itBegin), Rx, Flags)) { // Add separator - detail::insert(Result, ::boost::end(Result), as_literal(Separator)); + detail::insert(Result, ::boost::end(Result), ::boost::as_literal(Separator)); // Add element detail::insert(Result, ::boost::end(Result), *itBegin); } diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/regex_find_format.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/regex_find_format.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/regex_find_format.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/regex_find_format.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/replace.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/replace.hpp similarity index 83% rename from deal.II/contrib/boost/include/boost/algorithm/string/replace.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/replace.hpp index 1c59ec7707..f2d201f97f 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/replace.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/replace.hpp @@ -61,11 +61,11 @@ namespace boost { range_const_iterator::type>& SearchRange, const Range2T& Format) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - range_finder(SearchRange), - const_formatter(Format)); + ::boost::algorithm::range_finder(SearchRange), + ::boost::algorithm::const_formatter(Format)); } //! Replace range algorithm @@ -80,10 +80,10 @@ namespace boost { range_const_iterator::type>& SearchRange, const RangeT& Format) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - range_finder(SearchRange), - const_formatter(Format)); + ::boost::algorithm::range_finder(SearchRange), + ::boost::algorithm::const_formatter(Format)); } //! Replace range algorithm @@ -103,10 +103,10 @@ namespace boost { range_iterator::type>& SearchRange, const RangeT& Format) { - find_format( + ::boost::algorithm::find_format( Input, - range_finder(SearchRange), - const_formatter(Format)); + ::boost::algorithm::range_finder(SearchRange), + ::boost::algorithm::const_formatter(Format)); } // replace_first --------------------------------------------------------------------// @@ -138,11 +138,11 @@ namespace boost { const Range2T& Search, const Range3T& Format) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - first_finder(Search), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::const_formatter(Format) ); } //! Replace first algorithm @@ -155,10 +155,10 @@ namespace boost { const Range1T& Search, const Range2T& Format ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - first_finder(Search), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::const_formatter(Format) ); } //! Replace first algorithm @@ -176,10 +176,10 @@ namespace boost { const Range1T& Search, const Range2T& Format ) { - find_format( + ::boost::algorithm::find_format( Input, - first_finder(Search), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::const_formatter(Format) ); } // replace_first ( case insensitive ) ---------------------------------------------// @@ -214,11 +214,11 @@ namespace boost { const Range3T& Format, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - first_finder(Search, is_iequal(Loc)), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::const_formatter(Format) ); } //! Replace first algorithm ( case insensitive ) @@ -232,10 +232,10 @@ namespace boost { const Range1T& Format, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - first_finder(Search, is_iequal(Loc)), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::const_formatter(Format) ); } //! Replace first algorithm ( case insensitive ) @@ -256,10 +256,10 @@ namespace boost { const Range2T& Format, const std::locale& Loc=std::locale() ) { - find_format( + ::boost::algorithm::find_format( Input, - first_finder(Search, is_iequal(Loc)), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::const_formatter(Format) ); } // replace_last --------------------------------------------------------------------// @@ -291,11 +291,11 @@ namespace boost { const Range2T& Search, const Range3T& Format ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - last_finder(Search), - const_formatter(Format) ); + ::boost::algorithm::last_finder(Search), + ::boost::algorithm::const_formatter(Format) ); } //! Replace last algorithm @@ -308,10 +308,10 @@ namespace boost { const Range1T& Search, const Range2T& Format ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - last_finder(Search), - const_formatter(Format) ); + ::boost::algorithm::last_finder(Search), + ::boost::algorithm::const_formatter(Format) ); } //! Replace last algorithm @@ -329,10 +329,10 @@ namespace boost { const Range1T& Search, const Range2T& Format ) { - find_format( + ::boost::algorithm::find_format( Input, - last_finder(Search), - const_formatter(Format) ); + ::boost::algorithm::last_finder(Search), + ::boost::algorithm::const_formatter(Format) ); } // replace_last ( case insensitive ) -----------------------------------------------// @@ -367,11 +367,11 @@ namespace boost { const Range3T& Format, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - last_finder(Search, is_iequal(Loc)), - const_formatter(Format) ); + ::boost::algorithm::last_finder(Search, is_iequal(Loc)), + ::boost::algorithm::const_formatter(Format) ); } //! Replace last algorithm ( case insensitive ) @@ -385,10 +385,10 @@ namespace boost { const Range2T& Format, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - last_finder(Search, is_iequal(Loc)), - const_formatter(Format) ); + ::boost::algorithm::last_finder(Search, is_iequal(Loc)), + ::boost::algorithm::const_formatter(Format) ); } //! Replace last algorithm ( case insensitive ) @@ -410,10 +410,10 @@ namespace boost { const Range2T& Format, const std::locale& Loc=std::locale() ) { - find_format( + ::boost::algorithm::find_format( Input, - last_finder(Search, is_iequal(Loc)), - const_formatter(Format) ); + ::boost::algorithm::last_finder(Search, is_iequal(Loc)), + ::boost::algorithm::const_formatter(Format) ); } // replace_nth --------------------------------------------------------------------// @@ -448,11 +448,11 @@ namespace boost { int Nth, const Range3T& Format ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - nth_finder(Search, Nth), - const_formatter(Format) ); + ::boost::algorithm::nth_finder(Search, Nth), + ::boost::algorithm::const_formatter(Format) ); } //! Replace nth algorithm @@ -466,10 +466,10 @@ namespace boost { int Nth, const Range2T& Format ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - nth_finder(Search, Nth), - const_formatter(Format) ); + ::boost::algorithm::nth_finder(Search, Nth), + ::boost::algorithm::const_formatter(Format) ); } //! Replace nth algorithm @@ -490,10 +490,10 @@ namespace boost { int Nth, const Range2T& Format ) { - find_format( + ::boost::algorithm::find_format( Input, - nth_finder(Search, Nth), - const_formatter(Format) ); + ::boost::algorithm::nth_finder(Search, Nth), + ::boost::algorithm::const_formatter(Format) ); } // replace_nth ( case insensitive ) -----------------------------------------------// @@ -531,11 +531,11 @@ namespace boost { const Range3T& Format, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - nth_finder(Search, Nth, is_iequal(Loc) ), - const_formatter(Format) ); + ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc) ), + ::boost::algorithm::const_formatter(Format) ); } //! Replace nth algorithm ( case insensitive ) @@ -550,10 +550,10 @@ namespace boost { const Range2T& Format, const std::locale& Loc=std::locale() ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - nth_finder(Search, Nth, is_iequal(Loc)), - const_formatter(Format) ); + ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)), + ::boost::algorithm::const_formatter(Format) ); } //! Replace nth algorithm ( case insensitive ) @@ -577,10 +577,10 @@ namespace boost { const Range2T& Format, const std::locale& Loc=std::locale() ) { - find_format( + ::boost::algorithm::find_format( Input, - nth_finder(Search, Nth, is_iequal(Loc)), - const_formatter(Format) ); + ::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)), + ::boost::algorithm::const_formatter(Format) ); } // replace_all --------------------------------------------------------------------// @@ -612,11 +612,11 @@ namespace boost { const Range2T& Search, const Range3T& Format ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Output, Input, - first_finder(Search), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::const_formatter(Format) ); } //! Replace all algorithm @@ -629,10 +629,10 @@ namespace boost { const Range1T& Search, const Range2T& Format ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Input, - first_finder(Search), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::const_formatter(Format) ); } //! Replace all algorithm @@ -651,10 +651,10 @@ namespace boost { const Range1T& Search, const Range2T& Format ) { - find_format_all( + ::boost::algorithm::find_format_all( Input, - first_finder(Search), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search), + ::boost::algorithm::const_formatter(Format) ); } // replace_all ( case insensitive ) -----------------------------------------------// @@ -689,11 +689,11 @@ namespace boost { const Range3T& Format, const std::locale& Loc=std::locale() ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Output, Input, - first_finder(Search, is_iequal(Loc)), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::const_formatter(Format) ); } //! Replace all algorithm ( case insensitive ) @@ -707,10 +707,10 @@ namespace boost { const Range2T& Format, const std::locale& Loc=std::locale() ) { - return find_format_all_copy( + return ::boost::algorithm::find_format_all_copy( Input, - first_finder(Search, is_iequal(Loc)), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::const_formatter(Format) ); } //! Replace all algorithm ( case insensitive ) @@ -731,10 +731,10 @@ namespace boost { const Range2T& Format, const std::locale& Loc=std::locale() ) { - find_format_all( + ::boost::algorithm::find_format_all( Input, - first_finder(Search, is_iequal(Loc)), - const_formatter(Format) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc)), + ::boost::algorithm::const_formatter(Format) ); } // replace_head --------------------------------------------------------------------// @@ -769,11 +769,11 @@ namespace boost { int N, const Range2T& Format ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - head_finder(N), - const_formatter(Format) ); + ::boost::algorithm::head_finder(N), + ::boost::algorithm::const_formatter(Format) ); } //! Replace head algorithm @@ -786,10 +786,10 @@ namespace boost { int N, const RangeT& Format ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - head_finder(N), - const_formatter(Format) ); + ::boost::algorithm::head_finder(N), + ::boost::algorithm::const_formatter(Format) ); } //! Replace head algorithm @@ -811,10 +811,10 @@ namespace boost { int N, const RangeT& Format ) { - find_format( + ::boost::algorithm::find_format( Input, - head_finder(N), - const_formatter(Format) ); + ::boost::algorithm::head_finder(N), + ::boost::algorithm::const_formatter(Format) ); } // replace_tail --------------------------------------------------------------------// @@ -849,11 +849,11 @@ namespace boost { int N, const Range2T& Format ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Output, Input, - tail_finder(N), - const_formatter(Format) ); + ::boost::algorithm::tail_finder(N), + ::boost::algorithm::const_formatter(Format) ); } //! Replace tail algorithm @@ -866,10 +866,10 @@ namespace boost { int N, const RangeT& Format ) { - return find_format_copy( + return ::boost::algorithm::find_format_copy( Input, - tail_finder(N), - const_formatter(Format) ); + ::boost::algorithm::tail_finder(N), + ::boost::algorithm::const_formatter(Format) ); } //! Replace tail algorithm @@ -891,10 +891,10 @@ namespace boost { int N, const RangeT& Format ) { - find_format( + ::boost::algorithm::find_format( Input, - tail_finder(N), - const_formatter(Format) ); + ::boost::algorithm::tail_finder(N), + ::boost::algorithm::const_formatter(Format) ); } } // namespace algorithm diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/sequence_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/sequence_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/sequence_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/sequence_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/split.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/split.hpp similarity index 94% rename from deal.II/contrib/boost/include/boost/algorithm/string/split.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/split.hpp index f5c323cb9d..cae712c07f 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/split.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/split.hpp @@ -64,10 +64,10 @@ namespace boost { Range1T& Input, const Range2T& Search) { - return iter_find( + return ::boost::algorithm::iter_find( Result, Input, - first_finder(Search) ); + ::boost::algorithm::first_finder(Search) ); } //! Find all algorithm ( case insensitive ) @@ -100,10 +100,10 @@ namespace boost { const Range2T& Search, const std::locale& Loc=std::locale() ) { - return iter_find( + return ::boost::algorithm::iter_find( Result, Input, - first_finder(Search, is_iequal(Loc) ) ); + ::boost::algorithm::first_finder(Search, is_iequal(Loc) ) ); } @@ -143,10 +143,10 @@ namespace boost { PredicateT Pred, token_compress_mode_type eCompress=token_compress_off ) { - return iter_split( + return ::boost::algorithm::iter_split( Result, Input, - token_finder( Pred, eCompress ) ); + ::boost::algorithm::token_finder( Pred, eCompress ) ); } } // namespace algorithm diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/std/list_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/std/list_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/std/list_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/std/list_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/std/rope_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/std/rope_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/std/rope_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/std/rope_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/std/slist_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/std/slist_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/std/slist_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/std/slist_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/std/string_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/std/string_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/std/string_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/std/string_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/std_containers_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/std_containers_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/std_containers_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/std_containers_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/trim.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/trim.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/algorithm/string/trim.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/trim.hpp index 177ed1b51e..eb408a35e6 100644 --- a/deal.II/contrib/boost/include/boost/algorithm/string/trim.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/trim.hpp @@ -63,7 +63,7 @@ namespace boost { const RangeT& Input, PredicateT IsSpace) { - iterator_range::type> lit_range(as_literal(Input)); + iterator_range::type> lit_range(::boost::as_literal(Input)); std::copy( ::boost::algorithm::detail::trim_begin( @@ -106,7 +106,7 @@ namespace boost { inline SequenceT trim_left_copy(const SequenceT& Input, const std::locale& Loc=std::locale()) { return - trim_left_copy_if( + ::boost::algorithm::trim_left_copy_if( Input, is_space(Loc)); } @@ -142,7 +142,7 @@ namespace boost { template inline void trim_left(SequenceT& Input, const std::locale& Loc=std::locale()) { - trim_left_if( + ::boost::algorithm::trim_left_if( Input, is_space(Loc)); } @@ -171,7 +171,7 @@ namespace boost { const RangeT& Input, PredicateT IsSpace ) { - iterator_range::type> lit_range(as_literal(Input)); + iterator_range::type> lit_range(::boost::as_literal(Input)); std::copy( ::boost::begin(lit_range), @@ -215,7 +215,7 @@ namespace boost { inline SequenceT trim_right_copy(const SequenceT& Input, const std::locale& Loc=std::locale()) { return - trim_right_copy_if( + ::boost::algorithm::trim_right_copy_if( Input, is_space(Loc)); } @@ -254,7 +254,7 @@ namespace boost { template inline void trim_right(SequenceT& Input, const std::locale& Loc=std::locale()) { - trim_right_if( + ::boost::algorithm::trim_right_if( Input, is_space(Loc) ); } @@ -283,7 +283,7 @@ namespace boost { const RangeT& Input, PredicateT IsSpace) { - iterator_range::type> lit_range(as_literal(Input)); + iterator_range::type> lit_range(::boost::as_literal(Input)); BOOST_STRING_TYPENAME range_const_iterator::type TrimEnd= @@ -340,7 +340,7 @@ namespace boost { inline SequenceT trim_copy( const SequenceT& Input, const std::locale& Loc=std::locale() ) { return - trim_copy_if( + ::boost::algorithm::trim_copy_if( Input, is_space(Loc) ); } @@ -357,8 +357,8 @@ namespace boost { template inline void trim_if(SequenceT& Input, PredicateT IsSpace) { - trim_right_if( Input, IsSpace ); - trim_left_if( Input, IsSpace ); + ::boost::algorithm::trim_right_if( Input, IsSpace ); + ::boost::algorithm::trim_left_if( Input, IsSpace ); } //! Trim @@ -372,7 +372,7 @@ namespace boost { template inline void trim(SequenceT& Input, const std::locale& Loc=std::locale()) { - trim_if( + ::boost::algorithm::trim_if( Input, is_space( Loc ) ); } diff --git a/deal.II/contrib/boost/include/boost/algorithm/string/yes_no_type.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/yes_no_type.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string/yes_no_type.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string/yes_no_type.hpp diff --git a/deal.II/contrib/boost/include/boost/algorithm/string_regex.hpp b/deal.II/contrib/boost-1.41.0/include/boost/algorithm/string_regex.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/algorithm/string_regex.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/algorithm/string_regex.hpp diff --git a/deal.II/contrib/boost/include/boost/aligned_storage.hpp b/deal.II/contrib/boost-1.41.0/include/boost/aligned_storage.hpp similarity index 90% rename from deal.II/contrib/boost/include/boost/aligned_storage.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/aligned_storage.hpp index cfaf7877a1..ce277ab702 100644 --- a/deal.II/contrib/boost/include/boost/aligned_storage.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/aligned_storage.hpp @@ -54,6 +54,14 @@ struct aligned_storage_imp , type_with_alignment >::type align_; } data_; + void* address() const { return const_cast(this); } +}; + +template< std::size_t alignment_ > +struct aligned_storage_imp<0u,alignment_> +{ + /* intentionally empty */ + void* address() const { return 0; } }; }} // namespace detail::aligned_storage @@ -62,12 +70,15 @@ template < std::size_t size_ , std::size_t alignment_ = std::size_t(-1) > -class aligned_storage +class aligned_storage : +#ifndef __BORLANDC__ + private +#else + public +#endif + detail::aligned_storage::aligned_storage_imp { -private: // representation - - detail::aligned_storage::aligned_storage_imp data_; - + public: // constants typedef detail::aligned_storage::aligned_storage_imp type; @@ -118,14 +129,14 @@ public: // accessors void* address() { - return this; + return static_cast(this)->address(); } #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) const void* address() const { - return this; + return static_cast(this)->address(); } #else // MSVC6 diff --git a/deal.II/contrib/boost/include/boost/any.hpp b/deal.II/contrib/boost-1.41.0/include/boost/any.hpp similarity index 88% rename from deal.II/contrib/boost/include/boost/any.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/any.hpp index 483daca32e..a8c654c373 100644 --- a/deal.II/contrib/boost/include/boost/any.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/any.hpp @@ -19,6 +19,17 @@ #include #include +// See boost/python/type_id.hpp +// TODO: add BOOST_TYPEID_COMPARE_BY_NAME to config.hpp +# if (defined(__GNUC__) && __GNUC__ >= 3) \ + || defined(_AIX) \ + || ( defined(__sgi) && defined(__host_mips)) \ + || (defined(__hpux) && defined(__HP_aCC)) \ + || (defined(linux) && defined(__INTEL_COMPILER) && defined(__ICC)) +# define BOOST_AUX_ANY_TYPE_ID_NAME +#include +# endif + namespace boost { class any @@ -61,9 +72,9 @@ namespace boost return *this; } - any & operator=(const any & rhs) + any & operator=(any rhs) { - any(rhs).swap(*this); + rhs.swap(*this); return *this; } @@ -164,9 +175,14 @@ namespace boost template ValueType * any_cast(any * operand) { - return operand && operand->type() == typeid(ValueType) - ? &static_cast *>(operand->content)->held - : 0; + return operand && +#ifdef BOOST_AUX_ANY_TYPE_ID_NAME + std::strcmp(operand->type().name(), typeid(ValueType).name()) == 0 +#else + operand->type() == typeid(ValueType) +#endif + ? &static_cast *>(operand->content)->held + : 0; } template diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/add_facet.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/add_facet.hpp new file mode 100644 index 0000000000..6bafe9bdb2 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/add_facet.hpp @@ -0,0 +1,55 @@ +#ifndef BOOST_ARCHIVE_ADD_FACET_HPP +#define BOOST_ARCHIVE_ADD_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 +// add_facet.hpp + +// (C) Copyright 2003 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +// does STLport uses native STL for locales? +#if (defined(__SGI_STL_PORT)&& defined(_STLP_NO_OWN_IOSTREAMS)) +// and this native STL lib is old Dinkumware (has not defined _CPPLIB_VER) +# if (defined(_YVALS) && !defined(__IBMCPP__)) || !defined(_CPPLIB_VER) +# define BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT +# endif +#endif + +namespace boost { +namespace archive { + +template +inline std::locale * +add_facet(const std::locale &l, Facet * f){ + return + #if defined BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT + // std namespace used for native locale + new std::locale(std::_Addfac(l, f)); + #elif BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) // old Dinkumwar + // std namespace used for native locale + new std::locale(std::_Addfac(l, f)); + #else + // standard compatible + new std::locale(l, f); + #endif +} + +} // namespace archive +} // namespace boost + +#undef BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT + +#endif // BOOST_ARCHIVE_ADD_FACET_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/archive_exception.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/archive_exception.hpp new file mode 100644 index 0000000000..920fb534f4 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/archive_exception.hpp @@ -0,0 +1,96 @@ +#ifndef BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP +#define BOOST_ARCHIVE_ARCHIVE_EXCEPTION_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 +// archive/archive_exception.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#include +#include +#include + +// note: the only reason this is in here is that windows header +// includes #define exception_code _exception_code (arrrgghhhh!). +// the most expedient way to address this is be sure that this +// header is always included whenever this header file is included. +#if defined(BOOST_WINDOWS) +#include +#endif + +#include // must be the last header + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by archives +// +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception : + public virtual std::exception +{ +public: + typedef enum { + no_exception, // initialized without code + other_exception, // any excepton not listed below + unregistered_class, // attempt to serialize a pointer of an + // an unregistered class + invalid_signature, // first line of archive does not contain + // expected string + unsupported_version,// archive created with library version + // subsequent to this one + pointer_conflict, // an attempt has been made to directly + // serialize an object which has + // already been serialzed through a pointer. + // Were this permited, the archive load would result + // in the creation of an extra copy of the obect. + incompatible_native_format, // attempt to read native binary format + // on incompatible platform + array_size_too_short,// array being loaded doesn't fit in array allocated + stream_error, // i/o error on stream + invalid_class_name, // class name greater than the maximum permitted. + // most likely a corrupted archive or an attempt + // to insert virus via buffer overrun method. + unregistered_cast, // base - derived relationship not registered with + // void_cast_register + unsupported_class_version, // type saved with a version # greater than the + // one used by the program. This indicates that the proggram + // needs to be rebuilt. + multiple_code_instantiation // code for implementing serialization for some + // type has been instantiated in more than one module. + } exception_code; +protected: + std::string m_msg; +public: + exception_code code; + archive_exception( + exception_code c, + const char * e1 = NULL, + const char * e2 = NULL + ); + ~archive_exception() throw (); + virtual const char *what( ) const throw(); +protected: + archive_exception(); +}; + +}// namespace archive +}// namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_archive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_archive.hpp new file mode 100644 index 0000000000..668bd679b1 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_archive.hpp @@ -0,0 +1,120 @@ +#ifndef BOOST_ARCHIVE_BASIC_ARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_ARCHIVE_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 +// basic_archive.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#include +#include // must be the last header + +namespace boost { +namespace archive { + +BOOST_STRONG_TYPEDEF(unsigned int, version_type) +BOOST_STRONG_TYPEDEF(int, class_id_type) +BOOST_STRONG_TYPEDEF(int, class_id_optional_type) +BOOST_STRONG_TYPEDEF(int, class_id_reference_type) +BOOST_STRONG_TYPEDEF(unsigned int, object_id_type) +BOOST_STRONG_TYPEDEF(unsigned int, object_reference_type) + +struct tracking_type { +// typedef bool value_type; + bool t; + explicit tracking_type(const bool t_ = false) + : t(t_) + {}; + tracking_type(const tracking_type & t_) + : t(t_.t) + {} + operator bool () const { + return t; + }; + operator bool & () { + return t; + }; + tracking_type & operator=(const bool t_){ + t = t_; + return *this; + } + bool operator==(const tracking_type & rhs) const { + return t == rhs.t; + } + bool operator==(const bool & rhs) const { + return t == rhs; + } + tracking_type & operator=(const tracking_type & rhs){ + t = rhs.t; + return *this; + } +}; + +struct class_name_type : private boost::noncopyable { + char *t; + operator const char * & () const { + return const_cast(t); + } + operator char * () { + return t; + } + explicit class_name_type(const char *key_) + : t(const_cast(key_)){} + explicit class_name_type(char *key_) + : t(key_){} + class_name_type & operator=(const class_name_type & rhs){ + t = rhs.t; + return *this; + } +}; + +enum archive_flags { + no_header = 1, // suppress archive header info + no_codecvt = 2, // suppress alteration of codecvt facet + no_xml_tag_checking = 4, // suppress checking of xml tags + no_tracking = 8, // suppress ALL tracking + flags_last = 8 +}; + +#define NULL_POINTER_TAG class_id_type(-1) + +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_SIGNATURE(); + +BOOST_ARCHIVE_DECL(unsigned char) +BOOST_ARCHIVE_VERSION(); + +}// namespace archive +}// namespace boost + +#include // pops abi_suffix.hpp pragmas + +#include + +// set implementation level to primitive for all types +// used internally by the serialization library + +BOOST_CLASS_IMPLEMENTATION(boost::archive::version_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_reference_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_optional_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_name_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::object_id_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::object_reference_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::tracking_type, primitive_type) + +#endif //BOOST_ARCHIVE_BASIC_ARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_iarchive.hpp new file mode 100644 index 0000000000..2448c5fd35 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_iarchive.hpp @@ -0,0 +1,132 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_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 +// basic_binary_iarchive.hpp +// +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATED ON + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_binary_iarchive - read serialized objects from a input binary stream +template +class basic_binary_iarchive : + public detail::common_iarchive +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; +#else + friend class detail::interface_iarchive; +#endif + // intermediate level to support override of operators + // fot templates in the absence of partial function + // template ordering. If we get here pass to base class + // note extra nonsense to sneak it pass the borland compiers + typedef detail::common_iarchive detail_common_iarchive; + template + void load_override(T & t, BOOST_PFTO int version){ + this->detail_common_iarchive::load_override(t, static_cast(version)); + } + // binary files don't include the optional information + void load_override(class_id_optional_type & /* t */, int){} + + // the following have been overridden to provide specific sizes + // for these pseudo prmitive types. + void load_override(version_type & t, int){ + // upto 255 versions + unsigned char x=0; + * this->This() >> x; + t = version_type(x); + } + void load_override(class_id_type & t, int){ + // upto 32K classes + int_least16_t x=0; + * this->This() >> x; + t = class_id_type(x); + } + void load_override(class_id_reference_type & t, int){ + // upto 32K classes + int_least16_t x=0; + * this->This() >> x; + t = class_id_reference_type(x); + } + void load_override(object_id_type & t, int){ + // upto 2G objects + uint_least32_t x=0; + * this->This() >> x; + t = object_id_type(x); + } + void load_override(object_reference_type & t, int){ + // upto 2G objects + uint_least32_t x=0; + * this->This() >> x; + t = object_reference_type(x); + } + void load_override(tracking_type & t, int){ + char x=0; + * this->This() >> x; + t = (0 != x); + } + void load_override(serialization::collection_size_type & t, int){ + if (this->get_library_version() < 6) { + unsigned int x=0; + * this->This() >> x; + t = serialization::collection_size_type(x); + } + else { + std::size_t x=0; + * this->This() >> x; + t = serialization::collection_size_type(x); + } + } + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(class_name_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + + basic_binary_iarchive(unsigned int flags) : + detail::common_iarchive(flags) + {} +}; + +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_iprimitive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_iprimitive.hpp new file mode 100644 index 0000000000..11f5b3890a --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_iprimitive.hpp @@ -0,0 +1,185 @@ +#ifndef BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP +#define BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(_MSC_VER) +#pragma warning( disable : 4800 ) +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_iprimitive.hpp +// +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATED ON + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include +#include // std::memcpy +#include // std::size_t +#include // basic_streambuf +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +//#include +//#include + +#include +#include +#include +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////////// +// class binary_iarchive - read serialized objects from a input binary stream +template +class basic_binary_iprimitive +{ +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + friend class load_access; +protected: +#else +public: +#endif + std::basic_streambuf & m_sb; + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + + #ifndef BOOST_NO_STD_LOCALE + boost::scoped_ptr archive_locale; + basic_streambuf_locale_saver locale_saver; + #endif + + // main template for serilization of primitive types + template + void load(T & t){ + load_binary(& t, sizeof(T)); + } + + ///////////////////////////////////////////////////////// + // fundamental types that need special treatment + + // trap usage of invalid uninitialized boolean + void load(bool & t){ + load_binary(& t, sizeof(t)); + int i = t; + assert(0 == i || 1 == i); + (void)i; // warning suppression for release builds. + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load(std::wstring &ws); + #endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load(char * t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load(wchar_t * t); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_binary_iprimitive( + std::basic_streambuf & sb, + bool no_codecvt + ); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~basic_binary_iprimitive(); +public: + // we provide an optimized load for all fundamental types + // typedef serialization::is_bitwise_serializable + // use_array_optimization; + struct use_array_optimization { + template + #if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS) + struct apply { + typedef BOOST_DEDUCED_TYPENAME boost::serialization::is_bitwise_serializable::type type; + }; + #else + struct apply : public boost::serialization::is_bitwise_serializable {}; + #endif + }; + + // the optimized load_array dispatches to load_binary + template + void load_array(serialization::array& a, unsigned int) + { + load_binary(a.address(),a.count()*sizeof(ValueType)); + } + + void + load_binary(void *address, std::size_t count); +}; + +template +inline void +basic_binary_iprimitive::load_binary( + void *address, + std::size_t count +){ + // note: an optimizer should eliminate the following for char files + std::streamsize s = count / sizeof(Elem); + std::streamsize scount = m_sb.sgetn( + static_cast(address), + s + ); + if(scount != s) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + // note: an optimizer should eliminate the following for char files + s = count % sizeof(Elem); + if(0 < s){ +// if(is.fail()) +// boost::serialization::throw_exception( +// archive_exception(archive_exception::stream_error) +// ); + Elem t; + scount = m_sb.sgetn(& t, 1); + if(scount != 1) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + std::memcpy(static_cast(address) + (count - s), &t, s); + } +} + +} // namespace archive +} // namespace boost + +#include // pop pragmas + +#endif // BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_oarchive.hpp new file mode 100644 index 0000000000..d39d187b5e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_oarchive.hpp @@ -0,0 +1,132 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_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 +// basic_binary_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// class basic_binary_oarchive - write serialized objects to a binary output stream +// note: this archive has no pretensions to portability. Archive format +// may vary across machine architectures and compilers. About the only +// guarentee is that an archive created with this code will be readable +// by a program built with the same tools for the same machne. This class +// does have the virtue of buiding the smalles archive in the minimum amount +// of time. So under some circumstances it may be he right choice. +template +class basic_binary_oarchive : + public archive::detail::common_oarchive +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; +#else + friend class detail::interface_oarchive; +#endif + // any datatype not specifed below will be handled by base class + typedef detail::common_oarchive detail_common_oarchive; + template + void save_override(const T & t, BOOST_PFTO int version){ + this->detail_common_oarchive::save_override(t, static_cast(version)); + } + + // binary files don't include the optional information + void save_override(const class_id_optional_type & /* t */, int){} + + void save_override(const version_type & t, int){ + // upto 255 versions + // note:t.t resolves borland ambguity + assert(t.t <= boost::integer_traits::const_max); + const unsigned char x = static_cast(t.t); + * this->This() << x; + } + void save_override(const class_id_type & t, int){ + // upto 32K classes + assert(t.t <= boost::integer_traits::const_max); + const boost::int_least16_t x = static_cast(t.t); + * this->This() << x; + } + void save_override(const class_id_reference_type & t, int){ + // upto 32K classes + assert(t.t <= boost::integer_traits::const_max); + const boost::uint_least16_t x = t.t; + * this->This() << x; + } + void save_override(const object_id_type & t, int){ + // upto 2G objects + assert(t.t <= boost::integer_traits::const_max); + const boost::uint_least32_t x = t.t; + * this->This() << x; + } + void save_override(const object_reference_type & t, int){ + // upto 2G objects + assert(t.t <= boost::integer_traits::const_max); + const boost::uint_least32_t x = t.t; + * this->This() << x; + } + void save_override(const tracking_type & t, int){ + const char x = t.t; + * this->This() << x; + } + + // explicitly convert to char * to avoid compile ambiguities + void save_override(const class_name_type & t, int){ + const std::string s(t); + * this->This() << s; + } + + void save_override(const serialization::collection_size_type & t, int){ + // for backward compatibility, 64 bit integer or variable length integer would be preferred + std::size_t x = t.t; + * this->This() << x; + } + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + + basic_binary_oarchive(unsigned int flags) : + detail::common_oarchive(flags) + {} +}; + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_oprimitive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_oprimitive.hpp new file mode 100644 index 0000000000..c22c87cfee --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_binary_oprimitive.hpp @@ -0,0 +1,183 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_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 +// basic_binary_oprimitive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON + +#include +#include +#include +#include // basic_streambuf +#include +#include // size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +//#include +//#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_binary_oprimitive - binary output of prmitives + +template +class basic_binary_oprimitive +{ +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + friend class save_access; +protected: +#else +public: +#endif + std::basic_streambuf & m_sb; + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + #ifndef BOOST_NO_STD_LOCALE + boost::scoped_ptr archive_locale; + basic_streambuf_locale_saver locale_saver; + #endif + // default saving of primitives. + template + void save(const T & t) + { + save_binary(& t, sizeof(T)); + } + + ///////////////////////////////////////////////////////// + // fundamental types that need special treatment + + // trap usage of invalid uninitialized boolean which would + // otherwise crash on load. + void save(const bool t){ + assert(0 == static_cast(t) || 1 == static_cast(t)); + save_binary(& t, sizeof(t)); + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save(const std::wstring &ws); + #endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save(const char * t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save(const wchar_t * t); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_binary_oprimitive( + std::basic_streambuf & sb, + bool no_codecvt + ); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~basic_binary_oprimitive(); +public: + + // we provide an optimized save for all fundamental types + // typedef serialization::is_bitwise_serializable + // use_array_optimization; + // workaround without using mpl lambdas + struct use_array_optimization { + template + #if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS) + struct apply { + typedef BOOST_DEDUCED_TYPENAME boost::serialization::is_bitwise_serializable::type type; + }; + #else + struct apply : public boost::serialization::is_bitwise_serializable {}; + #endif + }; + + + // the optimized save_array dispatches to save_binary + template + void save_array(boost::serialization::array const& a, unsigned int) + { + save_binary(a.address(),a.count()*sizeof(ValueType)); + } + + void save_binary(const void *address, std::size_t count); +}; + +template +inline void +basic_binary_oprimitive::save_binary( + const void *address, + std::size_t count +){ + //assert( + // static_cast((std::numeric_limits::max)()) >= count + //); + // note: if the following assertions fail + // a likely cause is that the output stream is set to "text" + // mode where by cr characters recieve special treatment. + // be sure that the output stream is opened with ios::binary + //if(os.fail()) + // boost::serialization::throw_exception( + // archive_exception(archive_exception::stream_error) + // ); + // figure number of elements to output - round up + count = ( count + sizeof(Elem) - 1) + / sizeof(Elem); + std::streamsize scount = m_sb.sputn( + static_cast(address), + count + ); + if(count != static_cast(scount)) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + //os.write( + // static_cast(address), + // count + //); + //assert(os.good()); +} + +} //namespace boost +} //namespace archive + +#include // pop pragmas + +#endif // BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_streambuf_locale_saver.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_streambuf_locale_saver.hpp new file mode 100644 index 0000000000..3f587de720 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_streambuf_locale_saver.hpp @@ -0,0 +1,60 @@ +#ifndef BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP +#define BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_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 +// basic_streambuf_local_saver.hpp + +// (C) Copyright 2005 Robert Ramey - http://www.rrsd.com + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// note derived from boost/io/ios_state.hpp +// 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_NO_STD_LOCALE + +#include // for std::locale +#include // for std::basic_streambuf + +namespace boost{ +namespace archive{ + +template < typename Ch, class Tr > +class basic_streambuf_locale_saver +{ +public: + typedef ::std::basic_streambuf state_type; + typedef ::std::locale aspect_type; + explicit basic_streambuf_locale_saver( state_type &s ) + : s_save_( s ), a_save_( s.getloc() ) + {} + basic_streambuf_locale_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.pubimbue(a) ) + {} + ~basic_streambuf_locale_saver() + { this->restore(); } + void restore() + { s_save_.pubimbue( a_save_ ); } +private: + state_type & s_save_; + aspect_type const a_save_; +}; + +} // archive +} // boost + +#endif // BOOST_NO_STD_LOCALE +#endif // BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_iarchive.hpp new file mode 100644 index 0000000000..8080564666 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_iarchive.hpp @@ -0,0 +1,84 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_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 +// basic_text_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// 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 + +#include +#include +#include + +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_text_iarchive - read serialized objects from a input text stream +template +class basic_text_iarchive : + public detail::common_iarchive +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; +#else + friend class detail::interface_iarchive; +#endif + // intermediate level to support override of operators + // fot templates in the absence of partial function + // template ordering + typedef detail::common_iarchive detail_common_iarchive; + template + void load_override(T & t, BOOST_PFTO int) + { + this->detail_common_iarchive::load_override(t, 0); + } + // text file don't include the optional information + void load_override(class_id_optional_type & /*t*/, int){} + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(class_name_type & t, int); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(void); + + basic_text_iarchive(unsigned int flags) : + detail::common_iarchive(flags) + {} + ~basic_text_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_iprimitive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_iprimitive.hpp new file mode 100644 index 0000000000..da3234c812 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_iprimitive.hpp @@ -0,0 +1,143 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_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 +// basic_text_iprimitive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// archives stored as text - note these are 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 +// 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 + +#include +#include +#include // size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + #if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT) + using ::locale; + #endif +} // namespace std +#endif + +#include +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#include +#include +#include + +#include +#include +#include // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_text_iarchive - load serialized objects from a input text stream +template +class basic_text_iprimitive +{ +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +protected: +#else +public: +#endif + IStream &is; + io::ios_flags_saver flags_saver; + io::ios_precision_saver precision_saver; + + #ifndef BOOST_NO_STD_LOCALE + boost::scoped_ptr archive_locale; + io::basic_ios_locale_saver< + BOOST_DEDUCED_TYPENAME IStream::char_type, BOOST_DEDUCED_TYPENAME IStream::traits_type + > locale_saver; + #endif + + template + void load(T & t) + { + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + is >> t; + } + void load(unsigned char & t) + { + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + unsigned short int i; + is >> i; + t = static_cast(i); + } + void load(signed char & t) + { + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + signed short int i; + is >> i; + t = static_cast(i); + } + void load(char & t) + { + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + short int i; + is >> i; + t = static_cast(i); + } + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + void load(wchar_t & t) + { + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + unsigned i; + is >> i; + t = static_cast(i); + } + #endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_text_iprimitive(IStream &is, bool no_codecvt); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~basic_text_iprimitive(); +public: + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_binary(void *address, std::size_t count); +}; + +} // namespace archive +} // namespace boost + +#include // pop pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_oarchive.hpp new file mode 100644 index 0000000000..4fd55f0694 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_oarchive.hpp @@ -0,0 +1,134 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_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 +// basic_text_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// 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 + +#include +#include +#include +#include + +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_text_oarchive +template +class basic_text_oarchive : + public detail::common_oarchive +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ +|| BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x560)) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; +#else + friend class detail::interface_oarchive; +#endif + enum { + none, + eol, + space + } delimiter; + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + newtoken(); + + void newline(){ + delimiter = eol; + } + + // default processing - kick back to base class. Note the + // extra stuff to get it passed borland compilers + typedef detail::common_oarchive detail_common_oarchive; + template + void save_override(T & t, BOOST_PFTO int){ + this->detail_common_oarchive::save_override(t, 0); + } + + // start new objects on a new line + void save_override(const object_id_type & t, int){ + this->This()->newline(); + // note extra .t to funciton with Borland 5.51 compiler + // and invoke prmitive to underlying value + this->This()->save(t.t); + } + + void save_override(const object_reference_type & t, int){ + this->This()->newline(); + // note extra .t to funciton with Borland 5.51 compiler + // and invoke prmitive to underlying value + this->This()->save(t.t); + } + + // note the following four overrides are necessary for some borland + // compilers(5.51) which don't handle BOOST_STRONG_TYPE properly. + void save_override(const version_type & t, int){ + // note:t.t resolves borland ambguity + const unsigned int x = t.t; + * this->This() << x; + } + void save_override(const class_id_type & t, int){ + // note:t.t resolves borland ambguity + const int x = t.t; + * this->This() << x; + } + void save_override(const class_id_reference_type & t, int){ + // note:t.t resolves borland ambguity + const int x = t.t; + * this->This() << x; + } + + // text file don't include the optional information + void save_override(const class_id_optional_type & /* t */, int){} + + void save_override(const class_name_type & t, int){ + const std::string s(t); + * this->This() << s; + } + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + + basic_text_oarchive(unsigned int flags) : + detail::common_oarchive(flags), + delimiter(none) + {} + ~basic_text_oarchive(){} +}; + +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_oprimitive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_oprimitive.hpp new file mode 100644 index 0000000000..ba8770959e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_text_oprimitive.hpp @@ -0,0 +1,190 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_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 +// basic_text_oprimitive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// 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 + +#include +#include +#include // isnan +#include +#include // size_t + +#include +#include +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + #if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT) + using ::locale; + #endif +} // namespace std +#endif + +#include +#include +#include +#include + +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +class save_access; + +///////////////////////////////////////////////////////////////////////// +// class basic_text_oprimitive - output of prmitives to stream +template +class basic_text_oprimitive +{ +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +protected: +#else +public: +#endif + OStream &os; + io::ios_flags_saver flags_saver; + io::ios_precision_saver precision_saver; + + #ifndef BOOST_NO_STD_LOCALE + boost::scoped_ptr archive_locale; + io::basic_ios_locale_saver< + BOOST_DEDUCED_TYPENAME OStream::char_type, BOOST_DEDUCED_TYPENAME OStream::traits_type + > locale_saver; + #endif + + // default saving of primitives. + template + void save(const T &t){ + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << t; + } + + ///////////////////////////////////////////////////////// + // fundamental types that need special treatment + void save(const bool t){ + // trap usage of invalid uninitialized boolean which would + // otherwise crash on load. + assert(0 == static_cast(t) || 1 == static_cast(t)); + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << t; + } + void save(const signed char t) + { + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << static_cast(t); + } + void save(const unsigned char t) + { + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << static_cast(t); + } + void save(const char t) + { + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << static_cast(t); + } + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + void save(const wchar_t t) + { + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << static_cast(t); + } + #endif + void save(const float t) + { + // must be a user mistake - can't serialize un-initialized data + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << std::setprecision(std::numeric_limits::digits10 + 2); + os << t; + } + void save(const double t) + { + // must be a user mistake - can't serialize un-initialized data + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << std::setprecision(std::numeric_limits::digits10 + 2); + os << t; + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_text_oprimitive(OStream & os, bool no_codecvt); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~basic_text_oprimitive(); +public: + // unformatted append of one character + void put(int c){ + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os.put(c); + } + // unformatted append of null terminated string + void put(const char * s){ + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + while('\0' != *s) + os.put(*s++); + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_binary(const void *address, std::size_t count); +}; + +} //namespace boost +} //namespace archive + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_xml_archive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_xml_archive.hpp new file mode 100644 index 0000000000..df99836b97 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_xml_archive.hpp @@ -0,0 +1,67 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_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 +// basic_xml_archive.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +// constant strings used in xml i/o + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_OBJECT_ID(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_OBJECT_REFERENCE(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_CLASS_ID(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_CLASS_ID_REFERENCE(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_CLASS_NAME(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_TRACKING(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_VERSION(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_SIGNATURE(); + +}// namespace archive +}// namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_xml_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_xml_iarchive.hpp new file mode 100644 index 0000000000..fd3ae75589 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_xml_iarchive.hpp @@ -0,0 +1,118 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_XML_IARCHIVE_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 +// basic_xml_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#include + +#include +#include + +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class xml_iarchive - read serialized objects from a input text stream +template +class basic_xml_iarchive : + public detail::common_iarchive +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; +#else + friend class detail::interface_oarchive; +#endif + unsigned int depth; + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_start(const char *name); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_end(const char *name); + + // Anything not an attribute and not a name-value pair is an + // should be trapped here. + template + void load_override(T & t, BOOST_PFTO int) + { + // If your program fails to compile here, its most likely due to + // not specifying an nvp wrapper around the variable to + // be serialized. + BOOST_MPL_ASSERT((serialization::is_wrapper)); + this->detail_common_iarchive::load_override(t, 0); + } + + // Anything not an attribute - see below - should be a name value + // pair and be processed here + typedef detail::common_iarchive detail_common_iarchive; + template + void load_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + boost::serialization::nvp & t, + int + ){ + this->This()->load_start(t.name()); + this->detail_common_iarchive::load_override(t.value(), 0); + this->This()->load_end(t.name()); + } + + // specific overrides for attributes - handle as + // primitives. These are not name-value pairs + // so they have to be intercepted here and passed on to load. + // although the class_id is included in the xml text file in order + // to make the file self describing, it isn't used when loading + // an xml archive. So we can skip it here. Note: we MUST override + // it otherwise it will be loaded as a normal primitive w/o tag and + // leaving the archive in an undetermined state + void load_override(class_id_optional_type & /* t */, int){} + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(object_id_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(version_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(class_id_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(tracking_type & t, int); + // class_name_type can't be handled here as it depends upon the + // char type used by the stream. So require the derived implementation + // handle this. + // void load_override(class_name_type & t, int); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_xml_iarchive(unsigned int flags); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~basic_xml_iarchive(); +}; + +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_xml_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_xml_oarchive.hpp new file mode 100644 index 0000000000..0ba2589189 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/basic_xml_oarchive.hpp @@ -0,0 +1,136 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_XML_OARCHIVE_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 +// basic_xml_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include + +#include +#include +#include + +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// class basic_xml_oarchive - write serialized objects to a xml output stream +template +class basic_xml_oarchive : + public detail::common_oarchive +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + friend class save_access; +#else + friend class detail::interface_oarchive; + friend class save_access; +#endif + // special stuff for xml output + unsigned int depth; + bool indent_next; + bool pending_preamble; + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + indent(); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + write_attribute( + const char *attribute_name, + int t, + const char *conjunction = "=\"" + ); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + write_attribute( + const char *attribute_name, + const char *key + ); + // helpers used below + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_start(const char *name); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_end(const char *name); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + end_preamble(); + + // Anything not an attribute and not a name-value pair is an + // error and should be trapped here. + template + void save_override(T & t, BOOST_PFTO int) + { + // If your program fails to compile here, its most likely due to + // not specifying an nvp wrapper around the variable to + // be serialized. + BOOST_MPL_ASSERT((serialization::is_wrapper)); + this->detail_common_oarchive::save_override(t, 0); + } + + // special treatment for name-value pairs. + typedef detail::common_oarchive detail_common_oarchive; + template + void save_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + ::boost::serialization::nvp & t, + int + ){ + this->This()->save_start(t.name()); + this->detail_common_oarchive::save_override(t.const_value(), 0); + this->This()->save_end(t.name()); + } + + // specific overrides for attributes - not name value pairs so we + // want to trap them before the above "fall through" + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const object_id_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const object_reference_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const version_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const class_id_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const class_id_optional_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const class_id_reference_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const class_name_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const tracking_type & t, int); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_xml_oarchive(unsigned int flags); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~basic_xml_oarchive(); +}; + +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_iarchive.hpp new file mode 100644 index 0000000000..fdfc355e4a --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_iarchive.hpp @@ -0,0 +1,94 @@ +#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_IARCHIVE_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 +// binary_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { + +// do not derive from the classes below. If you want to extend this functionality +// via inhertance, derived from text_iarchive_impl instead. This will +// preserve correct static polymorphism. + +// same as binary_iarchive below - without the shared_ptr_helper +class naked_binary_iarchive : + public binary_iarchive_impl< + boost::archive::naked_binary_iarchive, + std::istream::char_type, + std::istream::traits_type + > +{ +public: + naked_binary_iarchive(std::istream & is, unsigned int flags = 0) : + binary_iarchive_impl< + naked_binary_iarchive, std::istream::char_type, std::istream::traits_type + >(is, flags) + {} + naked_binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) : + binary_iarchive_impl< + naked_binary_iarchive, std::istream::char_type, std::istream::traits_type + >(bsb, flags) + {} +}; + +} // namespace archive +} // namespace boost + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include + +namespace boost { +namespace archive { + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from binary_iarchive_impl instead. This will +// preserve correct static polymorphism. +class binary_iarchive : + public binary_iarchive_impl< + boost::archive::binary_iarchive, + std::istream::char_type, + std::istream::traits_type + >, + public detail::shared_ptr_helper +{ +public: + binary_iarchive(std::istream & is, unsigned int flags = 0) : + binary_iarchive_impl< + binary_iarchive, std::istream::char_type, std::istream::traits_type + >(is, flags) + {} + binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) : + binary_iarchive_impl< + binary_iarchive, std::istream::char_type, std::istream::traits_type + >(bsb, flags) + {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_iarchive) +BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::archive::binary_iarchive) + +#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_iarchive_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_iarchive_impl.hpp new file mode 100644 index 0000000000..c1d04d10e1 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_iarchive_impl.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP +#define BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_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 +// binary_iarchive_impl.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +template +class binary_iarchive_impl : + public basic_binary_iprimitive, + public basic_binary_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive; + friend class basic_binary_iarchive; + friend class load_access; +protected: +#endif + // note: the following should not needed - but one compiler (vc 7.1) + // fails to compile one test (test_shared_ptr) without it !!! + // make this protected so it can be called from a derived archive + template + void load_override(T & t, BOOST_PFTO int){ + this->basic_binary_iarchive::load_override(t, 0L); + } + void init(unsigned int flags){ + if(0 != (flags & no_header)) + return; + #if ! defined(__MWERKS__) + this->basic_binary_iarchive::init(); + this->basic_binary_iprimitive::init(); + #else + basic_binary_iarchive::init(); + basic_binary_iprimitive::init(); + #endif + } + binary_iarchive_impl( + std::basic_streambuf & bsb, + unsigned int flags + ) : + basic_binary_iprimitive( + bsb, + 0 != (flags & no_codecvt) + ), + basic_binary_iarchive(flags) + { + init(flags); + } + binary_iarchive_impl( + std::basic_istream & is, + unsigned int flags + ) : + basic_binary_iprimitive( + * is.rdbuf(), + 0 != (flags & no_codecvt) + ), + basic_binary_iarchive(flags) + { + init(flags); + } +}; + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_oarchive.hpp new file mode 100644 index 0000000000..ee5e7d8cdb --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_oarchive.hpp @@ -0,0 +1,56 @@ +#ifndef BOOST_ARCHIVE_BINARY_OARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_OARCHIVE_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 +// binary_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from binary_oarchive_impl instead. This will +// preserve correct static polymorphism. +class binary_oarchive : + public binary_oarchive_impl< + binary_oarchive, std::ostream::char_type, std::ostream::traits_type + > +{ +public: + binary_oarchive(std::ostream & os, unsigned int flags = 0) : + binary_oarchive_impl< + binary_oarchive, std::ostream::char_type, std::ostream::traits_type + >(os, flags) + {} + binary_oarchive(std::streambuf & bsb, unsigned int flags = 0) : + binary_oarchive_impl< + binary_oarchive, std::ostream::char_type, std::ostream::traits_type + >(bsb, flags) + {} +}; + +typedef binary_oarchive naked_binary_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_oarchive) +BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::archive::binary_oarchive) + +#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_oarchive_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_oarchive_impl.hpp new file mode 100644 index 0000000000..331a8744cd --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_oarchive_impl.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP +#define BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_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 +// binary_oarchive_impl.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +template +class binary_oarchive_impl : + public basic_binary_oprimitive, + public basic_binary_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive; + friend class basic_binary_oarchive; + friend class save_access; +protected: +#endif + // note: the following should not needed - but one compiler (vc 7.1) + // fails to compile one test (test_shared_ptr) without it !!! + // make this protected so it can be called from a derived archive + template + void save_override(T & t, BOOST_PFTO int){ + this->basic_binary_oarchive::save_override(t, 0L); + } + void init(unsigned int flags) { + if(0 != (flags & no_header)) + return; + #if ! defined(__MWERKS__) + this->basic_binary_oarchive::init(); + this->basic_binary_oprimitive::init(); + #else + basic_binary_oarchive::init(); + basic_binary_oprimitive::init(); + #endif + } + binary_oarchive_impl( + std::basic_streambuf & bsb, + unsigned int flags + ) : + basic_binary_oprimitive( + bsb, + 0 != (flags & no_codecvt) + ), + basic_binary_oarchive(flags) + { + init(flags); + } + binary_oarchive_impl( + std::basic_ostream & os, + unsigned int flags + ) : + basic_binary_oprimitive( + * os.rdbuf(), + 0 != (flags & no_codecvt) + ), + basic_binary_oarchive(flags) + { + init(flags); + } +}; + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_wiarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_wiarchive.hpp new file mode 100644 index 0000000000..b5f6a7106b --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_wiarchive.hpp @@ -0,0 +1,93 @@ +#ifndef BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_WIARCHIVE_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 +// binary_wiarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include // wistream +#include +#include + +namespace boost { +namespace archive { + +// same as binary_wiarchive below - without the shared_ptr_helper +class naked_binary_wiarchive : + public binary_iarchive_impl< + boost::archive::naked_binary_wiarchive, + std::wistream::char_type, + std::wistream::traits_type + > +{ +public: + naked_binary_wiarchive(std::wistream & is, unsigned int flags = 0) : + binary_iarchive_impl< + naked_binary_wiarchive, + std::wistream::char_type, + std::wistream::traits_type + >(is, flags) + {} + naked_binary_wiarchive(std::wstreambuf & bsb, unsigned int flags = 0) : + binary_iarchive_impl< + naked_binary_wiarchive, + std::wistream::char_type, + std::wistream::traits_type + >(bsb, flags) + {} +}; + +} // namespace archive +} // namespace boost + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include + +namespace boost { +namespace archive { + +class binary_wiarchive : + public binary_iarchive_impl< + binary_wiarchive, std::wistream::char_type, std::wistream::traits_type + > +{ +public: + binary_wiarchive(std::wistream & is, unsigned int flags = 0) : + binary_iarchive_impl< + binary_wiarchive, std::wistream::char_type, std::wistream::traits_type + >(is, flags) + {} + binary_wiarchive(std::wstreambuf & bsb, unsigned int flags = 0) : + binary_iarchive_impl< + binary_wiarchive, std::wistream::char_type, std::wistream::traits_type + >(bsb, flags) + {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_wiarchive) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_woarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_woarchive.hpp new file mode 100644 index 0000000000..2075dac8bc --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/binary_woarchive.hpp @@ -0,0 +1,61 @@ +#ifndef BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_WOARCHIVE_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 +// binary_woarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include +#include + +namespace boost { +namespace archive { + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from binary_oarchive_impl instead. This will +// preserve correct static polymorphism. +class binary_woarchive : + public binary_oarchive_impl< + binary_woarchive, std::wostream::char_type, std::wostream::traits_type + > +{ +public: + binary_woarchive(std::wostream & os, unsigned int flags = 0) : + binary_oarchive_impl< + binary_woarchive, std::wostream::char_type, std::wostream::traits_type + >(os, flags) + {} + binary_woarchive(std::wstreambuf & bsb, unsigned int flags = 0) : + binary_oarchive_impl< + binary_woarchive, std::wostream::char_type, std::wostream::traits_type + >(bsb, flags) + {} +}; + +typedef binary_woarchive naked_binary_woarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_woarchive) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/codecvt_null.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/codecvt_null.hpp new file mode 100644 index 0000000000..ba88aea06d --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/codecvt_null.hpp @@ -0,0 +1,92 @@ +#ifndef BOOST_ARCHIVE_CODECVT_NULL_HPP +#define BOOST_ARCHIVE_CODECVT_NULL_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 +// codecvt_null.hpp: + +// (C) Copyright 2004 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL, size_t +#include // for mbstate_t +#include +#include +#include // must be the last header + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std { +// For STLport on WinCE, BOOST_NO_STDC_NAMESPACE can get defined if STLport is putting symbols in its own namespace. +// In the case of codecvt, however, this does not mean that codecvt is in the global namespace (it will be in STLport's namespace) +# if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + using ::codecvt; +# endif + using ::mbstate_t; + using ::size_t; +} // namespace +#endif + +namespace boost { +namespace archive { + +template +class codecvt_null; + +template<> +class codecvt_null : public std::codecvt +{ + virtual bool do_always_noconv() const throw() { + return true; + } +public: + explicit codecvt_null(std::size_t no_locale_manage = 0) : + std::codecvt(no_locale_manage) + {} +}; + +template<> +class codecvt_null : public std::codecvt +{ + virtual BOOST_WARCHIVE_DECL(std::codecvt_base::result) + do_out( + std::mbstate_t & state, + const wchar_t * first1, + const wchar_t * last1, + const wchar_t * & next1, + char * first2, + char * last2, + char * & next2 + ) const; + virtual BOOST_WARCHIVE_DECL(std::codecvt_base::result) + do_in( + std::mbstate_t & state, + const char * first1, + const char * last1, + const char * & next1, + wchar_t * first2, + wchar_t * last2, + wchar_t * & next2 + ) const; + virtual int do_encoding( ) const throw( ){ + return sizeof(wchar_t) / sizeof(char); + } + virtual int do_max_length( ) const throw( ){ + return do_encoding(); + } +}; + +} // namespace archive +} // namespace boost + +#include // pop pragmas + +#endif //BOOST_ARCHIVE_CODECVT_NULL_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/abi_prefix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/abi_prefix.hpp new file mode 100644 index 0000000000..e39ef11f18 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/abi_prefix.hpp @@ -0,0 +1,20 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// abi_prefix.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // must be the last header +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4251 4231 4660 4275) +#endif + +#if defined( __BORLANDC__ ) +#pragma nopushoptwarn +#endif + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/abi_suffix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/abi_suffix.hpp new file mode 100644 index 0000000000..a283b36cf3 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/abi_suffix.hpp @@ -0,0 +1,19 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// abi_suffix.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif +#include // pops abi_suffix.hpp pragmas + +#if defined( __BORLANDC__ ) +#pragma nopushoptwarn +#endif + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/archive_serializer_map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/archive_serializer_map.hpp new file mode 100644 index 0000000000..096a24be34 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/archive_serializer_map.hpp @@ -0,0 +1,55 @@ +#ifndef BOOST_ARCHIVE_SERIALIZER_MAP_HPP +#define BOOST_ARCHIVE_SERIALIZER_MAP_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 +// archive_serializer_map.hpp: extenstion of type_info required for +// serialization. + +// (C) Copyright 2009 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// note: this is nothing more than the thinest of wrappers around +// basic_serializer_map so we can have a one map / archive type. + +#include +#include +#include // must be the last header + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class basic_serializer; + +template +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) archive_serializer_map +{ +public: + static bool insert(const basic_serializer * bs); + static void erase(const basic_serializer * bs); + static const basic_serializer * find( + const boost::serialization::extended_type_info & type_ + ); +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // must be the last header + +#endif //BOOST_ARCHIVE_SERIALIZER_MAP_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/auto_link_archive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/auto_link_archive.hpp new file mode 100644 index 0000000000..af2788b536 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/auto_link_archive.hpp @@ -0,0 +1,48 @@ +#ifndef BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_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 +// auto_link_archive.hpp +// +// (c) Copyright Robert Ramey 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) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +// enable automatic library variant selection ------------------------------// + +#include + +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) \ +&& !defined(BOOST_ARCHIVE_SOURCE) && !defined(BOOST_WARCHIVE_SOURCE) \ +&& !defined(BOOST_SERIALIZATION_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_serialization + // + // If we're importing code from a dll, then tell auto_link.hpp about it: + // + #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) + # define BOOST_DYN_LINK + #endif + // + // And include the header that does the work: + // + #include +#endif // auto-linking disabled + +#endif // ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/auto_link_warchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/auto_link_warchive.hpp new file mode 100644 index 0000000000..4d4efcd44f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/auto_link_warchive.hpp @@ -0,0 +1,47 @@ +#ifndef BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_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 +// auto_link_warchive.hpp +// +// (c) Copyright Robert Ramey 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) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +// enable automatic library variant selection ------------------------------// + +#include + +#if !defined(BOOST_WARCHIVE_SOURCE) \ +&& !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_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_wserialization +// +// If we're importing code from a dll, then tell auto_link.hpp about it: +// +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) +# define BOOST_DYN_LINK +#endif +// +// And include the header that does the work: +// +#include +#endif // auto-linking disabled + +#endif // ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_archive_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_archive_impl.hpp new file mode 100644 index 0000000000..589368ddc1 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_archive_impl.hpp @@ -0,0 +1,48 @@ +#ifndef BOOST_ARCHIVE_DETAIL_BASIC_ARCHIVE_IMPL_HPP +#define BOOST_ARCHIVE_DETAIL_BASIC_ARCHIVE_IMPL_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 +// basic_archive_impl.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// can't use this - much as I'd like to as borland doesn't support it +// #include + +#include + +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +////////////////////////////////////////////////////////////////////// +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_archive_impl +{ +}; + +} // namespace detail +} // namespace serialization +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_DETAIL_BASIC_ARCHIVE_IMPL_HPP + + + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_config.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_config.hpp new file mode 100644 index 0000000000..5e37cae40b --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_config.hpp @@ -0,0 +1,45 @@ +#ifndef BOOST_ARCHIVE_DETAIL_BASIC_CONFIG_HPP +#define BOOST_ARCHIVE_DETAIL_BASIC_CONFIG_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// basic_config.hpp ---------------------------------------------// + +// (c) Copyright Robert Ramey 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) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +#include + +#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_ARCHIVE_DYN_LINK +// if they want just this one to be dynamically linked: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_ARCHIVE_DYN_LINK) +// export if this is our own source, otherwise import: +#ifdef BOOST_ARCHIVE_SOURCE +# define BOOST_ARCHIVE_DECL __declspec(dllexport) +#else +# define BOOST_ARCHIVE_DECL __declspec(dllimport) +#endif // BOOST_ARCHIVE_SOURCE +#endif // DYN_LINK +#endif // BOOST_HAS_DECLSPEC +// +// if BOOST_ARCHIVE_DECL isn't defined yet define it now: +#ifndef BOOST_ARCHIVE_DECL +#define BOOST_ARCHIVE_DECL +#endif + +#endif // BOOST_ARCHIVE_DETAIL_BASIC_CONFIG_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_iarchive.hpp new file mode 100644 index 0000000000..4c9707c26d --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_iarchive.hpp @@ -0,0 +1,106 @@ +#ifndef BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_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 +// basic_iarchive.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// can't use this - much as I'd like to as borland doesn't support it +// #include + +#include +#include +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class basic_iarchive_impl; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iserializer; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer; +////////////////////////////////////////////////////////////////////// +// class basic_iarchive - read serialized objects from a input stream +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive +{ + friend class basic_iarchive_impl; + // hide implementation of this class to minimize header conclusion + // in client code. I couldn't used scoped pointer with borland + // boost::scoped_ptr pimpl; + basic_iarchive_impl * pimpl; + + virtual void vload(version_type &t) = 0; + virtual void vload(object_id_type &t) = 0; + virtual void vload(class_id_type &t) = 0; + virtual void vload(class_id_optional_type &t) = 0; + virtual void vload(class_name_type &t) = 0; + virtual void vload(tracking_type &t) = 0; + + virtual const basic_pointer_iserializer * + find(const boost::serialization::extended_type_info & eti) const = 0; +protected: + basic_iarchive(unsigned int flags); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_iarchive(); +public: + // note: NOT part of the public API. + void next_object_pointer(void *t); + void register_basic_serializer( + const basic_iserializer & bis + ); + void load_object( + void *t, + const basic_iserializer & bis + ); + const basic_pointer_iserializer * + load_pointer( + void * & t, + const basic_pointer_iserializer * bpis_ptr + ); + // real public API starts here + void + set_library_version(unsigned int archive_library_version); + unsigned int + get_library_version() const; + unsigned int + get_flags() const; + void + reset_object_address(const void * new_address, const void * old_address); + void + delete_created_pointers(); +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +// required by smart_cast for compilers not implementing +// partial template specialization +BOOST_TT_BROKEN_COMPILER_SPEC( + boost::archive::detail::basic_iarchive +) + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_iserializer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_iserializer.hpp new file mode 100644 index 0000000000..de9654f911 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_iserializer.hpp @@ -0,0 +1,86 @@ +#ifndef BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP +#define BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_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 +// basic_iserializer.hpp: extenstion of type_info required for serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // NULL +#include + +#include +#include +#include +#include // must be the last header + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +// forward declarations +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer; + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iserializer : + public basic_serializer +{ +private: + basic_pointer_iserializer *m_bpis; +protected: + explicit basic_iserializer( + const boost::serialization::extended_type_info & type + ); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_iserializer(); +public: + bool serialized_as_pointer() const { + return m_bpis != NULL; + } + void set_bpis(basic_pointer_iserializer *bpis){ + m_bpis = bpis; + } + const basic_pointer_iserializer * get_bpis_ptr() const { + return m_bpis; + } + virtual void load_object_data( + basic_iarchive & ar, + void *x, + const unsigned int file_version + ) const = 0; + // returns true if class_info should be saved + virtual bool class_info() const = 0 ; + // returns true if objects should be tracked + virtual bool tracking(const unsigned int) const = 0 ; + // returns class version + virtual unsigned int version() const = 0 ; + // returns true if this class is polymorphic + virtual bool is_polymorphic() const = 0; + virtual void destroy(/*const*/ void *address) const = 0 ; +}; + +} // namespae detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_oarchive.hpp new file mode 100644 index 0000000000..0a1b4042a2 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_oarchive.hpp @@ -0,0 +1,103 @@ +#ifndef BOOST_ARCHIVE_BASIC_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_OARCHIVE_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 +// basic_oarchive.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL +#include + +// can't use this - much as I'd like to as borland doesn't support it +// #include + +#include +#include + +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class basic_oarchive_impl; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer; +////////////////////////////////////////////////////////////////////// +// class basic_oarchive - write serialized objects to an output stream +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive +{ + friend class basic_oarchive_impl; + // hide implementation of this class to minimize header conclusion + // in client code. note: borland can't use scoped_ptr + //boost::scoped_ptr pimpl; + basic_oarchive_impl * pimpl; + + // overload these to bracket object attributes. Used to implement + // xml archives + virtual void vsave(const version_type t) = 0; + virtual void vsave(const object_id_type t) = 0; + virtual void vsave(const object_reference_type t) = 0; + virtual void vsave(const class_id_type t) = 0; + virtual void vsave(const class_id_optional_type t) = 0; + virtual void vsave(const class_id_reference_type t) = 0; + virtual void vsave(const class_name_type & t) = 0; + virtual void vsave(const tracking_type t) = 0; +protected: + basic_oarchive(unsigned int flags = 0); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_oarchive(); +public: + // note: NOT part of the public interface + void register_basic_serializer( + const basic_oserializer & bos + ); + void save_object( + const void *x, + const basic_oserializer & bos + ); + void save_pointer( + const void * t, + const basic_pointer_oserializer * bpos_ptr + ); + void save_null_pointer(){ + vsave(NULL_POINTER_TAG); + } + // real public interface starts here + void end_preamble(); // default implementation does nothing + unsigned int get_library_version() const; + unsigned int get_flags() const; +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +// required by smart_cast for compilers not implementing +// partial template specialization +BOOST_TT_BROKEN_COMPILER_SPEC( + boost::archive::detail::basic_oarchive +) + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_oserializer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_oserializer.hpp new file mode 100644 index 0000000000..69a06cb9fc --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_oserializer.hpp @@ -0,0 +1,83 @@ +#ifndef BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP +#define BOOST_SERIALIZATION_BASIC_OSERIALIZER_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 +// basic_oserializer.hpp: extenstion of type_info required for serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // NULL +#include + +#include +#include + +#include // must be the last header + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +// forward declarations +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer; + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer : + public basic_serializer +{ +private: + basic_pointer_oserializer *m_bpos; +protected: + explicit basic_oserializer( + const boost::serialization::extended_type_info & type_ + ); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_oserializer(); +public: + bool serialized_as_pointer() const { + return m_bpos != NULL; + } + void set_bpos(basic_pointer_oserializer *bpos){ + m_bpos = bpos; + } + const basic_pointer_oserializer * get_bpos() const { + return m_bpos; + } + virtual void save_object_data( + basic_oarchive & ar, const void * x + ) const = 0; + // returns true if class_info should be saved + virtual bool class_info() const = 0; + // returns true if objects should be tracked + virtual bool tracking(const unsigned int flags) const = 0; + // returns class version + virtual unsigned int version() const = 0; + // returns true if this class is polymorphic + virtual bool is_polymorphic() const = 0; +}; + +} // namespace detail +} // namespace serialization +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_pointer_iserializer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_pointer_iserializer.hpp new file mode 100644 index 0000000000..1a469382c8 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_pointer_iserializer.hpp @@ -0,0 +1,64 @@ +#ifndef BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP +#define BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_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 +// basic_pointer_oserializer.hpp: extenstion of type_info required for +// serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include + +#include // must be the last header + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +// forward declarations +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iserializer; + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer + : public basic_serializer { +protected: + explicit basic_pointer_iserializer( + const boost::serialization::extended_type_info & type_ + ); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_pointer_iserializer(); +public: + virtual const basic_iserializer & get_basic_serializer() const = 0; + virtual void load_object_ptr( + basic_iarchive & ar, + void * & x, + const unsigned int file_version + ) const = 0; +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_pointer_oserializer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_pointer_oserializer.hpp new file mode 100644 index 0000000000..9c8d7177d7 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_pointer_oserializer.hpp @@ -0,0 +1,62 @@ +#ifndef BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP +#define BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_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 +// basic_pointer_oserializer.hpp: extenstion of type_info required for +// serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include + +#include // must be the last header + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer; + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer : + public basic_serializer { +protected: + explicit basic_pointer_oserializer( + const boost::serialization::extended_type_info & type_ + ); +public: + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_pointer_oserializer(); + virtual const basic_oserializer & get_basic_serializer() const = 0; + virtual void save_object_ptr( + basic_oarchive & ar, + const void * x + ) const = 0; +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_serializer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_serializer.hpp new file mode 100644 index 0000000000..b6beeea7da --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_serializer.hpp @@ -0,0 +1,70 @@ +#ifndef BOOST_ARCHIVE_BASIC_SERIALIZER_HPP +#define BOOST_ARCHIVE_BASIC_SERIALIZER_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 +// basic_serializer.hpp: extenstion of type_info required for serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL + +#include +#include +#include + +namespace boost { +namespace archive { +namespace detail { + +class basic_serializer : + private boost::noncopyable +{ + const boost::serialization::extended_type_info * m_eti; +protected: + explicit basic_serializer( + const boost::serialization::extended_type_info & eti + ) : + m_eti(& eti) + { + assert(NULL != & eti); + } +public: + inline bool + operator<(const basic_serializer & rhs) const { + // can't compare address since there can be multiple eti records + // for the same type in different execution modules (that is, DLLS) + // leave this here as a reminder not to do this! + // return & lhs.get_eti() < & rhs.get_eti(); + return get_eti() < rhs.get_eti(); + } + const char * get_debug_info() const { + return m_eti->get_debug_info(); + } + const boost::serialization::extended_type_info & get_eti() const { + return * m_eti; + } +}; + +class basic_serializer_arg : public basic_serializer { +public: + basic_serializer_arg(const serialization::extended_type_info & eti) : + basic_serializer(eti) + {} +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_BASIC_SERIALIZER_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_serializer_map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_serializer_map.hpp new file mode 100644 index 0000000000..d17c5c3c8a --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/basic_serializer_map.hpp @@ -0,0 +1,65 @@ +#ifndef BOOST_SERIALIZER_MAP_HPP +#define BOOST_SERIALIZER_MAP_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 +// basic_serializer_map.hpp: extenstion of type_info required for serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} + +namespace archive { +namespace detail { + +class basic_serializer; + +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_serializer_map : public + boost::noncopyable +{ + struct type_info_pointer_compare + { + bool operator()( + const basic_serializer * lhs, const basic_serializer * rhs + ) const ; + }; + typedef std::set map_type; + map_type m_map; +public: + bool insert(const basic_serializer * bs); + void erase(const basic_serializer * bs); + const basic_serializer * find( + const boost::serialization::extended_type_info & type_ + ) const; +private: + // cw 8.3 requires this + basic_serializer_map& operator=(basic_serializer_map const&); +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // must be the last header + +#endif // BOOST_SERIALIZER_MAP_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/check.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/check.hpp new file mode 100644 index 0000000000..5a92e59ce6 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/check.hpp @@ -0,0 +1,169 @@ +#ifndef BOOST_ARCHIVE_DETAIL_CHECK_HPP +#define BOOST_ARCHIVE_DETAIL_CHECK_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#pragma inline_depth(511) +#pragma inline_recursion(on) +#endif + +#if defined(__MWERKS__) +#pragma inline_depth(511) +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// check.hpp: interface for serialization system. + +// (C) Copyright 2009 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace archive { +namespace detail { + +// checks for objects + +template +void inline check_object_level(){ + typedef + BOOST_DEDUCED_TYPENAME mpl::greater_equal< + serialization::implementation_level, + mpl::int_ + >::type typex; + + // trap attempts to serialize objects marked + // not_serializable + BOOST_STATIC_ASSERT(typex::value); +}; + +template +void inline check_object_versioning(){ + typedef + BOOST_DEDUCED_TYPENAME mpl::or_< + BOOST_DEDUCED_TYPENAME mpl::greater< + serialization::implementation_level, + mpl::int_ + >, + BOOST_DEDUCED_TYPENAME mpl::equal_to< + serialization::version, + mpl::int_<0> + > + > typex; + // trap attempts to serialize with objects that don't + // save class information in the archive with versioning. + BOOST_STATIC_ASSERT(typex::value); +}; + +template +void inline check_object_tracking(){ + // presume it has already been determined that + // T is not a const + BOOST_STATIC_ASSERT(! boost::is_const::value); + typedef BOOST_DEDUCED_TYPENAME mpl::equal_to< + serialization::tracking_level, + mpl::int_ + >::type typex; + // saving an non-const object of a type not marked "track_never) + + // may be an indicator of an error usage of the + // serialization library and should be double checked. + // See documentation on object tracking. Also, see the + // "rationale" section of the documenation + // for motivation for this checking. + + BOOST_STATIC_WARNING(typex::value); +}; + +// checks for pointers + +template +void inline check_pointer_level(){ + // we should only invoke this once we KNOW that T + // has been used as a pointer!! + typedef + BOOST_DEDUCED_TYPENAME mpl::or_< + BOOST_DEDUCED_TYPENAME mpl::greater< + serialization::implementation_level, + mpl::int_ + >, + BOOST_DEDUCED_TYPENAME mpl::not_< + BOOST_DEDUCED_TYPENAME mpl::equal_to< + serialization::tracking_level, + mpl::int_ + > + > + > typex; + // Address the following when serializing to a pointer: + + // a) This type doesn't save class information in the + // archive. That is, the serialization trait implementation + // level <= object_serializable. + // b) Tracking for this type is set to "track selectively" + + // in this case, indication that an object is tracked is + // not stored in the archive itself - see level == object_serializable + // but rather the existence of the operation ar >> T * is used to + // infer that an object of this type should be tracked. So, if + // you save via a pointer but don't load via a pointer the operation + // will fail on load without given any valid reason for the failure. + + // So if your program traps here, consider changing the + // tracking or implementation level traits - or not + // serializing via a pointer. + BOOST_STATIC_WARNING(typex::value); +} + +template +void inline check_pointer_tracking(){ + typedef BOOST_DEDUCED_TYPENAME mpl::greater< + serialization::tracking_level, + mpl::int_ + >::type typex; + // serializing an object of a type marked "track_never" through a pointer + // could result in creating more objects than were saved! + BOOST_STATIC_WARNING(typex::value); +}; + +template +void inline check_const_loading(){ + typedef + BOOST_DEDUCED_TYPENAME mpl::or_< + BOOST_DEDUCED_TYPENAME boost::serialization::is_wrapper, + BOOST_DEDUCED_TYPENAME mpl::not_< + BOOST_DEDUCED_TYPENAME boost::is_const + > + >::type typex; + // cannot load data into a "const" object unless it's a + // wrapper around some other non-const object. + BOOST_STATIC_ASSERT(typex::value); +}; + +} // detail +} // archive +} // boost + +#endif // BOOST_ARCHIVE_DETAIL_CHECK_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/common_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/common_iarchive.hpp new file mode 100644 index 0000000000..2713c2f43b --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/common_iarchive.hpp @@ -0,0 +1,86 @@ +#ifndef BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_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 +// common_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include +#include +#include + +namespace boost { +namespace archive { +namespace detail { + +class extended_type_info; + +// note: referred to as Curiously Recurring Template Patter (CRTP) +template +class common_iarchive : + public basic_iarchive, + public interface_iarchive +{ + friend class interface_iarchive; +private: + virtual void vload(version_type & t){ + * this->This() >> t; + } + virtual void vload(object_id_type & t){ + * this->This() >> t; + } + virtual void vload(class_id_type & t){ + * this->This() >> t; + } + virtual void vload(class_id_optional_type & t){ + * this->This() >> t; + } + virtual void vload(tracking_type & t){ + * this->This() >> t; + } + virtual void vload(class_name_type &s){ + * this->This() >> s; + } +protected: + // default processing - invoke serialization library + template + void load_override(T & t, BOOST_PFTO int){ + archive::load(* this->This(), t); + } + // default implementations of functions which emit start/end tags for + // archive types that require them. + void load_start(const char * /*name*/){} + void load_end(const char * /*name*/){} + // default archive initialization + common_iarchive(unsigned int flags = 0) : + basic_iarchive(flags), + interface_iarchive() + {} +public: + virtual const basic_pointer_iserializer * + find(const boost::serialization::extended_type_info & eti) const { + return static_cast( + archive_serializer_map::find(eti) + ); + } +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/common_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/common_oarchive.hpp new file mode 100644 index 0000000000..db072c307d --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/common_oarchive.hpp @@ -0,0 +1,76 @@ +#ifndef BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_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 +// common_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include + +namespace boost { +namespace archive { +namespace detail { + +// note: referred to as Curiously Recurring Template Patter (CRTP) +template +class common_oarchive : + public basic_oarchive, + public interface_oarchive +{ + friend class interface_oarchive; +private: + virtual void vsave(const version_type t){ + * this->This() << t; + } + virtual void vsave(const object_id_type t){ + * this->This() << t; + } + virtual void vsave(const object_reference_type t){ + * this->This() << t; + } + virtual void vsave(const class_id_type t){ + * this->This() << t; + } + virtual void vsave(const class_id_reference_type t){ + * this->This() << t; + } + virtual void vsave(const class_id_optional_type t){ + * this->This() << t; + } + virtual void vsave(const class_name_type & t){ + * this->This() << t; + } + virtual void vsave(const tracking_type t){ + * this->This() << t; + } +protected: + // default processing - invoke serialization library + template + void save_override(T & t, BOOST_PFTO int){ + archive::save(* this->This(), t); + } + void save_start(const char * /*name*/){} + void save_end(const char * /*name*/){} + common_oarchive(unsigned int flags = 0) : + basic_oarchive(flags), + interface_oarchive() + {} +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/decl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/decl.hpp new file mode 100644 index 0000000000..9695001abe --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/decl.hpp @@ -0,0 +1,79 @@ +#ifndef BOOST_ARCHIVE_DETAIL_DECL_HPP +#define BOOST_ARCHIVE_DETAIL_DECL_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 +// decl.hpp +// +// (c) Copyright Robert Ramey 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) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +#include +#include + +#if defined(BOOST_HAS_DECLSPEC) + #if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)) + #if defined(BOOST_ARCHIVE_SOURCE) + #if defined(__BORLANDC__) + #define BOOST_ARCHIVE_DECL(T) T __export + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) T __export + #else + #define BOOST_ARCHIVE_DECL(T) __declspec(dllexport) T + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) __declspec(dllexport) T + #endif + #else + #if defined(__BORLANDC__) + #define BOOST_ARCHIVE_DECL(T) T __import + #else + #define BOOST_ARCHIVE_DECL(T) __declspec(dllimport) T + #endif + #endif + #if defined(BOOST_WARCHIVE_SOURCE) + #if defined(__BORLANDC__) + #define BOOST_WARCHIVE_DECL(T) T __export + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) T __export + #else + #define BOOST_WARCHIVE_DECL(T) __declspec(dllexport) T + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) __declspec(dllexport) T + #endif + #else + #if defined(__BORLANDC__) + #define BOOST_WARCHIVE_DECL(T) T __import + #else + #define BOOST_WARCHIVE_DECL(T) __declspec(dllimport) T + #endif + #endif + #if !defined(BOOST_WARCHIVE_SOURCE) && !defined(BOOST_ARCHIVE_SOURCE) + #if defined(__BORLANDC__) + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) T __import + #else + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) __declspec(dllimport) T + #endif + #endif + #endif +#endif // BOOST_HAS_DECLSPEC + +#if ! defined(BOOST_ARCHIVE_DECL) + #define BOOST_ARCHIVE_DECL(T) T +#endif +#if ! defined(BOOST_WARCHIVE_DECL) + #define BOOST_WARCHIVE_DECL(T) T +#endif +#if ! defined(BOOST_ARCHIVE_OR_WARCHIVE_DECL) + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) T +#endif + +#endif // BOOST_ARCHIVE_DETAIL_DECL_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/interface_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/interface_iarchive.hpp new file mode 100644 index 0000000000..7fd363d059 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/interface_iarchive.hpp @@ -0,0 +1,78 @@ +#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_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 +// interface_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include // NULL +#include +#include +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer; + +template +class interface_iarchive +{ +protected: + interface_iarchive(){}; +public: + ///////////////////////////////////////////////////////// + // archive public interface + typedef mpl::bool_ is_loading; + typedef mpl::bool_ is_saving; + + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + + template + const basic_pointer_iserializer * + register_type(T * = NULL){ + const basic_pointer_iserializer & bpis = + boost::serialization::singleton< + pointer_iserializer + >::get_const_instance(); + this->This()->register_basic_serializer(bpis.get_basic_serializer()); + return & bpis; + } + template + Archive & operator>>(T & t){ + this->This()->load_override(t, 0); + return * this->This(); + } + + // the & operator + template + Archive & operator&(T & t){ + return *(this->This()) >> t; + } +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/interface_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/interface_oarchive.hpp new file mode 100644 index 0000000000..6331e0ea8f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/interface_oarchive.hpp @@ -0,0 +1,85 @@ +#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_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 +// interface_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include // NULL +#include +#include + +#include +#include +#include // must be the last header + +#include + +namespace boost { +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer; + +template +class interface_oarchive +{ +protected: + interface_oarchive(){}; +public: + ///////////////////////////////////////////////////////// + // archive public interface + typedef mpl::bool_ is_loading; + typedef mpl::bool_ is_saving; + + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + + template + const basic_pointer_oserializer * + register_type(const T * = NULL){ + const basic_pointer_oserializer & bpos = + boost::serialization::singleton< + pointer_oserializer + >::get_const_instance(); + this->This()->register_basic_serializer(bpos.get_basic_serializer()); + return & bpos; + } + + template + Archive & operator<<(T & t){ + this->This()->save_override(t, 0); + return * this->This(); + } + + // the & operator + template + Archive & operator&(T & t){ + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + return * this->This() << const_cast(t); + #else + return * this->This() << t; + #endif + } +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/iserializer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/iserializer.hpp new file mode 100644 index 0000000000..f712e6383a --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/iserializer.hpp @@ -0,0 +1,594 @@ +#ifndef BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP +#define BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#pragma inline_depth(511) +#pragma inline_recursion(on) +#endif + +#if defined(__MWERKS__) +#pragma inline_depth(511) +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// iserializer.hpp: interface for serialization system. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // for placement new +#include // for auto_ptr +#include // size_t, NULL + +#include +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include +#endif +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#define DONT_USE_HAS_NEW_OPERATOR ( \ + defined(__BORLANDC__) \ + || defined(__IBMCPP__) \ + || defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) \ + || defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \ +) + +#if ! DONT_USE_HAS_NEW_OPERATOR +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// the following is need only for dynamic cast of polymorphic pointers +#include +#include +#include +#include +#include +#include + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { + +// an accessor to permit friend access to archives. Needed because +// some compilers don't handle friend templates completely +class load_access { +public: + template + static void load_primitive(Archive &ar, T &t){ + ar.load(t); + } +}; + +namespace detail { + +template +class iserializer : public basic_iserializer +{ +private: + virtual void destroy(/*const*/ void *address) const { + boost::serialization::access::destroy(static_cast(address)); + } +protected: + // protected constructor since it's always created by singleton + explicit iserializer() : + basic_iserializer( + boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation::type + >::get_const_instance() + ) + {} +public: + virtual BOOST_DLLEXPORT void load_object_data( + basic_iarchive & ar, + void *x, + const unsigned int file_version + ) const BOOST_USED; + virtual bool class_info() const { + return boost::serialization::implementation_level::value + >= boost::serialization::object_class_info; + } + virtual bool tracking(const unsigned int /* flags */) const { + return boost::serialization::tracking_level::value + == boost::serialization::track_always + || ( boost::serialization::tracking_level::value + == boost::serialization::track_selectively + && serialized_as_pointer()); + } + virtual unsigned int version() const { + return ::boost::serialization::version::value; + } + virtual bool is_polymorphic() const { + return boost::is_polymorphic::value; + } + virtual ~iserializer(){}; +}; + +template +BOOST_DLLEXPORT void iserializer::load_object_data( + basic_iarchive & ar, + void *x, + const unsigned int file_version +) const { + // trap case where the program cannot handle the current version + if(file_version > version()) + boost::serialization::throw_exception( + archive::archive_exception( + boost::archive::archive_exception::unsupported_class_version, + get_debug_info() + ) + ); + + // make sure call is routed through the higest interface that might + // be specialized by the user. + boost::serialization::serialize_adl( + boost::serialization::smart_cast_reference(ar), + * static_cast(x), + file_version + ); +} + +template +class pointer_iserializer : + public basic_pointer_iserializer +{ +private: + virtual const basic_iserializer & get_basic_serializer() const { + return boost::serialization::singleton< + iserializer + >::get_const_instance(); + } + BOOST_DLLEXPORT virtual void load_object_ptr( + basic_iarchive & ar, + void * & x, + const unsigned int file_version + ) const BOOST_USED; +protected: + // this should alway be a singleton so make the constructor protected + pointer_iserializer(); + ~pointer_iserializer(); +}; + +// note trick to be sure that operator new is using class specific +// version if such exists. Due to Peter Dimov. +// note: the following fails if T has no default constructor. +// otherwise it would have been ideal +//struct heap_allocator : public T +//{ +// T * invoke(){ +// return ::new(sizeof(T)); +// } +//} + +template +struct heap_allocator +{ + // boost::has_new_operator doesn't work on these compilers + #if DONT_USE_HAS_NEW_OPERATOR + // This doesn't handle operator new overload for class T + static T * invoke(){ + return static_cast(operator new(sizeof(T))); + } + #else + struct has_new_operator { + static T* invoke() { + return static_cast((T::operator new)(sizeof(T))); + } + }; + struct doesnt_have_new_operator { + static T* invoke() { + return static_cast(operator new(sizeof(T))); + } + }; + static T * invoke() { + typedef BOOST_DEDUCED_TYPENAME + mpl::eval_if< + boost::has_new_operator, + mpl::identity, + mpl::identity + >::type typex; + return typex::invoke(); + } + #endif +}; + +// due to Martin Ecker +template +class auto_ptr_with_deleter +{ +public: + explicit auto_ptr_with_deleter(T* p) : + m_p(p) + {} + ~auto_ptr_with_deleter(){ + if (m_p) + boost::serialization::access::destroy(m_p); + } + T* get() const { + return m_p; + } + + T* release() { + T* p = m_p; + m_p = NULL; + return p; + } +private: + T* m_p; +}; + +// note: BOOST_DLLEXPORT is so that code for polymorphic class +// serialized only through base class won't get optimized out +template +BOOST_DLLEXPORT void pointer_iserializer::load_object_ptr( + basic_iarchive & ar, + void * & x, + const unsigned int file_version +) const +{ + Archive & ar_impl = + boost::serialization::smart_cast_reference(ar); + + auto_ptr_with_deleter ap(heap_allocator::invoke()); + if(NULL == ap.get()) + boost::serialization::throw_exception(std::bad_alloc()) ; + + T * t = ap.get(); + x = t; + + // catch exception during load_construct_data so that we don't + // automatically delete the t which is most likely not fully + // constructed + BOOST_TRY { + // this addresses an obscure situtation that occurs when + // load_constructor de-serializes something through a pointer. + ar.next_object_pointer(t); + boost::serialization::load_construct_data_adl( + ar_impl, + t, + file_version + ); + } + BOOST_CATCH(...){ + ap.release(); + BOOST_RETHROW; + } + BOOST_CATCH_END + + ar_impl >> boost::serialization::make_nvp(NULL, * t); + ap.release(); +} + +template +pointer_iserializer::pointer_iserializer() : + basic_pointer_iserializer( + boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation::type + >::get_const_instance() + ) +{ + boost::serialization::singleton< + iserializer + >::get_mutable_instance().set_bpis(this); + archive_serializer_map::insert(this); +} + +template +pointer_iserializer::~pointer_iserializer(){ + archive_serializer_map::erase(this); +} + +template +struct load_non_pointer_type { + // note this bounces the call right back to the archive + // with no runtime overhead + struct load_primitive { + template + static void invoke(Archive & ar, T & t){ + load_access::load_primitive(ar, t); + } + }; + // note this bounces the call right back to the archive + // with no runtime overhead + struct load_only { + template + static void invoke(Archive & ar, const T & t){ + // short cut to user's serializer + // make sure call is routed through the higest interface that might + // be specialized by the user. + boost::serialization::serialize_adl( + ar, + const_cast(t), + boost::serialization::version::value + ); + } + }; + + // note this save class information including version + // and serialization level to the archive + struct load_standard { + template + static void invoke(Archive &ar, const T & t){ + void * x = & const_cast(t); + ar.load_object( + x, + boost::serialization::singleton< + iserializer + >::get_const_instance() + ); + } + }; + + struct load_conditional { + template + static void invoke(Archive &ar, T &t){ + //if(0 == (ar.get_flags() & no_tracking)) + load_standard::invoke(ar, t); + //else + // load_only::invoke(ar, t); + } + }; + + template + static void invoke(Archive & ar, T &t){ + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + // if its primitive + mpl::equal_to< + boost::serialization::implementation_level, + mpl::int_ + >, + mpl::identity, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + // class info / version + mpl::greater_equal< + boost::serialization::implementation_level, + mpl::int_ + >, + // do standard load + mpl::identity, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + // no tracking + mpl::equal_to< + boost::serialization::tracking_level, + mpl::int_ + >, + // do a fast load + mpl::identity, + // else + // do a fast load only tracking is turned off + mpl::identity + > > >::type typex; + check_object_versioning(); + check_object_level(); + typex::invoke(ar, t); + } +}; + +template +struct load_pointer_type { + struct abstract + { + template + static const basic_pointer_iserializer * register_type(Archive & /* ar */){ + // it has? to be polymorphic + BOOST_STATIC_ASSERT(boost::is_polymorphic::value); + return static_cast(NULL); + } + }; + + struct non_abstract + { + template + static const basic_pointer_iserializer * register_type(Archive & ar){ + return ar.register_type(static_cast(NULL)); + } + }; + + template + static const basic_pointer_iserializer * register_type(Archive &ar, T & /*t*/){ + // there should never be any need to load an abstract polymorphic + // class pointer. Inhibiting code generation for this + // permits abstract base classes to be used - note: exception + // virtual serialize functions used for plug-ins + typedef BOOST_DEDUCED_TYPENAME + mpl::eval_if< + boost::serialization::is_abstract, + boost::mpl::identity, + boost::mpl::identity + >::type typex; + return typex::template register_type(ar); + } + + template + static T * pointer_tweak( + const boost::serialization::extended_type_info & eti, + void * t, + T & + ) { + // tweak the pointer back to the base class + return static_cast( + boost::serialization::void_upcast( + eti, + boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation::type + >::get_const_instance(), + t + ) + ); + } + + template + static void load(Archive &ar, T & t){ + check_pointer_level(); + check_pointer_tracking(); + } + + template + static void invoke(Archive & ar, Tptr & t){ + load(ar, *t); + const basic_pointer_iserializer * bpis_ptr = register_type(ar, *t); + const basic_pointer_iserializer * newbpis_ptr = ar.load_pointer( + * reinterpret_cast(&t), + bpis_ptr + ); + // if the pointer isn't that of the base class + if(newbpis_ptr != bpis_ptr){ + t = pointer_tweak(newbpis_ptr->get_eti(), t, *t); + } + } +}; + +template +struct load_enum_type { + template + static void invoke(Archive &ar, T &t){ + // convert integers to correct enum to load + int i; + ar >> boost::serialization::make_nvp(NULL, i); + t = static_cast(i); + } +}; + +template +struct load_array_type { + template + static void invoke(Archive &ar, T &t){ + typedef BOOST_DEDUCED_TYPENAME remove_extent::type value_type; + + // convert integers to correct enum to load + // determine number of elements in the array. Consider the + // fact that some machines will align elements on boundries + // other than characters. + std::size_t current_count = sizeof(t) / ( + static_cast(static_cast(&t[1])) + - static_cast(static_cast(&t[0])) + ); + boost::serialization::collection_size_type count; + ar >> BOOST_SERIALIZATION_NVP(count); + if(static_cast(count) > current_count) + boost::serialization::throw_exception( + archive::archive_exception( + boost::archive::archive_exception::array_size_too_short + ) + ); + ar >> serialization::make_array(static_cast(&t[0]),count); + } +}; + +} // detail + +template +inline void load(Archive & ar, T &t){ + // if this assertion trips. It means we're trying to load a + // const object with a compiler that doesn't have correct + // funtion template ordering. On other compilers, this is + // handled below. + detail::check_const_loading(); + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if, + mpl::identity > + ,//else + BOOST_DEDUCED_TYPENAME mpl::eval_if, + mpl::identity > + ,//else + BOOST_DEDUCED_TYPENAME mpl::eval_if, + mpl::identity > + ,//else + mpl::identity > + > + > + >::type typex; + typex::invoke(ar, t); +} + +#if 0 + +// BORLAND +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560)) +// borland has a couple of problems +// a) if function is partially specialized - see below +// const paramters are transformed to non-const ones +// b) implementation of base_object can't be made to work +// correctly which results in all base_object s being const. +// So, strip off the const for borland. This breaks the trap +// for loading const objects - but I see no alternative +template +inline void load(Archive &ar, const T & t){ + load(ar, const_cast(t)); +} +#endif + +// let wrappers through. +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline void load_wrapper(Archive &ar, const T&t, mpl::true_){ + boost::archive::load(ar, const_cast(t)); +} + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560)) +template +inline void load(Archive &ar, const T&t){ + load_wrapper(ar,t,serialization::is_wrapper()); +} +#endif +#endif + +#endif + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/oserializer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/oserializer.hpp new file mode 100644 index 0000000000..cc5159e00e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/oserializer.hpp @@ -0,0 +1,513 @@ +#ifndef BOOST_ARCHIVE_OSERIALIZER_HPP +#define BOOST_ARCHIVE_OSERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#pragma inline_depth(511) +#pragma inline_recursion(on) +#endif + +#if defined(__MWERKS__) +#pragma inline_depth(511) +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// oserializer.hpp: interface for serialization system. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL + +#include +#include +#include + +#include +#include +#include +#include + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include +#endif +#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 + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { + +// an accessor to permit friend access to archives. Needed because +// some compilers don't handle friend templates completely +class save_access { +public: + template + static void end_preamble(Archive & ar){ + ar.end_preamble(); + } + template + static void save_primitive(Archive & ar, const T & t){ + ar.end_preamble(); + ar.save(t); + } +}; + +namespace detail { + +template +class oserializer : public basic_oserializer +{ +private: + // private constructor to inhibit any existence other than the + // static one +public: + explicit BOOST_DLLEXPORT oserializer() : + basic_oserializer( + boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation::type + >::get_const_instance() + ) + {} + virtual BOOST_DLLEXPORT void save_object_data( + basic_oarchive & ar, + const void *x + ) const BOOST_USED; + virtual bool class_info() const { + return boost::serialization::implementation_level::value + >= boost::serialization::object_class_info; + } + virtual bool tracking(const unsigned int /* flags */) const { + return boost::serialization::tracking_level::value == boost::serialization::track_always + || (boost::serialization::tracking_level::value == boost::serialization::track_selectively + && serialized_as_pointer()); + } + virtual unsigned int version() const { + return ::boost::serialization::version::value; + } + virtual bool is_polymorphic() const { + return boost::is_polymorphic::value; + } + virtual ~oserializer(){} +}; + +template +BOOST_DLLEXPORT void oserializer::save_object_data( + basic_oarchive & ar, + const void *x +) const { + // make sure call is routed through the highest interface that might + // be specialized by the user. + BOOST_STATIC_ASSERT(boost::is_const::value == false); + boost::serialization::serialize_adl( + boost::serialization::smart_cast_reference(ar), + * static_cast(const_cast(x)), + version() + ); +} + +template +class pointer_oserializer : + public basic_pointer_oserializer +{ +private: + const basic_oserializer & + get_basic_serializer() const { + return boost::serialization::singleton< + oserializer + >::get_const_instance(); + } + virtual BOOST_DLLEXPORT void save_object_ptr( + basic_oarchive & ar, + const void * x + ) const BOOST_USED; +public: + pointer_oserializer(); + ~pointer_oserializer(); +}; + +template +BOOST_DLLEXPORT void pointer_oserializer::save_object_ptr( + basic_oarchive & ar, + const void * x +) const { + assert(NULL != x); + // make sure call is routed through the highest interface that might + // be specialized by the user. + T * t = static_cast(const_cast(x)); + const unsigned int file_version = boost::serialization::version::value; + Archive & ar_impl + = boost::serialization::smart_cast_reference(ar); + boost::serialization::save_construct_data_adl( + ar_impl, + t, + file_version + ); + ar_impl << boost::serialization::make_nvp(NULL, * t); +} + +template +pointer_oserializer::pointer_oserializer() : + basic_pointer_oserializer( + boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation::type + >::get_const_instance() + ) +{ + // make sure appropriate member function is instantiated + boost::serialization::singleton< + oserializer + >::get_mutable_instance().set_bpos(this); + archive_serializer_map::insert(this); +} + +template +pointer_oserializer::~pointer_oserializer(){ + archive_serializer_map::erase(this); +} + +template +struct save_non_pointer_type { + // note this bounces the call right back to the archive + // with no runtime overhead + struct save_primitive { + template + static void invoke(Archive & ar, const T & t){ + save_access::save_primitive(ar, t); + } + }; + // same as above but passes through serialization + struct save_only { + template + static void invoke(Archive & ar, const T & t){ + // make sure call is routed through the highest interface that might + // be specialized by the user. + boost::serialization::serialize_adl( + ar, + const_cast(t), + ::boost::serialization::version::value + ); + } + }; + // adds class information to the archive. This includes + // serialization level and class version + struct save_standard { + template + static void invoke(Archive &ar, const T & t){ + ar.save_object( + & t, + boost::serialization::singleton< + oserializer + >::get_const_instance() + ); + } + }; + + // adds class information to the archive. This includes + // serialization level and class version + struct save_conditional { + template + static void invoke(Archive &ar, const T &t){ + //if(0 == (ar.get_flags() & no_tracking)) + save_standard::invoke(ar, t); + //else + // save_only::invoke(ar, t); + } + }; + + + template + static void invoke(Archive & ar, const T & t){ + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + // if its primitive + mpl::equal_to< + boost::serialization::implementation_level, + mpl::int_ + >, + mpl::identity, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + // class info / version + mpl::greater_equal< + boost::serialization::implementation_level, + mpl::int_ + >, + // do standard save + mpl::identity, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + // no tracking + mpl::equal_to< + boost::serialization::tracking_level, + mpl::int_ + >, + // do a fast save + mpl::identity, + // else + // do a fast save only tracking is turned off + mpl::identity + > > >::type typex; + check_object_versioning(); + typex::invoke(ar, t); + }; + template + static void invoke(Archive & ar, T & t){ + check_object_level(); + check_object_tracking(); + invoke(ar, const_cast(t)); + }; +}; + +template +struct save_pointer_type { + struct abstract + { + template + static const basic_pointer_oserializer * register_type(Archive & /* ar */){ + // it has? to be polymorphic + BOOST_STATIC_ASSERT(boost::is_polymorphic::value); + return NULL; + } + }; + + struct non_abstract + { + template + static const basic_pointer_oserializer * register_type(Archive & ar){ + return ar.register_type(static_cast(NULL)); + } + }; + + template + static const basic_pointer_oserializer * register_type(Archive &ar, T & /*t*/){ + // there should never be any need to save an abstract polymorphic + // class pointer. Inhibiting code generation for this + // permits abstract base classes to be used - note: exception + // virtual serialize functions used for plug-ins + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + boost::serialization::is_abstract, + mpl::identity, + mpl::identity + >::type typex; + return typex::template register_type(ar); + } + + struct non_polymorphic + { + template + static void save( + Archive &ar, + T & t + ){ + const basic_pointer_oserializer & bpos = + boost::serialization::singleton< + pointer_oserializer + >::get_const_instance(); + // save the requested pointer type + ar.save_pointer(& t, & bpos); + } + }; + + struct polymorphic + { + template + static void save( + Archive &ar, + T & t + ){ + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation::type const + & i = boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation::type + >::get_const_instance(); + + boost::serialization::extended_type_info const * const this_type = & i; + + // retrieve the true type of the object pointed to + // if this assertion fails its an error in this library + assert(NULL != this_type); + + const boost::serialization::extended_type_info * true_type = + i.get_derived_extended_type_info(t); + + // note:if this exception is thrown, be sure that derived pointer + // is either registered or exported. + if(NULL == true_type){ + boost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_class, + true_type->get_debug_info() + ) + ); + } + + // if its not a pointer to a more derived type + const void *vp = static_cast(&t); + if(*this_type == *true_type){ + const basic_pointer_oserializer * bpos = register_type(ar, t); + ar.save_pointer(vp, bpos); + return; + } + // convert pointer to more derived type. if this is thrown + // it means that the base/derived relationship hasn't be registered + vp = serialization::void_downcast( + *true_type, + *this_type, + static_cast(&t) + ); + if(NULL == vp){ + boost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_cast, + true_type->get_debug_info(), + this_type->get_debug_info() + ) + ); + } + + // since true_type is valid, and this only gets made if the + // pointer oserializer object has been created, this should never + // fail + const basic_pointer_oserializer * bpos + = static_cast( + boost::serialization::singleton< + archive_serializer_map + >::get_const_instance().find(*true_type) + ); + assert(NULL != bpos); + if(NULL == bpos) + boost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_class, + bpos->get_debug_info() + ) + ); + ar.save_pointer(vp, bpos); + } + }; + + template + static void save( + Archive & ar, + const T & t + ){ + check_pointer_level(); + check_pointer_tracking(); + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_polymorphic, + mpl::identity, + mpl::identity + >::type type; + type::save(ar, const_cast(t)); + } + + template + static void invoke(Archive &ar, const TPtr t){ + register_type(ar, * t); + if(NULL == t){ + basic_oarchive & boa + = boost::serialization::smart_cast_reference(ar); + boa.save_null_pointer(); + save_access::end_preamble(ar); + return; + } + save(ar, * t); + }; +}; + +template +struct save_enum_type +{ + template + static void invoke(Archive &ar, const T &t){ + // convert enum to integers on save + const int i = static_cast(t); + ar << boost::serialization::make_nvp(NULL, i); + } +}; + +template +struct save_array_type +{ + template + static void invoke(Archive &ar, const T &t){ + typedef BOOST_DEDUCED_TYPENAME boost::remove_extent::type value_type; + + save_access::end_preamble(ar); + // consider alignment + std::size_t c = sizeof(t) / ( + static_cast(static_cast(&t[1])) + - static_cast(static_cast(&t[0])) + ); + boost::serialization::collection_size_type count(c); + ar << BOOST_SERIALIZATION_NVP(count); + ar << serialization::make_array(static_cast(&t[0]),count); + } +}; + +} // detail + +template +inline void save(Archive & ar, /*const*/ T &t){ + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if, + mpl::identity >, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if, + mpl::identity >, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if, + mpl::identity >, + //else + mpl::identity > + > + > + >::type typex; + typex::invoke(ar, t); +} + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_OSERIALIZER_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/polymorphic_iarchive_route.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/polymorphic_iarchive_route.hpp new file mode 100644 index 0000000000..e8f624046a --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/polymorphic_iarchive_route.hpp @@ -0,0 +1,193 @@ +#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_ROUTE_HPP +#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_ROUTE_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 +// polymorphic_iarchive_route.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail{ + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iserializer; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer; + +template +class polymorphic_iarchive_route : + public polymorphic_iarchive, + // note: gcc dynamic cross cast fails if the the derivation below is + // not public. I think this is a mistake. + public /*protected*/ ArchiveImplementation, + private boost::noncopyable +{ +private: + // these are used by the serialization library. + virtual void load_object( + void *t, + const basic_iserializer & bis + ){ + ArchiveImplementation::load_object(t, bis); + } + virtual const basic_pointer_iserializer * load_pointer( + void * & t, + const basic_pointer_iserializer * bpis_ptr + ){ + return ArchiveImplementation::load_pointer(t, bpis_ptr); + } + virtual void set_library_version(unsigned int archive_library_version){ + ArchiveImplementation::set_library_version(archive_library_version); + } + virtual unsigned int get_library_version() const{ + return ArchiveImplementation::get_library_version(); + } + virtual unsigned int get_flags() const { + return ArchiveImplementation::get_flags(); + } + virtual void delete_created_pointers(){ + ArchiveImplementation::delete_created_pointers(); + } + virtual void reset_object_address( + const void * new_address, + const void * old_address + ){ + ArchiveImplementation::reset_object_address(new_address, old_address); + } + virtual void load_binary(void * t, std::size_t size){ + ArchiveImplementation::load_binary(t, size); + } + // primitive types the only ones permitted by polymorphic archives + virtual void load(bool & t){ + ArchiveImplementation::load(t); + } + virtual void load(char & t){ + ArchiveImplementation::load(t); + } + virtual void load(signed char & t){ + ArchiveImplementation::load(t); + } + virtual void load(unsigned char & t){ + ArchiveImplementation::load(t); + } + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + virtual void load(wchar_t & t){ + ArchiveImplementation::load(t); + } + #endif + #endif + virtual void load(short & t){ + ArchiveImplementation::load(t); + } + virtual void load(unsigned short & t){ + ArchiveImplementation::load(t); + } + virtual void load(int & t){ + ArchiveImplementation::load(t); + } + virtual void load(unsigned int & t){ + ArchiveImplementation::load(t); + } + virtual void load(long & t){ + ArchiveImplementation::load(t); + } + virtual void load(unsigned long & t){ + ArchiveImplementation::load(t); + } + #if !defined(BOOST_NO_INTRINSIC_INT64_T) + virtual void load(boost::int64_t & t){ + ArchiveImplementation::load(t); + } + virtual void load(boost::uint64_t & t){ + ArchiveImplementation::load(t); + } + #endif + virtual void load(float & t){ + ArchiveImplementation::load(t); + } + virtual void load(double & t){ + ArchiveImplementation::load(t); + } + virtual void load(std::string & t){ + ArchiveImplementation::load(t); + } + #ifndef BOOST_NO_STD_WSTRING + virtual void load(std::wstring & t){ + ArchiveImplementation::load(t); + } + #endif + // used for xml and other tagged formats default does nothing + virtual void load_start(const char * name){ + ArchiveImplementation::load_start(name); + } + virtual void load_end(const char * name){ + ArchiveImplementation::load_end(name); + } + + virtual void register_basic_serializer(const basic_iserializer & bis){ + ArchiveImplementation::register_basic_serializer(bis); + } +public: + // this can't be inheriteded because they appear in mulitple + // parents + typedef mpl::bool_ is_loading; + typedef mpl::bool_ is_saving; + // the >> operator + template + polymorphic_iarchive & operator>>(T & t){ + return polymorphic_iarchive::operator>>(t); + } + + // the & operator + template + polymorphic_iarchive & operator&(T & t){ + return polymorphic_iarchive::operator&(t); + } + + // all current archives take a stream as constructor argument + template + polymorphic_iarchive_route( + std::basic_istream<_Elem, _Tr> & is, + unsigned int flags = 0 + ) : + ArchiveImplementation(is, flags) + {} + virtual ~polymorphic_iarchive_route(){}; +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_DISPATCH_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/polymorphic_oarchive_route.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/polymorphic_oarchive_route.hpp new file mode 100644 index 0000000000..e043bb59ff --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/polymorphic_oarchive_route.hpp @@ -0,0 +1,184 @@ +#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP +#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_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 +// polymorphic_oarchive_route.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include +#include +#include // size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail{ + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer; + +template +class polymorphic_oarchive_route : + public polymorphic_oarchive, + // note: gcc dynamic cross cast fails if the the derivation below is + // not public. I think this is a mistake. + public /*protected*/ ArchiveImplementation, + private boost::noncopyable +{ +private: + // these are used by the serialization library. + virtual void save_object( + const void *x, + const detail::basic_oserializer & bos + ){ + ArchiveImplementation::save_object(x, bos); + } + virtual void save_pointer( + const void * t, + const detail::basic_pointer_oserializer * bpos_ptr + ){ + ArchiveImplementation::save_pointer(t, bpos_ptr); + } + virtual void save_null_pointer(){ + ArchiveImplementation::save_null_pointer(); + } + // primitive types the only ones permitted by polymorphic archives + virtual void save(const bool t){ + ArchiveImplementation::save(t); + } + virtual void save(const char t){ + ArchiveImplementation::save(t); + } + virtual void save(const signed char t){ + ArchiveImplementation::save(t); + } + virtual void save(const unsigned char t){ + ArchiveImplementation::save(t); + } + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + virtual void save(const wchar_t t){ + ArchiveImplementation::save(t); + } + #endif + #endif + virtual void save(const short t){ + ArchiveImplementation::save(t); + } + virtual void save(const unsigned short t){ + ArchiveImplementation::save(t); + } + virtual void save(const int t){ + ArchiveImplementation::save(t); + } + virtual void save(const unsigned int t){ + ArchiveImplementation::save(t); + } + virtual void save(const long t){ + ArchiveImplementation::save(t); + } + virtual void save(const unsigned long t){ + ArchiveImplementation::save(t); + } + #if !defined(BOOST_NO_INTRINSIC_INT64_T) + virtual void save(const boost::int64_t t){ + ArchiveImplementation::save(t); + } + virtual void save(const boost::uint64_t t){ + ArchiveImplementation::save(t); + } + #endif + virtual void save(const float t){ + ArchiveImplementation::save(t); + } + virtual void save(const double t){ + ArchiveImplementation::save(t); + } + virtual void save(const std::string & t){ + ArchiveImplementation::save(t); + } + #ifndef BOOST_NO_STD_WSTRING + virtual void save(const std::wstring & t){ + ArchiveImplementation::save(t); + } + #endif + virtual unsigned int get_library_version() const{ + return ArchiveImplementation::get_library_version(); + } + virtual unsigned int get_flags() const { + return ArchiveImplementation::get_flags(); + } + virtual void save_binary(const void * t, std::size_t size){ + ArchiveImplementation::save_binary(t, size); + } + // used for xml and other tagged formats default does nothing + virtual void save_start(const char * name){ + ArchiveImplementation::save_start(name); + } + virtual void save_end(const char * name){ + ArchiveImplementation::save_end(name); + } + virtual void end_preamble(){ + ArchiveImplementation::end_preamble(); + } + virtual void register_basic_serializer(const detail::basic_oserializer & bos){ + ArchiveImplementation::register_basic_serializer(bos); + } +public: + // this can't be inheriteded because they appear in mulitple + // parents + typedef mpl::bool_ is_loading; + typedef mpl::bool_ is_saving; + // the << operator + template + polymorphic_oarchive & operator<<(T & t){ + return polymorphic_oarchive::operator<<(t); + } + // the & operator + template + polymorphic_oarchive & operator&(T & t){ + return polymorphic_oarchive::operator&(t); + } + // all current archives take a stream as constructor argument + template + polymorphic_oarchive_route( + std::basic_ostream<_Elem, _Tr> & os, + unsigned int flags = 0 + ) : + ArchiveImplementation(os, flags) + {} + virtual ~polymorphic_oarchive_route(){}; +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_DISPATCH_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/register_archive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/register_archive.hpp new file mode 100644 index 0000000000..87fedcbe86 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/register_archive.hpp @@ -0,0 +1,91 @@ +// 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_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP +# define BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP + +namespace boost { namespace archive { namespace detail { + +// No instantiate_ptr_serialization overloads generated by +// BOOST_SERIALIZATION_REGISTER_ARCHIVE that lexically follow the call +// will be seen *unless* they are in an associated namespace of one of +// the arguments, so we pass one of these along to make sure this +// namespace is considered. See temp.dep.candidate (14.6.4.2) in the +// standard. +struct adl_tag {}; + +template +struct ptr_serialization_support; + +// We could've just used ptr_serialization_support, above, but using +// it with only a forward declaration causes vc6/7 to complain about a +// missing instantiate member, even if it has one. This is just a +// friendly layer of indirection. +template +struct _ptr_serialization_support + : ptr_serialization_support +{ + typedef int type; +}; + +#ifdef __SUNPRO_CC + +template +struct counter : counter {}; +template<> +struct counter<0> {}; + +template +void instantiate_ptr_serialization(Serializable* s, int, adl_tag) { + instantiate_ptr_serialization(s, counter<20>()); +} + +template +struct get_counter { + static const int value = sizeof(adjust_counter(counter<20>())); + typedef counter type; + typedef counter prior; + typedef char (&next)[value+1]; +}; + +char adjust_counter(counter<0>); +template +void instantiate_ptr_serialization(Serializable*, counter<0>) {} + +#define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \ +namespace boost { namespace archive { namespace detail { \ + get_counter::next adjust_counter(get_counter::type);\ + template \ + void instantiate_ptr_serialization(Serializable* s, \ + get_counter::type) { \ + ptr_serialization_support x; \ + instantiate_ptr_serialization(s, get_counter::prior()); \ + }\ +}}} + + +#else + +// This function gets called, but its only purpose is to participate +// in overload resolution with the functions declared by +// BOOST_SERIALIZATION_REGISTER_ARCHIVE, below. +template +void instantiate_ptr_serialization(Serializable*, int, adl_tag ) {} + +// The function declaration generated by this macro never actually +// gets called, but its return type gets instantiated, and that's +// enough to cause registration of serialization functions between +// Archive and any exported Serializable type. See also: +// boost/serialization/export.hpp +# define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \ +namespace boost { namespace archive { namespace detail { \ + \ +template \ +BOOST_DEDUCED_TYPENAME _ptr_serialization_support::type \ +instantiate_ptr_serialization( Serializable*, Archive*, adl_tag ); \ + \ +}}} +#endif +}}} // namespace boost::archive::detail + +#endif // BOOST_ARCHIVE_DETAIL_INSTANTIATE_SERIALIZE_DWA2006521_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/utf8_codecvt_facet.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/utf8_codecvt_facet.hpp new file mode 100644 index 0000000000..bd859ffebd --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/detail/utf8_codecvt_facet.hpp @@ -0,0 +1,21 @@ +// 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 +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP +#define BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP + +#define BOOST_UTF8_BEGIN_NAMESPACE \ + namespace boost { namespace archive { namespace detail { +#define BOOST_UTF8_DECL +#define BOOST_UTF8_END_NAMESPACE }}} + +#include + +#undef BOOST_UTF8_END_NAMESPACE +#undef BOOST_UTF8_DECL +#undef BOOST_UTF8_BEGIN_NAMESPACE + +#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/dinkumware.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/dinkumware.hpp new file mode 100644 index 0000000000..bfa828d53d --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/dinkumware.hpp @@ -0,0 +1,224 @@ +#ifndef BOOST_ARCHIVE_DINKUMWARE_HPP +#define BOOST_ARCHIVE_DINKUMWARE_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 +// dinkumware.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// this file adds a couple of things that are missing from the dinkumware +// implementation of the standard library. + +#include +#include + +#include +#include + +namespace std { + +// define i/o operators for 64 bit integers +template +basic_ostream & +operator<<(basic_ostream & os, boost::uint64_t t){ + // octal rendering of 64 bit number would be 22 octets + eos + CharType d[23]; + unsigned int radix; + + if(os.flags() & (int)std::ios_base::hex) + radix = 16; + else + if(os.flags() & (int)std::ios_base::oct) + radix = 8; + else + //if(s.flags() & (int)std::ios_base::dec) + radix = 10; + unsigned int i = 0; + do{ + unsigned int j = t % radix; + d[i++] = j + ((j < 10) ? '0' : ('a' - 10)); + t /= radix; + } + while(t > 0); + d[i--] = '\0'; + + // reverse digits + unsigned int j = 0; + while(j < i){ + CharType k = d[i]; + d[i] = d[j]; + d[j] = k; + --i;++j; + } + os << d; + return os; + +} + +template +basic_ostream & +operator<<(basic_ostream &os, boost::int64_t t){ + if(0 <= t){ + os << static_cast(t); + } + else{ + os.put('-'); + os << -t; + } + return os; +} + +template +basic_istream & +operator>>(basic_istream &is, boost::int64_t & t){ + CharType d; + do{ + d = is.get(); + } + while(::isspace(d)); + bool negative = (d == '-'); + if(negative) + d = is.get(); + unsigned int radix; + if(is.flags() & (int)std::ios_base::hex) + radix = 16; + else + if(is.flags() & (int)std::ios_base::oct) + radix = 8; + else + //if(s.flags() & (int)std::ios_base::dec) + radix = 10; + t = 0; + do{ + if('0' <= d && d <= '9') + t = t * radix + (d - '0'); + else + if('a' <= d && d <= 'f') + t = t * radix + (d - 'a' + 10); + else + break; + d = is.get(); + } + while(!is.fail()); + // restore the delimiter + is.putback(d); + is.clear(); + if(negative) + t = -t; + return is; +} + +template +basic_istream & +operator>>(basic_istream &is, boost::uint64_t & t){ + boost::int64_t it; + is >> it; + t = it; + return is; +} + +//#endif + +template<> +class back_insert_iterator > : public + iterator +{ +public: + typedef basic_string container_type; + typedef container_type::reference reference; + + explicit back_insert_iterator(container_type & s) + : container(& s) + {} // construct with container + + back_insert_iterator & operator=( + container_type::const_reference Val_ + ){ // push value into container + //container->push_back(Val_); + *container += Val_; + return (*this); + } + + back_insert_iterator & operator*(){ + return (*this); + } + + back_insert_iterator & operator++(){ + // pretend to preincrement + return (*this); + } + + back_insert_iterator operator++(int){ + // pretend to postincrement + return (*this); + } + +protected: + container_type *container; // pointer to container +}; + +template +inline back_insert_iterator > back_inserter( + basic_string & s +){ + return (std::back_insert_iterator >(s)); +} + +template<> +class back_insert_iterator > : public + iterator +{ +public: + typedef basic_string container_type; + typedef container_type::reference reference; + + explicit back_insert_iterator(container_type & s) + : container(& s) + {} // construct with container + + back_insert_iterator & operator=( + container_type::const_reference Val_ + ){ // push value into container + //container->push_back(Val_); + *container += Val_; + return (*this); + } + + back_insert_iterator & operator*(){ + return (*this); + } + + back_insert_iterator & operator++(){ + // pretend to preincrement + return (*this); + } + + back_insert_iterator operator++(int){ + // pretend to postincrement + return (*this); + } + +protected: + container_type *container; // pointer to container +}; + +template +inline back_insert_iterator > back_inserter( + basic_string & s +){ + return (std::back_insert_iterator >(s)); +} + +} // namespace std + +#endif //BOOST_ARCHIVE_DINKUMWARE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/archive_serializer_map.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/archive_serializer_map.ipp new file mode 100644 index 0000000000..ec580b541f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/archive_serializer_map.ipp @@ -0,0 +1,62 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// archive_serializer_map.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +////////////////////////////////////////////////////////////////////// +// implementation of basic_text_iprimitive overrides for the combination +// of template parameters used to implement a text_iprimitive + +#include +#include +#include +#include + +namespace boost { +namespace archive { +namespace detail { + +namespace { // anon + template + class map : public basic_serializer_map + {}; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(bool) +archive_serializer_map::insert(const basic_serializer * bs){ + return boost::serialization::singleton< + map + >::get_mutable_instance().insert(bs); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +archive_serializer_map::erase(const basic_serializer * bs){ + if(boost::serialization::singleton< + map + >::is_destroyed()) + return; + boost::serialization::singleton< + map + >::get_mutable_instance().erase(bs); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(const basic_serializer *) +archive_serializer_map::find( + const boost::serialization::extended_type_info & eti +) { + return boost::serialization::singleton< + map + >::get_const_instance().find(eti); +} + +} // namespace detail +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_iarchive.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_iarchive.ipp new file mode 100644 index 0000000000..230fb92897 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_iarchive.ipp @@ -0,0 +1,79 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_iarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include +#include + +#include // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include + +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of binary_binary_archive +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iarchive::load_override(class_name_type & t, int){ + std::string cn; + cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE); + load_override(cn, 0); + if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1)) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + std::memcpy(t, cn.data(), cn.size()); + // borland tweak + t.t[cn.size()] = '\0'; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iarchive::init(){ + // read signature in an archive version independent manner + std::string file_signature; + * this->This() >> file_signature; + if(file_signature != BOOST_ARCHIVE_SIGNATURE()) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_signature) + ); + + // make sure the version of the reading archive library can + // support the format of the archive being read + version_type input_library_version; + * this->This() >> input_library_version; + + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->set_library_version(input_library_version); + #else + #if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + detail:: + #endif + basic_iarchive::set_library_version(input_library_version); + #endif + + // extra little .t is to get around borland quirk + if(BOOST_ARCHIVE_VERSION() < input_library_version.t) + boost::serialization::throw_exception( + archive_exception(archive_exception::unsupported_version) + ); +} + +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_iprimitive.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_iprimitive.ipp new file mode 100644 index 0000000000..f609571326 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_iprimitive.ipp @@ -0,0 +1,209 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_iprimitive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // size_t, NULL +#include // memcpy + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + using ::memcpy; +} // namespace std +#endif + +#include // fixup for RogueWave + +#include +#include + +#include +#include +#include + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_binary_iprimitive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive::init() +{ + // Detect attempts to pass native binary archives across + // incompatible platforms. This is not fool proof but its + // better than nothing. + unsigned char size; + this->This()->load(size); + if(sizeof(int) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of int" + ) + ); + this->This()->load(size); + if(sizeof(long) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of long" + ) + ); + this->This()->load(size); + if(sizeof(float) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of float" + ) + ); + this->This()->load(size); + if(sizeof(double) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of double" + ) + ); + + // for checking endian + int i; + this->This()->load(i); + if(1 != i) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "endian setting" + ) + ); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive::load(wchar_t * ws) +{ + std::size_t l; // number of wchar_t !!! + this->This()->load(l); + load_binary(ws, l * sizeof(wchar_t) / sizeof(char)); + ws[l] = L'\0'; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive::load(std::string & s) +{ + std::size_t l; + this->This()->load(l); + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(l); + // note breaking a rule here - could be a problem on some platform + if(0 < l) + load_binary(&(*s.begin()), l); +} + +#ifndef BOOST_NO_CWCHAR +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive::load(char * s) +{ + std::size_t l; + this->This()->load(l); + load_binary(s, l); + s[l] = '\0'; +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive::load(std::wstring & ws) +{ + std::size_t l; + this->This()->load(l); + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(l); + // note breaking a rule here - is could be a problem on some platform + load_binary(const_cast(ws.data()), l * sizeof(wchar_t) / sizeof(char)); +} +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_iprimitive::basic_binary_iprimitive( + std::basic_streambuf & sb, + bool no_codecvt +) : +#ifndef BOOST_NO_STD_LOCALE + m_sb(sb), + archive_locale(NULL), + locale_saver(m_sb) +{ + if(! no_codecvt){ + archive_locale.reset( + boost::archive::add_facet( + std::locale::classic(), + new codecvt_null + ) + ); + m_sb.pubimbue(* archive_locale); + } +} +#else + m_sb(sb) +{} +#endif + +// some libraries including stl and libcomo fail if the +// buffer isn't flushed before the code_cvt facet is changed. +// I think this is a bug. We explicity invoke sync to when +// we're done with the streambuf to work around this problem. +// Note that sync is a protected member of stream buff so we +// have to invoke it through a contrived derived class. +namespace detail { +// note: use "using" to get past msvc bug +using namespace std; +template +class input_streambuf_access : public std::basic_streambuf { + public: + virtual int sync(){ +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) + return this->basic_streambuf::sync(); +#else + return this->basic_streambuf::sync(); +#endif + } +}; +} // detail + +// scoped_ptr requires that archive_locale be a complete type at time of +// destruction so define destructor here rather than in the header +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_iprimitive::~basic_binary_iprimitive(){ + // push back unread characters + //destructor can't throw ! + try{ + static_cast &>(m_sb).sync(); + } + catch(...){ + } +} + +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_oarchive.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_oarchive.ipp new file mode 100644 index 0000000000..4a8301ea45 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_oarchive.ipp @@ -0,0 +1,46 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_oarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include +#include + +#include // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of binary_binary_oarchive + +template +#if !defined(__BORLANDC__) +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +#else +void +#endif +basic_binary_oarchive::init(){ + // write signature in an archive version independent manner + const std::string file_signature(BOOST_ARCHIVE_SIGNATURE()); + * this->This() << file_signature; + // write library version + const version_type v(BOOST_ARCHIVE_VERSION()); + * this->This() << v; +} + +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_oprimitive.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_oprimitive.ipp new file mode 100644 index 0000000000..1b25c227f9 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_binary_oprimitive.ipp @@ -0,0 +1,164 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_oprimitive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL +#include + +#include + +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; +} // namespace std +#endif + + +#ifndef BOOST_NO_CWCHAR +#include +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif +#endif + +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_binary_oprimitive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive::init() +{ + // record native sizes of fundamental types + // this is to permit detection of attempts to pass + // native binary archives accross incompatible machines. + // This is not foolproof but its better than nothing. + this->This()->save(static_cast(sizeof(int))); + this->This()->save(static_cast(sizeof(long))); + this->This()->save(static_cast(sizeof(float))); + this->This()->save(static_cast(sizeof(double))); + // for checking endianness + this->This()->save(int(1)); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive::save(const char * s) +{ + std::size_t l = std::strlen(s); + this->This()->save(l); + save_binary(s, l); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive::save(const std::string &s) +{ + std::size_t l = static_cast(s.size()); + this->This()->save(l); + save_binary(s.data(), l); +} + +#ifndef BOOST_NO_CWCHAR +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive::save(const wchar_t * ws) +{ + std::size_t l = std::wcslen(ws); + this->This()->save(l); + save_binary(ws, l * sizeof(wchar_t) / sizeof(char)); +} + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive::save(const std::wstring &ws) +{ + std::size_t l = ws.size(); + this->This()->save(l); + save_binary(ws.data(), l * sizeof(wchar_t) / sizeof(char)); +} +#endif +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_oprimitive::basic_binary_oprimitive( + std::basic_streambuf & sb, + bool no_codecvt +) : +#ifndef BOOST_NO_STD_LOCALE + m_sb(sb), + archive_locale(NULL), + locale_saver(m_sb) +{ + if(! no_codecvt){ + archive_locale.reset( + add_facet( + std::locale::classic(), + new codecvt_null + ) + ); + m_sb.pubimbue(* archive_locale); + } +} +#else + m_sb(sb) +{} +#endif + +// some libraries including stl and libcomo fail if the +// buffer isn't flushed before the code_cvt facet is changed. +// I think this is a bug. We explicity invoke sync to when +// we're done with the streambuf to work around this problem. +// Note that sync is a protected member of stream buff so we +// have to invoke it through a contrived derived class. +namespace detail { +// note: use "using" to get past msvc bug +using namespace std; +template +class output_streambuf_access : public std::basic_streambuf { + public: + virtual int sync(){ +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) + return this->basic_streambuf::sync(); +#else + return this->basic_streambuf::sync(); +#endif + } +}; +} // detail + +// scoped_ptr requires that g be a complete type at time of +// destruction so define destructor here rather than in the header +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_oprimitive::~basic_binary_oprimitive(){ + // flush buffer + //destructor can't throw + try{ + static_cast &>(m_sb).sync(); + } + catch(...){ + } +} + +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_iarchive.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_iarchive.ipp new file mode 100644 index 0000000000..6d9b8c74f5 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_iarchive.ipp @@ -0,0 +1,78 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_iarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include + +#include // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include + +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of text_text_archive +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_iarchive::load_override(class_name_type & t, int){ + std::string cn; + cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE); + load_override(cn, 0); + if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1)) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + std::memcpy(t, cn.data(), cn.size()); + // borland tweak + t.t[cn.size()] = '\0'; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_iarchive::init(void){ + // read signature in an archive version independent manner + std::string file_signature; + * this->This() >> file_signature; + if(file_signature != BOOST_ARCHIVE_SIGNATURE()) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_signature) + ); + + // make sure the version of the reading archive library can + // support the format of the archive being read + version_type input_library_version; + * this->This() >> input_library_version; + + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->set_library_version(input_library_version); + #else + #if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + detail:: + #endif + basic_iarchive::set_library_version(input_library_version.t); + #endif + + // extra little .t is to get around borland quirk + if(BOOST_ARCHIVE_VERSION() < input_library_version.t) + boost::serialization::throw_exception( + archive_exception(archive_exception::unsupported_version) + ); +} + +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_iprimitive.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_iprimitive.ipp new file mode 100644 index 0000000000..c64502dc78 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_iprimitive.ipp @@ -0,0 +1,154 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_iprimitive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // size_t +#include // NULL + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +namespace { + template + bool is_whitespace(CharType c); + + template<> + bool is_whitespace(char t){ + return std::isspace(t); + } + + #ifndef BOOST_NO_CWCHAR + template<> + bool is_whitespace(wchar_t t){ + return std::iswspace(t); + } + #endif +} + +// translate base64 text into binary and copy into buffer +// until buffer is full. +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_iprimitive::load_binary( + void *address, + std::size_t count +){ + typedef BOOST_DEDUCED_TYPENAME IStream::char_type CharType; + + if(0 == count) + return; + + assert( + static_cast((std::numeric_limits::max)()) + > (count + sizeof(CharType) - 1)/sizeof(CharType) + ); + + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + // convert from base64 to binary + typedef BOOST_DEDUCED_TYPENAME + iterators::transform_width< + iterators::binary_from_base64< + iterators::remove_whitespace< + iterators::istream_iterator + > + ,CharType + > + ,8 + ,6 + ,CharType + > + binary; + + binary ti_begin = binary( + BOOST_MAKE_PFTO_WRAPPER( + iterators::istream_iterator(is) + ) + ); + + char * caddr = static_cast(address); + + // take care that we don't increment anymore than necessary + while(--count > 0){ + *caddr++ = static_cast(*ti_begin); + ++ti_begin; + } + *caddr++ = static_cast(*ti_begin); + + iterators::istream_iterator i; + for(;;){ + CharType c; + c = is.get(); + if(is.eof()) + break; + if(is_whitespace(c)) + break; + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_iprimitive::basic_text_iprimitive( + IStream &is_, + bool no_codecvt +) : +#ifndef BOOST_NO_STD_LOCALE + is(is_), + flags_saver(is_), + precision_saver(is_), + archive_locale(NULL), + locale_saver(is_) +{ + if(! no_codecvt){ + archive_locale.reset( + add_facet( + std::locale::classic(), + new codecvt_null + ) + ); + is.imbue(* archive_locale); + } + is >> std::noboolalpha; +} +#else + is(is_), + flags_saver(is_), + precision_saver(is_) +{} +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_iprimitive::~basic_text_iprimitive(){ + is.sync(); +} + +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_oarchive.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_oarchive.ipp new file mode 100644 index 0000000000..3b7c7b0326 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_oarchive.ipp @@ -0,0 +1,62 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_oarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include + +#include // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of basic_text_oarchive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_oarchive::newtoken() +{ + switch(delimiter){ + default: + assert(false); + break; + case eol: + this->This()->put('\n'); + delimiter = space; + break; + case space: + this->This()->put(' '); + break; + case none: + delimiter = space; + break; + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_oarchive::init(){ + // write signature in an archive version independent manner + const std::string file_signature(BOOST_ARCHIVE_SIGNATURE()); + * this->This() << file_signature; + // write library version + const version_type v(BOOST_ARCHIVE_VERSION()); + * this->This() << v; +} + +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_oprimitive.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_oprimitive.ipp new file mode 100644 index 0000000000..702663ad81 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_text_oprimitive.ipp @@ -0,0 +1,114 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_oprimitive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // NULL +#include + +#include +#include +#include + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +// translate to base64 and copy in to buffer. +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_oprimitive::save_binary( + const void *address, + std::size_t count +){ + typedef BOOST_DEDUCED_TYPENAME OStream::char_type CharType; + + if(0 == count) + return; + + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + + os.put('\n'); + + typedef + boost::archive::iterators::insert_linebreaks< + boost::archive::iterators::base64_from_binary< + boost::archive::iterators::transform_width< + const char *, + 6, + 8 + > + > + ,72 + ,const char // cwpro8 needs this + > + base64_text; + + boost::archive::iterators::ostream_iterator oi(os); + std::copy( + base64_text(BOOST_MAKE_PFTO_WRAPPER(static_cast(address))), + base64_text( + BOOST_MAKE_PFTO_WRAPPER(static_cast(address) + count) + ), + oi + ); + + std::size_t tail = count % 3; + if(tail > 0){ + *oi++ = '='; + if(tail < 2) + *oi = '='; + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_oprimitive::basic_text_oprimitive( + OStream & os_, + bool no_codecvt +) : +#ifndef BOOST_NO_STD_LOCALE + os(os_), + flags_saver(os_), + precision_saver(os_), + archive_locale(NULL), + locale_saver(os_) +{ + if(! no_codecvt){ + archive_locale.reset( + add_facet( + std::locale::classic(), + new codecvt_null + ) + ); + os.imbue(* archive_locale); + } + os << std::noboolalpha; +} +#else + os(os_), + flags_saver(os_), + precision_saver(os_) +{} +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_oprimitive::~basic_text_oprimitive(){ + os << std::endl; +} + +} //namespace boost +} //namespace archive diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_xml_grammar.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_xml_grammar.hpp new file mode 100644 index 0000000000..768009cafb --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_xml_grammar.hpp @@ -0,0 +1,193 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP +#define BOOST_ARCHIVE_BASIC_XML_GRAMMAR_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 +// basic_xml_grammar.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// this module is derived from simplexml.cpp - an example shipped as part of +// the spirit parser. This example contains the following notice: +/*============================================================================= + simplexml.cpp + + Spirit V1.3 + URL: http://spirit.sourceforge.net/ + + Copyright (c) 2001, Daniel C. Nuffer + + This software is provided 'as-is', without any express or implied + warranty. In no event will the copyright holder be held liable for + any damages arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute + it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation + would be appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source + distribution. +=============================================================================*/ +#include + +#include +#include + +// supress noise +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# pragma warning (disable : 4786) // too long name, harmless warning +#endif + +//#define BOOST_SPIRIT_DEBUG +#include + +// the following hack is to evade a bogus error generated by using the +// word "arg" when bind.hpp has been included +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#define arg xarg +#endif + +// spirit stuff +#if (defined __BORLANDC__) && (__BORLANDC__ < 0x593) \ + || (defined _MSC_VER) && (_MSC_VER <= 1300) +#include +#else +#include +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#undef arg +#endif + +#include +#include +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// XML grammar parsing + +template +class basic_xml_grammar { +public: + // The following is not necessary according to DR45, but at least + // one compiler (Compaq C++ 6.5 in strict_ansi mode) chokes otherwise. + struct return_values; + friend struct return_values; + +private: + typedef BOOST_DEDUCED_TYPENAME std::basic_istream IStream; + typedef BOOST_DEDUCED_TYPENAME std::basic_string StringType; + typedef BOOST_DEDUCED_TYPENAME boost::spirit::chset chset_t; + typedef BOOST_DEDUCED_TYPENAME boost::spirit::chlit chlit_t; + typedef BOOST_DEDUCED_TYPENAME boost::spirit::scanner< + BOOST_DEDUCED_TYPENAME std::basic_string::iterator + > scanner_t; + typedef BOOST_DEDUCED_TYPENAME boost::spirit::rule rule_t; + // Start grammar definition + rule_t + Reference, + Eq, + STag, + ETag, + LetterOrUnderscoreOrColon, + AttValue, + CharRef1, + CharRef2, + CharRef, + AmpRef, + LTRef, + GTRef, + AposRef, + QuoteRef, + CharData, + CharDataChars, + content, + AmpName, + LTName, + GTName, + ClassNameChar, + ClassName, + Name, + XMLDecl, + XMLDeclChars, + DocTypeDecl, + DocTypeDeclChars, + ClassIDAttribute, + ObjectIDAttribute, + ClassNameAttribute, + TrackingAttribute, + VersionAttribute, + UnusedAttribute, + Attribute, + SignatureAttribute, + SerializationWrapper, + NameHead, + NameTail, + AttributeList, + S; + + // XML Character classes + chset_t + BaseChar, + Ideographic, + Char, + Letter, + Digit, + CombiningChar, + Extender, + Sch, + NameChar; + + void init_chset(); + + bool my_parse( + IStream & is, + const rule_t &rule_, + const CharType delimiter = L'>' + ) const ; +public: + struct return_values { + StringType object_name; + StringType contents; + class_id_type class_id; + object_id_type object_id; + version_type version; + tracking_type tracking_level; + StringType class_name; + return_values() : + version(0), + tracking_level(false) + {} + } rv; + bool parse_start_tag(IStream & is) /*const*/; + bool parse_end_tag(IStream & is) const; + bool parse_string(IStream & is, StringType & s) /*const*/; + void init(IStream & is); + void windup(IStream & is); + basic_xml_grammar(); +}; + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_xml_iarchive.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_xml_iarchive.ipp new file mode 100644 index 0000000000..a74844d7fa --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_xml_iarchive.ipp @@ -0,0 +1,114 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_iarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL +#include + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of xml_text_archive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::load_start(const char *name){ + // if there's no name + if(NULL == name) + return; + bool result = this->This()->gimpl->parse_start_tag(this->This()->get_is()); + if(true != result){ + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + } + // don't check start tag at highest level + ++depth; + return; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::load_end(const char *name){ + // if there's no name + if(NULL == name) + return; + bool result = this->This()->gimpl->parse_end_tag(this->This()->get_is()); + if(true != result){ + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + } + + // don't check start tag at highest level + if(0 == --depth) + return; + + if(0 == (this->get_flags() & no_xml_tag_checking)){ + // double check that the tag matches what is expected - useful for debug + if(0 != name[this->This()->gimpl->rv.object_name.size()] + || ! std::equal( + this->This()->gimpl->rv.object_name.begin(), + this->This()->gimpl->rv.object_name.end(), + name + ) + ){ + boost::serialization::throw_exception( + xml_archive_exception( + xml_archive_exception::xml_archive_tag_mismatch, + name + ) + ); + } + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::load_override(object_id_type & t, int){ + t = this->This()->gimpl->rv.object_id; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::load_override(version_type & t, int){ + t = this->This()->gimpl->rv.version; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::load_override(class_id_type & t, int){ + t = this->This()->gimpl->rv.class_id; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::load_override(tracking_type & t, int){ + t = this->This()->gimpl->rv.tracking_level; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_iarchive::basic_xml_iarchive(unsigned int flags) : + detail::common_iarchive(flags), + depth(0) +{} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_iarchive::~basic_xml_iarchive(){} + +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_xml_oarchive.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_xml_oarchive.ipp new file mode 100644 index 0000000000..518d8a791c --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/basic_xml_oarchive.ipp @@ -0,0 +1,275 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_oarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL +#include +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; +} // namespace std +#endif + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +namespace detail { +template +struct XML_name { + void operator()(CharType t) const{ + const unsigned char lookup_table[] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0, // -. + 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, // 0-9 + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // A- + 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, // -Z _ + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // a- + 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, // -z + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + }; + if((unsigned)t > 127) + return; + if(0 == lookup_table[(unsigned)t]) + boost::serialization::throw_exception( + xml_archive_exception( + xml_archive_exception::xml_archive_tag_name_error + ) + ); + } +}; + +} // namespace detail + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions common to both types of xml output + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::write_attribute( + const char *attribute_name, + int t, + const char *conjunction +){ + this->This()->put(' '); + this->This()->put(attribute_name); + this->This()->put(conjunction); + this->This()->save(t); + this->This()->put('"'); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::write_attribute( + const char *attribute_name, + const char *key +){ + this->This()->put(' '); + this->This()->put(attribute_name); + this->This()->put("=\""); + this->This()->save(key); + this->This()->put('"'); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::indent(){ + int i; + for(i = depth; i-- > 0;) + this->This()->put('\t'); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_start(const char *name) +{ + if(NULL == name) + return; + + // be sure name has no invalid characters + std::for_each(name, name + std::strlen(name), detail::XML_name()); + + end_preamble(); + if(depth > 0){ + this->This()->put('\n'); + indent(); + } + ++depth; + this->This()->put('<'); + this->This()->save(name); + pending_preamble = true; + indent_next = false; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_end(const char *name) +{ + if(NULL == name) + return; + + // be sure name has no invalid characters + std::for_each(name, name + std::strlen(name), detail::XML_name()); + + end_preamble(); + --depth; + if(indent_next){ + this->This()->put('\n'); + indent(); + } + indent_next = true; + this->This()->put("This()->save(name); + this->This()->put('>'); + if(0 == depth) + this->This()->put('\n'); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::end_preamble(){ + if(pending_preamble){ + this->This()->put('>'); + pending_preamble = false; + } +} +#if 0 +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override(const object_id_type & t, int) +{ + int i = t.t; // extra .t is for borland + write_attribute(BOOST_ARCHIVE_XML_OBJECT_ID(), i, "=\"_"); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override( + const object_reference_type & t, + int +){ + int i = t.t; // extra .t is for borland + write_attribute(BOOST_ARCHIVE_XML_OBJECT_REFERENCE(), i, "=\"_"); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override(const version_type & t, int) +{ + int i = t.t; // extra .t is for borland + write_attribute(VBOOST_ARCHIVE_XML_ERSION(), i); +} +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override(const object_id_type & t, int) +{ + // borland doesn't do conversion of STRONG_TYPEDEFs very well + const unsigned int i = t; + write_attribute(BOOST_ARCHIVE_XML_OBJECT_ID(), i, "=\"_"); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override( + const object_reference_type & t, + int +){ + const unsigned int i = t; + write_attribute(BOOST_ARCHIVE_XML_OBJECT_REFERENCE(), i, "=\"_"); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override(const version_type & t, int) +{ + const unsigned int i = t; + write_attribute(BOOST_ARCHIVE_XML_VERSION(), i); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override(const class_id_type & t, int) +{ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID(), t); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override( + const class_id_reference_type & t, + int +){ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID_REFERENCE(), t); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override( + const class_id_optional_type & t, + int +){ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID(), t); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override(const class_name_type & t, int) +{ + const char * key = t; + if(NULL == key) + return; + write_attribute(BOOST_ARCHIVE_XML_CLASS_NAME(), key); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override(const tracking_type & t, int) +{ + write_attribute(BOOST_ARCHIVE_XML_TRACKING(), t.t); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::init(){ + // xml header + this->This()->put("\n"); + this->This()->put("\n"); + // xml document wrapper - outer root + this->This()->put("This()->put(">\n"); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_oarchive::basic_xml_oarchive(unsigned int flags) : + detail::common_oarchive(flags), + depth(0), + indent_next(false), + pending_preamble(false) +{ +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_oarchive::~basic_xml_oarchive(){ + if(0 == (this->get_flags() & no_header)){ + BOOST_TRY{ + this->This()->put("\n"); + } + BOOST_CATCH(...){} + BOOST_CATCH_END + } +} + +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_iarchive_impl.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_iarchive_impl.ipp new file mode 100644 index 0000000000..f14c0d8e2a --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_iarchive_impl.ipp @@ -0,0 +1,128 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_iarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +////////////////////////////////////////////////////////////////////// +// implementation of basic_text_iprimitive overrides for the combination +// of template parameters used to implement a text_iprimitive + +#include // size_t, NULL +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include // RogueWave + +#include + +namespace boost { +namespace archive { + +template +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::load(char *s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // Works on all tested platforms + is.read(s, size); + s[size] = '\0'; +} + +template +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::load(std::string &s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(size); + if(0 < size) + is.read(&(*s.begin()), size); +} + +#ifndef BOOST_NO_CWCHAR +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::load(wchar_t *ws) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + is.read((char *)ws, size * sizeof(wchar_t)/sizeof(char)); + ws[size] = L'\0'; +} +#endif // BOOST_NO_INTRINSIC_WCHAR_T + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::load(std::wstring &ws) +{ + std::size_t size; + * this->This() >> size; + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(size); + // skip separating space + is.get(); + is.read((char *)ws.data(), size * sizeof(wchar_t)/sizeof(char)); +} + +#endif // BOOST_NO_STD_WSTRING +#endif // BOOST_NO_CWCHAR + +template +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::load_override(class_name_type & t, int){ + basic_text_iarchive::load_override(t, 0); +} + +template +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::init(){ + basic_text_iarchive::init(); +} + +template +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +text_iarchive_impl::text_iarchive_impl( + std::istream & is, + unsigned int flags +) : + basic_text_iprimitive( + is, + 0 != (flags & no_codecvt) + ), + basic_text_iarchive(flags) +{ + if(0 == (flags & no_header)) + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->init(); + #else + this->basic_text_iarchive::init(); + #endif +} + +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_oarchive_impl.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_oarchive_impl.ipp new file mode 100644 index 0000000000..2df0b46019 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_oarchive_impl.ipp @@ -0,0 +1,124 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_oarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include +#include // size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR +#include +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif +#endif + +#include +#include + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_text_oprimitive overrides for the combination +// of template parameters used to create a text_oprimitive + +template +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl::save(const char * s) +{ + const std::size_t len = std::ostream::traits_type::length(s); + *this->This() << len; + this->This()->newtoken(); + os << s; +} + +template +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl::save(const std::string &s) +{ + const std::size_t size = s.size(); + *this->This() << size; + this->This()->newtoken(); + os << s; +} + +#ifndef BOOST_NO_CWCHAR +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl::save(const wchar_t * ws) +{ + const std::size_t l = std::wcslen(ws); + * this->This() << l; + this->This()->newtoken(); + os.write((const char *)ws, l * sizeof(wchar_t)/sizeof(char)); +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl::save(const std::wstring &ws) +{ + const std::size_t l = ws.size(); + * this->This() << l; + this->This()->newtoken(); + os.write((const char *)(ws.data()), l * sizeof(wchar_t)/sizeof(char)); +} +#endif +#endif // BOOST_NO_CWCHAR + +template +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +text_oarchive_impl::text_oarchive_impl( + std::ostream & os, + unsigned int flags +) : + basic_text_oprimitive( + os, + 0 != (flags & no_codecvt) + ), + basic_text_oarchive(flags) +{ + if(0 == (flags & no_header)) + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->init(); + #else + this->basic_text_oarchive::init(); + #endif +} + +template +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl::save_binary(const void *address, std::size_t count){ + put('\n'); + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->delimiter = this->eol; +} + +} // namespace archive +} // namespace boost + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_wiarchive_impl.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_wiarchive_impl.ipp new file mode 100644 index 0000000000..6938c22659 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_wiarchive_impl.ipp @@ -0,0 +1,118 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_text_wiarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // size_t, NULL + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include // fixup for RogueWave + +#ifndef BOOST_NO_STD_WSTREAMBUF +#include + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of wiprimtives functions +// +template +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl::load(char *s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + while(size-- > 0){ + *s++ = is.narrow(is.get(), '\0'); + } + *s = '\0'; +} + +template +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl::load(std::string &s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(0); + s.reserve(size); + while(size-- > 0){ + int x = is.narrow(is.get(), '\0'); + s += x; + } +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl::load(wchar_t *s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // Works on all tested platforms + is.read(s, size); + s[size] = L'\0'; +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl::load(std::wstring &ws) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // borland complains about resize + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(size); + // note breaking a rule here - is this a problem on some platform + is.read(const_cast(ws.data()), size); +} +#endif + +template +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +text_wiarchive_impl::text_wiarchive_impl( + std::wistream & is, + unsigned int flags +) : + basic_text_iprimitive( + is, + 0 != (flags & no_codecvt) + ), + basic_text_iarchive(flags) +{ + if(0 == (flags & no_header)) + basic_text_iarchive::init(); +} + +} // archive +} // boost + +#endif // BOOST_NO_STD_WSTREAMBUF diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_woarchive_impl.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_woarchive_impl.ipp new file mode 100644 index 0000000000..6683f528c0 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/text_woarchive_impl.ipp @@ -0,0 +1,85 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_woarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include +#include // size_t +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; + using ::size_t; +} // namespace std +#endif + +#include + +#include + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of woarchive functions +// +template +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl::save(const char *s) +{ + // note: superfluous local variable fixes borland warning + const std::size_t size = std::strlen(s); + * this->This() << size; + this->This()->newtoken(); + while(*s != '\0') + os.put(os.widen(*s++)); +} + +template +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl::save(const std::string &s) +{ + const std::size_t size = s.size(); + * this->This() << size; + this->This()->newtoken(); + const char * cptr = s.data(); + for(std::size_t i = size; i-- > 0;) + os.put(os.widen(*cptr++)); +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl::save(const wchar_t *ws) +{ + const std::size_t size = std::wostream::traits_type::length(ws); + * this->This() << size; + this->This()->newtoken(); + os.write(ws, size); +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl::save(const std::wstring &ws) +{ + const std::size_t size = ws.length(); + * this->This() << size; + this->This()->newtoken(); + os.write(ws.data(), size); +} +#endif + +} // namespace archive +} // namespace boost + +#endif + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_iarchive_impl.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_iarchive_impl.ipp new file mode 100644 index 0000000000..21d006e7f0 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_iarchive_impl.ipp @@ -0,0 +1,202 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_iarchive_impl.cpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // memcpy +#include // NULL +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR +#include // mbtowc +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::mbtowc; + } // namespace std +#endif +#endif // BOOST_NO_CWCHAR + +#include // RogueWave and Dinkumware +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#include + +#include +#include +#include +#include + +#include "basic_xml_grammar.hpp" + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to char archives + +// wide char stuff used by char archives + +#ifndef BOOST_NO_CWCHAR +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::load(std::wstring &ws){ + std::string s; + bool result = gimpl->parse_string(is, s); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(0); + const char * start = s.data(); + const char * end = start + s.size(); + while(start < end){ + wchar_t wc; + int resultx = std::mbtowc(&wc, start, end - start); + if(0 < resultx){ + start += resultx; + ws += wc; + continue; + } + boost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + } +} +#endif // BOOST_NO_STD_WSTRING + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::load(wchar_t * ws){ + std::string s; + bool result = gimpl->parse_string(is, s); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + + const char * start = s.data(); + const char * end = start + s.size(); + while(start < end){ + wchar_t wc; + int result = std::mbtowc(&wc, start, end - start); + if(0 < result){ + start += result; + *ws++ = wc; + continue; + } + boost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + } + *ws = L'\0'; +} +#endif + +#endif // BOOST_NO_CWCHAR + +template +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::load(std::string &s){ + bool result = gimpl->parse_string(is, s); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); +} + +template +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::load(char * s){ + std::string tstring; + bool result = gimpl->parse_string(is, tstring); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + std::memcpy(s, tstring.data(), tstring.size()); + s[tstring.size()] = 0; +} + +template +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::load_override(class_name_type & t, int){ + const std::string & s = gimpl->rv.class_name; + if(s.size() > BOOST_SERIALIZATION_MAX_KEY_SIZE - 1) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + char * tptr = t; + std::memcpy(tptr, s.data(), s.size()); + tptr[s.size()] = '\0'; +} + +template +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::init(){ + gimpl->init(is); + this->set_library_version(gimpl->rv.version); +} + +template +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_iarchive_impl::xml_iarchive_impl( + std::istream &is_, + unsigned int flags +) : + basic_text_iprimitive( + is_, + 0 != (flags & no_codecvt) + ), + basic_xml_iarchive(flags), + gimpl(new xml_grammar()) +{ + if(0 == (flags & no_header)){ + BOOST_TRY{ + init(); + } + BOOST_CATCH(...){ + delete gimpl; + #ifndef BOOST_NO_EXCEPTIONS + throw; // re-throw + #endif + } + BOOST_CATCH_END + } +} + +template +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_iarchive_impl::~xml_iarchive_impl(){ + if(0 == (this->get_flags() & no_header)){ + BOOST_TRY{ + gimpl->windup(is); + } + BOOST_CATCH(...){} + BOOST_CATCH_END + } + delete gimpl; +} +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_oarchive_impl.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_oarchive_impl.ipp new file mode 100644 index 0000000000..8ab954f4a3 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_oarchive_impl.ipp @@ -0,0 +1,117 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_oarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include + +#include // strlen +#include // msvc 6.0 needs this to suppress warnings +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::strlen; +} // namespace std +#endif + +#include +#include + +#ifndef BOOST_NO_CWCHAR +#include +#include +#endif + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to char archives + +// wide char stuff used by char archives +#ifndef BOOST_NO_CWCHAR +// copy chars to output escaping to xml and translating wide chars to mb chars +template +void save_iterator(std::ostream &os, InputIterator begin, InputIterator end){ + typedef boost::archive::iterators::mb_from_wchar< + boost::archive::iterators::xml_escape + > translator; + std::copy( + translator(BOOST_MAKE_PFTO_WRAPPER(begin)), + translator(BOOST_MAKE_PFTO_WRAPPER(end)), + boost::archive::iterators::ostream_iterator(os) + ); +} + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl::save(const std::wstring & ws){ +// at least one library doesn't typedef value_type for strings +// so rather than using string directly make a pointer iterator out of it +// save_iterator(os, ws.data(), ws.data() + std::wcslen(ws.data())); + save_iterator(os, ws.data(), ws.data() + ws.size()); +} +#endif + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl::save(const wchar_t * ws){ + save_iterator(os, ws, ws + std::wcslen(ws)); +} +#endif + +#endif // BOOST_NO_CWCHAR + +template +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl::save(const std::string & s){ +// at least one library doesn't typedef value_type for strings +// so rather than using string directly make a pointer iterator out of it + typedef boost::archive::iterators::xml_escape< + const char * + > xml_escape_translator; + std::copy( + xml_escape_translator(BOOST_MAKE_PFTO_WRAPPER(s.data())), + xml_escape_translator(BOOST_MAKE_PFTO_WRAPPER(s.data()+ s.size())), + boost::archive::iterators::ostream_iterator(os) + ); +} + +template +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl::save(const char * s){ + typedef boost::archive::iterators::xml_escape< + const char * + > xml_escape_translator; + std::copy( + xml_escape_translator(BOOST_MAKE_PFTO_WRAPPER(s)), + xml_escape_translator(BOOST_MAKE_PFTO_WRAPPER(s + std::strlen(s))), + boost::archive::iterators::ostream_iterator(os) + ); +} + +template +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_oarchive_impl::xml_oarchive_impl( + std::ostream & os_, + unsigned int flags +) : + basic_text_oprimitive( + os_, + 0 != (flags & no_codecvt) + ), + basic_xml_oarchive(flags) +{ + if(0 == (flags & no_header)) + this->init(); +} + +} // namespace archive +} // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_wiarchive_impl.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_wiarchive_impl.ipp new file mode 100644 index 0000000000..3df68d9140 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_wiarchive_impl.ipp @@ -0,0 +1,204 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_wiprimitive.cpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // for BOOST_DEDUCED_TYPENAME + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} //std +#endif + +#include // msvc 6.0 needs this to suppress warnings +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include +#include + +#include // Dinkumware and RogueWave +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include "basic_xml_grammar.hpp" + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to wide char archives + +namespace { // anonymous + +void copy_to_ptr(char * s, const std::wstring & ws){ + std::copy( + iterators::mb_from_wchar( + BOOST_MAKE_PFTO_WRAPPER(ws.begin()) + ), + iterators::mb_from_wchar( + BOOST_MAKE_PFTO_WRAPPER(ws.end()) + ), + s + ); + s[ws.size()] = 0; +} + +} // anonymous + +template +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::load(std::string & s){ + std::wstring ws; + bool result = gimpl->parse_string(is, ws); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(0); + s.reserve(ws.size()); + std::copy( + iterators::mb_from_wchar( + BOOST_MAKE_PFTO_WRAPPER(ws.begin()) + ), + iterators::mb_from_wchar( + BOOST_MAKE_PFTO_WRAPPER(ws.end()) + ), + std::back_inserter(s) + ); +} + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::load(std::wstring & ws){ + bool result = gimpl->parse_string(is, ws); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); +} +#endif + +template +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::load(char * s){ + std::wstring ws; + bool result = gimpl->parse_string(is, ws); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + copy_to_ptr(s, ws); +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::load(wchar_t * ws){ + std::wstring twstring; + bool result = gimpl->parse_string(is, twstring); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + std::memcpy(ws, twstring.c_str(), twstring.size()); + ws[twstring.size()] = L'\0'; +} +#endif + +template +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::load_override(class_name_type & t, int){ + const std::wstring & ws = gimpl->rv.class_name; + if(ws.size() > BOOST_SERIALIZATION_MAX_KEY_SIZE - 1) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + copy_to_ptr(t, ws); +} + +template +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::init(){ + gimpl->init(is); + this->set_library_version(gimpl->rv.version); +} + +template +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_wiarchive_impl::xml_wiarchive_impl( + std::wistream &is_, + unsigned int flags +) : + basic_text_iprimitive( + is_, + true // don't change the codecvt - use the one below + ), + basic_xml_iarchive(flags), + gimpl(new xml_wgrammar()) +{ + if(0 == (flags & no_codecvt)){ + archive_locale.reset( + add_facet( + std::locale::classic(), + new boost::archive::detail::utf8_codecvt_facet + ) + ); + is.imbue(* archive_locale); + } + if(0 == (flags & no_header)){ + BOOST_TRY{ + this->init(); + } + BOOST_CATCH(...){ + delete gimpl; + #ifndef BOOST_NO_EXCEPTIONS + throw; // re-throw + #endif + } + BOOST_CATCH_END + } +} + +template +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_wiarchive_impl::~xml_wiarchive_impl(){ + if(0 == (this->get_flags() & no_header)){ + BOOST_TRY{ + gimpl->windup(is); + } + BOOST_CATCH(...){} + BOOST_CATCH_END + } + delete gimpl; +} + +} // namespace archive +} // namespace boost + +#endif // BOOST_NO_STD_WSTREAMBUF diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_woarchive_impl.ipp b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_woarchive_impl.ipp new file mode 100644 index 0000000000..3bf42bdace --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/impl/xml_woarchive_impl.ipp @@ -0,0 +1,160 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_woarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include +#include +#include +#include + +#include // msvc 6.0 needs this to suppress warnings + // for BOOST_DEDUCED_TYPENAME +#include // strlen +#include // mbtowc +#include // wcslen + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::strlen; + #if ! defined(BOOST_NO_INTRINSIC_WCHAR_T) + using ::mbtowc; + using ::wcslen; + #endif +} // namespace std +#endif + +#include +#include + +#include +#include +#include +#include + +#include +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to wide char archives + +// copy chars to output escaping to xml and widening characters as we go +template +void save_iterator(std::wostream &os, InputIterator begin, InputIterator end){ + typedef iterators::wchar_from_mb< + iterators::xml_escape + > xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(begin)), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(end)), + boost::archive::iterators::ostream_iterator(os) + ); +} + +template +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl::save(const std::string & s){ + // note: we don't use s.begin() and s.end() because dinkumware + // doesn't have string::value_type defined. So use a wrapper + // around these values to implement the definitions. + const char * begin = s.data(); + const char * end = begin + s.size(); + save_iterator(os, begin, end); +} + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl::save(const std::wstring & ws){ +#if 0 + typedef iterators::xml_escape xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.begin())), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.end())), + boost::archive::iterators::ostream_iterator(os) + ); +#endif + typedef iterators::xml_escape xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.data())), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.data() + ws.size())), + boost::archive::iterators::ostream_iterator(os) + ); +} +#endif //BOOST_NO_STD_WSTRING + +template +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl::save(const char * s){ + save_iterator(os, s, s + std::strlen(s)); +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl::save(const wchar_t * ws){ + os << ws; + typedef iterators::xml_escape xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws)), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws + std::wcslen(ws))), + boost::archive::iterators::ostream_iterator(os) + ); +} +#endif + +template +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_woarchive_impl::xml_woarchive_impl( + std::wostream & os_, + unsigned int flags +) : + basic_text_oprimitive( + os_, + true // don't change the codecvt - use the one below + ), + basic_xml_oarchive(flags) +{ + // Standard behavior is that imbue can be called + // a) before output is invoked or + // b) after flush has been called. This prevents one-to-many + // transforms (such as one to many transforms from getting + // mixed up. Unfortunately, STLPort doesn't respect b) above + // so the restoration of the original archive locale done by + // the locale_saver doesn't get processed, + // before the current one is destroyed. + // so the codecvt doesn't get replaced with the orginal + // so closing the stream invokes codecvt::do_unshift + // so it crashes because the corresponding locale that contained + // the codecvt isn't around any more. + // we can hack around this by using a static codecvt that never + // gets destroyed. + if(0 == (flags & no_codecvt)){ + boost::archive::detail::utf8_codecvt_facet *pfacet; + #if defined(__SGI_STL_PORT) + static boost::archive::detail::utf8_codecvt_facet + facet(static_cast(1)); + pfacet = & facet; + #else + pfacet = new boost::archive::detail::utf8_codecvt_facet; + #endif + archive_locale.reset(add_facet(std::locale::classic(), pfacet)); + os.imbue(* archive_locale); + } + if(0 == (flags & no_header)) + this->init(); +} + +} // namespace archive +} // namespace boost + +#endif //BOOST_NO_STD_WSTREAMBUF diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/base64_exception.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/base64_exception.hpp new file mode 100644 index 0000000000..eb2d2e1ba0 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/base64_exception.hpp @@ -0,0 +1,68 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_BASE64_EXCEPTION_HPP +#define BOOST_ARCHIVE_ITERATORS_BASE64_EXCEPTION_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 +// base64_exception.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifndef BOOST_NO_EXCEPTIONS +#include + +#include + +namespace boost { +namespace archive { +namespace iterators { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by base64s +// +class base64_exception : public std::exception +{ +public: + typedef enum { + invalid_code, // attempt to encode a value > 6 bits + invalid_character, // decode a value not in base64 char set + other_exception + } exception_code; + exception_code code; + + base64_exception(exception_code c = other_exception) : code(c) + {} + + virtual const char *what( ) const throw( ) + { + const char *msg = "unknown exception code"; + switch(code){ + case invalid_code: + msg = "attempt to encode a value > 6 bits"; + break; + case invalid_character: + msg = "attempt to decode a value not in base64 char set"; + break; + default: + assert(false); + break; + } + return msg; + } +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif //BOOST_NO_EXCEPTIONS +#endif //BOOST_ARCHIVE_ITERATORS_ARCHIVE_EXCEPTION_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/base64_from_binary.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/base64_from_binary.hpp new file mode 100644 index 0000000000..a46137d1d5 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/base64_from_binary.hpp @@ -0,0 +1,112 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP +#define BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_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 +// base64_from_binary.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include // size_t +#include // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// convert binary integers to base64 characters + +namespace detail { + +template +struct from_6_bit { + typedef CharType result_type; + CharType operator()(CharType t) const{ + const char * lookup_table = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "+/"; + assert(t < 64); + return lookup_table[static_cast(t)]; + } +}; + +} // namespace detail + +// note: what we would like to do is +// template +// typedef transform_iterator< +// from_6_bit, +// transform_width +// > base64_from_binary; +// but C++ won't accept this. Rather than using a "type generator" and +// using a different syntax, make a derivation which should be equivalent. +// +// Another issue addressed here is that the transform_iterator doesn't have +// a templated constructor. This makes it incompatible with the dataflow +// ideal. This is also addressed here. + +//template +template< + class Base, + class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value::type +> +class base64_from_binary : + public transform_iterator< + detail::from_6_bit, + Base + > +{ + friend class boost::iterator_core_access; + typedef transform_iterator< + BOOST_DEDUCED_TYPENAME detail::from_6_bit, + Base + > super_t; + +public: + // make composible buy using templated constructor + template + base64_from_binary(BOOST_PFTO_WRAPPER(T) start) : + super_t( + Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start))), + detail::from_6_bit() + ) + {} + // intel 7.1 doesn't like default copy constructor + base64_from_binary(const base64_from_binary & rhs) : + super_t( + Base(rhs.base_reference()), + detail::from_6_bit() + ) + {} +// base64_from_binary(){}; +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/binary_from_base64.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/binary_from_base64.hpp new file mode 100644 index 0000000000..b75e0b10cc --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/binary_from_base64.hpp @@ -0,0 +1,120 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP +#define BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_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 +// binary_from_base64.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include // for BOOST_DEDUCED_TYPENAME +#include +#include +#include + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// convert base64 characters to binary data + +namespace detail { + +template +struct to_6_bit { + typedef CharType result_type; + CharType operator()(CharType t) const{ + const char lookup_table[] = { + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, + 52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, + 15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, + -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, + 41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1 + }; + // metrowerks trips this assertion - how come? + #if ! defined(__MWERKS__) + BOOST_STATIC_ASSERT(128 == sizeof(lookup_table)); + #endif + signed char value = -1; + if((unsigned)t <= 127) + value = lookup_table[(unsigned)t]; + if(-1 == value) + boost::serialization::throw_exception( + dataflow_exception(dataflow_exception::invalid_base64_character) + ); + return value; + } +}; + +} // namespace detail + +// note: what we would like to do is +// template +// typedef transform_iterator< +// from_6_bit, +// transform_width +// > base64_from_binary; +// but C++ won't accept this. Rather than using a "type generator" and +// using a different syntax, make a derivation which should be equivalent. +// +// Another issue addressed here is that the transform_iterator doesn't have +// a templated constructor. This makes it incompatible with the dataflow +// ideal. This is also addressed here. + +template< + class Base, + class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value::type +> +class binary_from_base64 : public + transform_iterator< + detail::to_6_bit, + Base + > +{ + friend class boost::iterator_core_access; + typedef transform_iterator< + detail::to_6_bit, + Base + > super_t; +public: + // make composible buy using templated constructor + template + binary_from_base64(BOOST_PFTO_WRAPPER(T) start) : + super_t( + Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start))), + detail::to_6_bit() + ) + {} + // intel 7.1 doesn't like default copy constructor + binary_from_base64(const binary_from_base64 & rhs) : + super_t( + Base(rhs.base_reference()), + detail::to_6_bit() + ) + {} +// binary_from_base64(){}; +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/dataflow.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/dataflow.hpp new file mode 100644 index 0000000000..7958482401 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/dataflow.hpp @@ -0,0 +1,105 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_DATAFLOW_HPP +#define BOOST_ARCHIVE_ITERATORS_DATAFLOW_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 +// dataflow.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include // for BOOST_DEDUCED_TYPENAME + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +// poor man's tri-state +struct tri_state { + enum state_enum { + is_false = false, + is_true = true, + is_indeterminant + } m_state; + // convert to bool + operator bool (){ + assert(is_indeterminant != m_state); + return is_true == m_state ? true : false; + } + // assign from bool + tri_state & operator=(bool rhs) { + m_state = rhs ? is_true : is_false; + return *this; + } + tri_state(bool rhs) : + m_state(rhs ? is_true : is_false) + {} + tri_state(state_enum state) : + m_state(state) + {} + bool operator==(const tri_state & rhs) const { + return m_state == rhs.m_state; + } + bool operator!=(const tri_state & rhs) const { + return m_state != rhs.m_state; + } +}; + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implement functions common to dataflow iterators +template +class dataflow { + bool m_eoi; +protected: + // test for iterator equality + tri_state equal(const Derived & rhs) const { + if(m_eoi && rhs.m_eoi) + return true; + if(m_eoi || rhs.m_eoi) + return false; + return tri_state(tri_state::is_indeterminant); + } + void eoi(bool tf){ + m_eoi = tf; + } + bool eoi() const { + return m_eoi; + } +public: + dataflow(bool tf) : + m_eoi(tf) + {} + dataflow() : // used for iterator end + m_eoi(true) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_DATAFLOW_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/dataflow_exception.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/dataflow_exception.hpp new file mode 100644 index 0000000000..765661e470 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/dataflow_exception.hpp @@ -0,0 +1,80 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP +#define BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_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 +// dataflow_exception.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifndef BOOST_NO_EXCEPTIONS +#include +#endif //BOOST_NO_EXCEPTIONS + +#include + +namespace boost { +namespace archive { +namespace iterators { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by dataflows +// +class dataflow_exception : public std::exception +{ +public: + typedef enum { + invalid_6_bitcode, + invalid_base64_character, + invalid_xml_escape_sequence, + comparison_not_permitted, + invalid_conversion, + other_exception + } exception_code; + exception_code code; + + dataflow_exception(exception_code c = other_exception) : code(c) + {} + + virtual const char *what( ) const throw( ) + { + const char *msg = "unknown exception code"; + switch(code){ + case invalid_6_bitcode: + msg = "attempt to encode a value > 6 bits"; + break; + case invalid_base64_character: + msg = "attempt to decode a value not in base64 char set"; + break; + case invalid_xml_escape_sequence: + msg = "invalid xml escape_sequence"; + break; + case comparison_not_permitted: + msg = "cannot invoke iterator comparison now"; + break; + case invalid_conversion: + msg = "invalid multbyte/wide char conversion"; + break; + default: + assert(false); + break; + } + return msg; + } +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif //BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/escape.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/escape.hpp new file mode 100644 index 0000000000..3fe64fa49f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/escape.hpp @@ -0,0 +1,115 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_ESCAPE_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 +// escape.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL + +#include // for BOOST_DEDUCED_TYPENAME +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert escapes into text + +template +class escape : + public boost::iterator_adaptor< + Derived, + Base, + BOOST_DEDUCED_TYPENAME boost::iterator_value::type, + single_pass_traversal_tag, + BOOST_DEDUCED_TYPENAME boost::iterator_value::type + > +{ + typedef BOOST_DEDUCED_TYPENAME boost::iterator_value::type base_value_type; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_reference::type reference_type; + friend class boost::iterator_core_access; + + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + Derived, + Base, + base_value_type, + single_pass_traversal_tag, + base_value_type + > super_t; + + typedef escape this_t; + + void dereference_impl() { + m_current_value = static_cast(this)->fill(m_bnext, m_bend); + m_full = true; + } + + //Access the value referred to + reference_type dereference() const { + if(!m_full) + const_cast(this)->dereference_impl(); + return m_current_value; + } + + bool equal(const this_t & rhs) const { + if(m_full){ + if(! rhs.m_full) + const_cast(& rhs)->dereference_impl(); + } + else{ + if(rhs.m_full) + const_cast(this)->dereference_impl(); + } + if(m_bnext != rhs.m_bnext) + return false; + if(this->base_reference() != rhs.base_reference()) + return false; + return true; + } + + void increment(){ + if(++m_bnext < m_bend){ + m_current_value = *m_bnext; + return; + } + ++(this->base_reference()); + m_bnext = NULL; + m_bend = NULL; + m_full = false; + } + + // buffer to handle pending characters + const base_value_type *m_bnext; + const base_value_type *m_bend; + bool m_full; + BOOST_DEDUCED_TYPENAME boost::iterator_value::type m_current_value; +public: + escape(Base base) : + super_t(base), + m_bnext(NULL), + m_bend(NULL), + m_full(false) + { + } +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/head_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/head_iterator.hpp new file mode 100644 index 0000000000..279b2025ce --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/head_iterator.hpp @@ -0,0 +1,81 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP +#define BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_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 +// head_iterator.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +template +class head_iterator + : public boost::iterator_adaptor< + head_iterator, + Base, + use_default, + single_pass_traversal_tag + > +{ +private: + friend class iterator_core_access; + typedef boost::iterator_adaptor< + head_iterator, + Base, + use_default, + single_pass_traversal_tag + > super_t; + + typedef head_iterator this_t; + typedef BOOST_DEDUCED_TYPENAME super_t::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME super_t::reference reference_type; + + reference_type dereference_impl(){ + if(! m_end){ + while(! m_predicate(* this->base_reference())) + ++ this->base_reference(); + m_end = true; + } + return * this->base_reference(); + } + + reference_type dereference() const { + return const_cast(this)->dereference_impl(); + } + + void increment(){ + ++base_reference(); + } + Predicate m_predicate; + bool m_end; +public: + template + head_iterator(Predicate f, T start) : + super_t(Base(start)), + m_predicate(f), + m_end(false) + {} + +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/insert_linebreaks.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/insert_linebreaks.hpp new file mode 100644 index 0000000000..feb8c5bb84 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/insert_linebreaks.hpp @@ -0,0 +1,101 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP +#define BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_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 +// insert_linebreaks.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ using ::memcpy; } +#endif + +#include + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert line break every N characters +template< + class Base, + int N, + class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value::type +> +class insert_linebreaks : + public iterator_adaptor< + insert_linebreaks, + Base, + CharType, + single_pass_traversal_tag, + CharType + > +{ +private: + friend class boost::iterator_core_access; + typedef iterator_adaptor< + insert_linebreaks, + Base, + CharType, + single_pass_traversal_tag, + CharType + > super_t; + + bool equal(const insert_linebreaks & rhs) const { + return +// m_count == rhs.m_count +// && base_reference() == rhs.base_reference() + this->base_reference() == rhs.base_reference() + ; + } + + void increment() { + if(m_count == N){ + m_count = 0; + return; + } + ++m_count; + ++(this->base_reference()); + } + CharType dereference() const { + if(m_count == N) + return '\n'; + return * (this->base_reference()); + } + unsigned int m_count; +public: + // make composible buy using templated constructor + template + insert_linebreaks(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))), + m_count(0) + {} + // intel 7.1 doesn't like default copy constructor + insert_linebreaks(const insert_linebreaks & rhs) : + super_t(rhs.base_reference()), + m_count(rhs.m_count) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/istream_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/istream_iterator.hpp new file mode 100644 index 0000000000..ac3568aa87 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/istream_iterator.hpp @@ -0,0 +1,95 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP +#define BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_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 +// istream_iterator.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// note: this is a custom version of the standard istream_iterator. +// This is necessary as the standard version doesn't work as expected +// for wchar_t based streams on systems for which wchar_t not a true +// type but rather a synonym for some integer type. + +#include // NULL +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +// given a type, make an input iterator based on a pointer to that type +template +class istream_iterator : + public boost::iterator_facade< + istream_iterator, + Elem, + std::input_iterator_tag, + Elem + > +{ + friend class boost::iterator_core_access; + typedef istream_iterator this_t ; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_facade< + istream_iterator, + Elem, + std::input_iterator_tag, + Elem + > super_t; + typedef BOOST_DEDUCED_TYPENAME std::basic_istream istream_type; + + //Access the value referred to + Elem dereference() const { + return m_current_value; + } + + bool equal(const this_t & rhs) const { + // note: only works for comparison against end of stream + return m_istream == rhs.m_istream; + } + + void increment(){ + if(NULL != m_istream){ + m_current_value = m_istream->get(); + if(! m_istream->good()){ + const_cast(this)->m_istream = NULL; + } + } + } + + istream_type *m_istream; + Elem m_current_value; +public: + istream_iterator(istream_type & is) : + m_istream(& is) + { + increment(); + } + + istream_iterator() : + m_istream(NULL) + {} + + istream_iterator(const istream_iterator & rhs) : + m_istream(rhs.m_istream), + m_current_value(rhs.m_current_value) + {} + +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/mb_from_wchar.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/mb_from_wchar.hpp new file mode 100644 index 0000000000..22ee9504e5 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/mb_from_wchar.hpp @@ -0,0 +1,136 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP +#define BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_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 +// mb_from_wchar.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // size_t +#include // for wctomb() + +#include // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + using ::wctomb; +} // namespace std +#endif + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate wide strings and to char +// strings of the currently selected locale +template // the input iterator +class mb_from_wchar + : public boost::iterator_adaptor< + mb_from_wchar, + Base, + wchar_t, + single_pass_traversal_tag, + char + > +{ + friend class boost::iterator_core_access; + + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + mb_from_wchar, + Base, + wchar_t, + single_pass_traversal_tag, + char + > super_t; + + typedef mb_from_wchar this_t; + + char dereference_impl() { + if(! m_full){ + fill(); + m_full = true; + } + return m_buffer[m_bnext]; + } + char dereference() const { + return (const_cast(this))->dereference_impl(); + } + + // test for iterator equality + bool equal(const mb_from_wchar & rhs) const { + // once the value is filled, the base_reference has been incremented + // so don't permit comparison anymore. + return + 0 == m_bend + && 0 == m_bnext + && this->base_reference() == rhs.base_reference() + ; + } + + void fill(){ + wchar_t value = * this->base_reference(); + #if (defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) \ + || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8)))) + m_bend = std::wcrtomb(m_buffer, value, 0); + #else + m_bend = std::wctomb(m_buffer, value); + #endif + assert(-1 != m_bend); + assert((std::size_t)m_bend <= sizeof(m_buffer)); + assert(m_bend > 0); + m_bnext = 0; + } + + void increment(){ + if(++m_bnext < m_bend) + return; + m_bend = + m_bnext = 0; + ++(this->base_reference()); + m_full = false; + } + + // buffer to handle pending characters + int m_bend; + int m_bnext; + char m_buffer[9]; + bool m_full; + +public: + // make composible buy using templated constructor + template + mb_from_wchar(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))), + m_bend(0), + m_bnext(0), + m_full(false) + {} + // intel 7.1 doesn't like default copy constructor + mb_from_wchar(const mb_from_wchar & rhs) : + super_t(rhs.base_reference()), + m_bend(rhs.m_bend), + m_bnext(rhs.m_bnext), + m_full(rhs.m_full) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/ostream_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/ostream_iterator.hpp new file mode 100644 index 0000000000..7c3203f125 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/ostream_iterator.hpp @@ -0,0 +1,83 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_OSTREAM_ITERATOR_HPP +#define BOOST_ARCHIVE_ITERATORS_OSTREAM_ITERATOR_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 +// ostream_iterator.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// note: this is a custom version of the standard ostream_iterator. +// This is necessary as the standard version doesn't work as expected +// for wchar_t based streams on systems for which wchar_t not a true +// type but rather a synonym for some integer type. + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +// given a type, make an input iterator based on a pointer to that type +template +class ostream_iterator : + public boost::iterator_facade< + ostream_iterator, + Elem, + std::output_iterator_tag, + ostream_iterator & + > +{ + friend class boost::iterator_core_access; + typedef ostream_iterator this_t ; + typedef Elem char_type; + typedef std::basic_ostream ostream_type; + + //emulate the behavior of std::ostream + ostream_iterator & dereference() const { + return const_cast(*this); + } + bool equal(const this_t & rhs) const { + return m_ostream == rhs.m_ostream; + } + void increment(){} +protected: + ostream_type *m_ostream; + void put_val(char_type e){ + if(NULL != m_ostream){ + m_ostream->put(e); + if(! m_ostream->good()) + m_ostream = NULL; + } + } +public: + this_t & operator=(char_type c){ + put_val(c); + return *this; + } + ostream_iterator(ostream_type & os) : + m_ostream (& os) + {} + ostream_iterator() : + m_ostream (NULL) + {} + ostream_iterator(const ostream_iterator & rhs) : + m_ostream (rhs.m_ostream) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_OSTREAM_ITERATOR_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/remove_whitespace.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/remove_whitespace.hpp new file mode 100644 index 0000000000..c5e581d99f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/remove_whitespace.hpp @@ -0,0 +1,169 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_REMOVE_WHITESPACE_HPP +#define BOOST_ARCHIVE_ITERATORS_REMOVE_WHITESPACE_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 +// remove_whitespace.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include // for BOOST_DEDUCED_TYPENAME + +#include + +#include +#include + +//#include +//#if ! BOOST_WORKAROUND(BOOST_MSVC, <=1300) + +// here is the default standard implementation of the functor used +// by the filter iterator to remove spaces. Unfortunately usage +// of this implementation in combination with spirit trips a bug +// VC 6.5. The only way I can find to work around it is to +// implement a special non-standard version for this platform + +#ifndef BOOST_NO_CWCTYPE +#include // iswspace +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ using ::iswspace; } +#endif +#endif + +#include // isspace +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ using ::isspace; } +#endif + +#if defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) +// this is required for the RW STL on Linux and Tru64. +#undef isspace +#undef iswspace +#endif + +//#endif // BOOST_WORKAROUND + +namespace { // anonymous + +template +struct remove_whitespace_predicate; + +template<> +struct remove_whitespace_predicate +{ + bool operator()(unsigned char t){ + return ! std::isspace(t); + } +}; + +#ifndef BOOST_NO_CWCHAR +template<> +struct remove_whitespace_predicate +{ + bool operator()(wchar_t t){ + return ! std::iswspace(t); + } +}; +#endif + +} // namespace anonymous + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// convert base64 file data (including whitespace and padding) to binary + +namespace boost { +namespace archive { +namespace iterators { + +// custom version of filter iterator which doesn't look ahead further than +// necessary + +template +class filter_iterator + : public boost::iterator_adaptor< + filter_iterator, + Base, + use_default, + single_pass_traversal_tag + > +{ + friend class boost::iterator_core_access; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + filter_iterator, + Base, + use_default, + single_pass_traversal_tag + > super_t; + typedef filter_iterator this_t; + typedef BOOST_DEDUCED_TYPENAME super_t::reference reference_type; + + reference_type dereference_impl(){ + if(! m_full){ + while(! m_predicate(* this->base_reference())) + ++(this->base_reference()); + m_full = true; + } + return * this->base_reference(); + } + + reference_type dereference() const { + return const_cast(this)->dereference_impl(); + } + + Predicate m_predicate; + bool m_full; +public: + // note: this function is public only because comeau compiler complained + // I don't know if this is because the compiler is wrong or what + void increment(){ + m_full = false; + ++(this->base_reference()); + } + filter_iterator(Base start) : + super_t(start), + m_full(false) + {} + filter_iterator(){} +}; + +template +class remove_whitespace : + public filter_iterator< + remove_whitespace_predicate, + Base + > +{ + friend class boost::iterator_core_access; + typedef filter_iterator< + remove_whitespace_predicate, + Base + > super_t; +public: +// remove_whitespace(){} // why is this needed? + // make composible buy using templated constructor + template + remove_whitespace(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))) + {} + // intel 7.1 doesn't like default copy constructor + remove_whitespace(const remove_whitespace & rhs) : + super_t(rhs.base_reference()) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_REMOVE_WHITESPACE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/transform_width.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/transform_width.hpp new file mode 100644 index 0000000000..c2e9bee12e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/transform_width.hpp @@ -0,0 +1,168 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP +#define BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_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 +// transform_width.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// iterator which takes elements of x bits and returns elements of y bits. +// used to change streams of 8 bit characters into streams of 6 bit characters. +// and vice-versa for implementing base64 encodeing/decoding. Be very careful +// when using and end iterator. end is only reliable detected when the input +// stream length is some common multiple of x and y. E.G. Base64 6 bit +// character and 8 bit bytes. Lowest common multiple is 24 => 4 6 bit characters +// or 3 8 bit characters + +#include // for BOOST_DEDUCED_TYPENAME & PTFO +#include + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate char strings to wchar_t +// strings of the currently selected locale +template< + class Base, + int BitsOut, + int BitsIn, + class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value::type // output character +> +class transform_width : + public boost::iterator_adaptor< + transform_width, + Base, + CharType, + single_pass_traversal_tag, + CharType + > +{ + friend class boost::iterator_core_access; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + transform_width, + Base, + CharType, + single_pass_traversal_tag, + CharType + > super_t; + + typedef transform_width this_t; + typedef BOOST_DEDUCED_TYPENAME iterator_value::type base_value_type; + + CharType fill(); + + CharType dereference_impl(){ + if(! m_full){ + m_current_value = fill(); + m_full = true; + } + return m_current_value; + } + + CharType dereference() const { + return const_cast(this)->dereference_impl(); + } + + // test for iterator equality + bool equal(const this_t & rhs) const { + return + this->base_reference() == rhs.base_reference(); + ; + } + + void increment(){ + m_displacement += BitsOut; + + while(m_displacement >= BitsIn){ + m_displacement -= BitsIn; + if(0 == m_displacement) + m_bufferfull = false; + if(! m_bufferfull){ + // note: suspect that this is not invoked for borland + ++(this->base_reference()); + } + } + m_full = false; + } + + CharType m_current_value; + // number of bits left in current input character buffer + unsigned int m_displacement; + base_value_type m_buffer; + // flag to current output character is ready - just used to save time + bool m_full; + // flag to indicate that m_buffer has data + bool m_bufferfull; + +public: + // make composible buy using templated constructor + template + transform_width(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))), + m_displacement(0), + m_full(false), + m_bufferfull(false) + {} + // intel 7.1 doesn't like default copy constructor + transform_width(const transform_width & rhs) : + super_t(rhs.base_reference()), + m_current_value(rhs.m_current_value), + m_displacement(rhs.m_displacement), + m_buffer(rhs.m_buffer), + m_full(rhs.m_full), + m_bufferfull(rhs.m_bufferfull) + {} +}; + +template +CharType transform_width::fill(){ + CharType retval = 0; + unsigned int missing_bits = BitsOut; + for(;;){ + unsigned int bcount; + if(! m_bufferfull){ + m_buffer = * this->base_reference(); + m_bufferfull = true; + bcount = BitsIn; + } + else + bcount = BitsIn - m_displacement; + unsigned int i = (std::min)(bcount, missing_bits); + // shift interesting bits to least significant position + unsigned int j = m_buffer >> (bcount - i); + // strip off uninteresting bits + // (note presumption of two's complement arithmetic) + j &= ~(-(1 << i)); + // append then interesting bits to the output value + retval <<= i; + retval |= j; + missing_bits -= i; + if(0 == missing_bits) + break; + // note: suspect that this is not invoked for borland 5.51 + ++(this->base_reference()); + m_bufferfull = false; + } + return retval; +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/unescape.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/unescape.hpp new file mode 100644 index 0000000000..e709138181 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/unescape.hpp @@ -0,0 +1,94 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_UNESCAPE_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 +// unescape.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include // for BOOST_DEDUCED_TYPENAME +#include +//#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate char strings to wchar_t +// strings of the currently selected locale +template +class unescape + : public boost::iterator_adaptor< + unescape, + Base, + BOOST_DEDUCED_TYPENAME pointee::type, + single_pass_traversal_tag, + BOOST_DEDUCED_TYPENAME pointee::type + > +{ + friend class boost::iterator_core_access; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + unescape, + Base, + BOOST_DEDUCED_TYPENAME pointee::type, + single_pass_traversal_tag, + BOOST_DEDUCED_TYPENAME pointee::type + > super_t; + + typedef unescape this_t; + typedef BOOST_DEDUCED_TYPENAME super_t::reference reference_type; +public: + // gcc 3.4.1 - linux required that this be public + typedef BOOST_DEDUCED_TYPENAME super_t::value_type value_type; +private: + + reference_type dereference_impl() { + if(! m_full){ + m_current_value = static_cast(this)->drain(); + m_full = true; + } + return m_current_value; + } + + reference_type dereference() const { + return const_cast(this)->dereference_impl(); + } + + // value_type is const char - can't be const fix later + value_type m_current_value; + bool m_full; + + void increment(){ + ++(this->base_reference()); + dereference_impl(); + m_full = false; + }; + +public: + + unescape(Base base) : + super_t(base), + m_full(false) + {} + +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/wchar_from_mb.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/wchar_from_mb.hpp new file mode 100644 index 0000000000..18f06225f9 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/wchar_from_mb.hpp @@ -0,0 +1,129 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP +#define BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_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 +// wchar_from_mb.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include // size_t +#include // mblen + +#include // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::mblen; + using ::mbtowc; +} // namespace std +#endif + +#include +#include + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate char strings to wchar_t +// strings of the currently selected locale +template +class wchar_from_mb + : public boost::iterator_adaptor< + wchar_from_mb, + Base, + wchar_t, + single_pass_traversal_tag, + wchar_t + > +{ + friend class boost::iterator_core_access; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + wchar_from_mb, + Base, + wchar_t, + single_pass_traversal_tag, + wchar_t + > super_t; + + typedef wchar_from_mb this_t; + + wchar_t drain(); + + wchar_t dereference_impl() { + if(! m_full){ + m_current_value = drain(); + m_full = true; + } + return m_current_value; + } + + wchar_t dereference() const { + return const_cast(this)->dereference_impl(); + } + + void increment(){ + dereference_impl(); + m_full = false; + ++(this->base_reference()); + }; + + wchar_t m_current_value; + bool m_full; + +public: + // make composible buy using templated constructor + template + wchar_from_mb(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))), + m_full(false) + {} + // intel 7.1 doesn't like default copy constructor + wchar_from_mb(const wchar_from_mb & rhs) : + super_t(rhs.base_reference()), + m_full(rhs.m_full) + {} +}; + +template +wchar_t wchar_from_mb::drain(){ + char buffer[9]; + char * bptr = buffer; + char val; + for(std::size_t i = 0; i++ < (unsigned)MB_CUR_MAX;){ + val = * this->base_reference(); + *bptr++ = val; + int result = std::mblen(buffer, i); + if(-1 != result) + break; + ++(this->base_reference()); + } + wchar_t retval; + int result = std::mbtowc(& retval, buffer, MB_CUR_MAX); + if(0 >= result) + boost::serialization::throw_exception(iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + )); + return retval; +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/xml_escape.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/xml_escape.hpp new file mode 100644 index 0000000000..8eb87f4246 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/xml_escape.hpp @@ -0,0 +1,125 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_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 +// xml_escape.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include // for BOOST_DEDUCED_TYPENAME +#include + +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert escapes into xml text + +template +class xml_escape + : public escape, Base> +{ + friend class boost::iterator_core_access; + + typedef escape, Base> super_t; + +public: + char fill(const char * & bstart, const char * & bend); + wchar_t fill(const wchar_t * & bstart, const wchar_t * & bend); + + template + xml_escape(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))) + {} + // intel 7.1 doesn't like default copy constructor + xml_escape(const xml_escape & rhs) : + super_t(rhs.base_reference()) + {} +}; + +template +char xml_escape::fill( + const char * & bstart, + const char * & bend +){ + char current_value = * this->base_reference(); + switch(current_value){ + case '<': + bstart = "<"; + bend = bstart + 4; + break; + case '>': + bstart = ">"; + bend = bstart + 4; + break; + case '&': + bstart = "&"; + bend = bstart + 5; + break; + case '"': + bstart = """; + bend = bstart + 6; + break; + case '\'': + bstart = "'"; + bend = bstart + 6; + break; + default: + return current_value; + } + return *bstart; +} + +template +wchar_t xml_escape::fill( + const wchar_t * & bstart, + const wchar_t * & bend +){ + wchar_t current_value = * this->base_reference(); + switch(current_value){ + case '<': + bstart = L"<"; + bend = bstart + 4; + break; + case '>': + bstart = L">"; + bend = bstart + 4; + break; + case '&': + bstart = L"&"; + bend = bstart + 5; + break; + case '"': + bstart = L"""; + bend = bstart + 6; + break; + case '\'': + bstart = L"'"; + bend = bstart + 6; + break; + default: + return current_value; + } + return *bstart; +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/xml_unescape.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/xml_unescape.hpp new file mode 100644 index 0000000000..4272c9786e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/xml_unescape.hpp @@ -0,0 +1,118 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_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 +// xml_unescape.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include // for BOOST_DEDUCED_TYPENAME +#include +#include + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// replace &??? xml escape sequences with the corresponding characters +template +class xml_unescape + : public unescape, Base> +{ + friend class boost::iterator_core_access; + typedef xml_unescape this_t; + typedef unescape super_t; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_reference reference_type; + + reference_type dereference() const { + return unescape, Base>::dereference(); + } +public: + void drain_residue(const char *literal); + int drain(); + + template + xml_unescape(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))) + {} + // intel 7.1 doesn't like default copy constructor + xml_unescape(const xml_unescape & rhs) : + super_t(rhs.base_reference()) + {} +}; + +template +void xml_unescape::drain_residue(const char * literal){ + do{ + if(* literal != * ++(this->base_reference())) + boost::serialization::throw_exception( + dataflow_exception( + dataflow_exception::invalid_xml_escape_sequence + ) + ); + } + while('\0' != * ++literal); +} + +// note key constraint on this function is that can't "look ahead" any +// more than necessary into base iterator. Doing so would alter the base +// iterator refenence which would make subsequent iterator comparisons +// incorrect and thereby break the composiblity of iterators. +template +int xml_unescape::drain(){ + int retval = * this->base_reference(); + if('&' != retval){ + return retval; + } + retval = * ++(this->base_reference()); + switch(retval){ + case 'l': // < + drain_residue("t;"); + retval = '<'; + break; + case 'g': // > + drain_residue("t;"); + retval = '>'; + break; + case 'a': + retval = * ++(this->base_reference()); + switch(retval){ + case 'p': // ' + drain_residue("os;"); + retval = '\''; + break; + case 'm': // & + drain_residue("p;"); + retval = '&'; + break; + } + break; + case 'q': + drain_residue("uot;"); + retval = '"'; + break; + } + return retval; +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/xml_unescape_exception.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/xml_unescape_exception.hpp new file mode 100644 index 0000000000..a141737347 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/iterators/xml_unescape_exception.hpp @@ -0,0 +1,49 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_EXCEPTION_HPP +#define BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_EXCEPTION_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 +// xml_unescape_exception.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifndef BOOST_NO_EXCEPTIONS +#include + +#include + +namespace boost { +namespace archive { +namespace iterators { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by xml_unescapes +// +class xml_unescape_exception : public std::exception +{ +public: + xml_unescape_exception() + {} + + virtual const char *what( ) const throw( ) + { + return "xml contained un-recognized escape code"; + } +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif //BOOST_NO_EXCEPTIONS +#endif //BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_EXCEPTION_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_binary_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_binary_iarchive.hpp new file mode 100644 index 0000000000..c14ad5afd0 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_binary_iarchive.hpp @@ -0,0 +1,45 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_BINARY_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_BINARY_IARCHIVE_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 +// polymorphic_binary_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { + +class polymorphic_binary_iarchive : + public detail::polymorphic_iarchive_route +{ +public: + polymorphic_binary_iarchive(std::istream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route(is, flags) + {} + ~polymorphic_binary_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_binary_iarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_BINARY_IARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_binary_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_binary_oarchive.hpp new file mode 100644 index 0000000000..a66ebddca6 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_binary_oarchive.hpp @@ -0,0 +1,43 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_BINARY_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_BINARY_OARCHIVE_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 +// polymorphic_binary_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { + +typedef detail::polymorphic_oarchive_route< + binary_oarchive_impl< + naked_binary_oarchive, + std::ostream::char_type, + std::ostream::traits_type + > + > polymorphic_binary_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_binary_oarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_BINARY_OARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_iarchive.hpp new file mode 100644 index 0000000000..8506062160 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_iarchive.hpp @@ -0,0 +1,194 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_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 +// polymorphic_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // std::size_t +#include // ULONG_MAX +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include +#include +#include +#include +#include + +#include +#include // must be the last header + +// determine if its necessary to handle (u)int64_t specifically +// i.e. that its not a synonym for (unsigned) long +// if there is no 64 bit int or if its the same as a long +// we shouldn't define separate functions for int64 data types. +#if defined(BOOST_NO_INT64_T) + #define BOOST_NO_INTRINSIC_INT64_T +#else + #if defined(ULLONG_MAX) + #if(ULONG_MAX == 18446744073709551615ul) // 2**64 - 1 + #define BOOST_NO_INTRINSIC_INT64_T + #endif + #elif defined(ULONG_MAX) + #if(ULONG_MAX != 0xffffffff && ULONG_MAX == 18446744073709551615ul) // 2**64 - 1 + #define BOOST_NO_INTRINSIC_INT64_T + #endif + #else + #define BOOST_NO_INTRINSIC_INT64_T + #endif +#endif + +namespace boost { +template +class shared_ptr; +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail { + class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive; + class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive; +} + +class polymorphic_iarchive; + +class polymorphic_iarchive_impl : + public detail::interface_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive; + friend class load_access; +#endif + // primitive types the only ones permitted by polymorphic archives + virtual void load(bool & t) = 0; + + virtual void load(char & t) = 0; + virtual void load(signed char & t) = 0; + virtual void load(unsigned char & t) = 0; + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + virtual void load(wchar_t & t) = 0; + #endif + #endif + virtual void load(short & t) = 0; + virtual void load(unsigned short & t) = 0; + virtual void load(int & t) = 0; + virtual void load(unsigned int & t) = 0; + virtual void load(long & t) = 0; + virtual void load(unsigned long & t) = 0; + + #if !defined(BOOST_NO_INTRINSIC_INT64_T) + virtual void load(boost::int64_t & t) = 0; + virtual void load(boost::uint64_t & t) = 0; + #endif + virtual void load(float & t) = 0; + virtual void load(double & t) = 0; + + // string types are treated as primitives + virtual void load(std::string & t) = 0; + #ifndef BOOST_NO_STD_WSTRING + virtual void load(std::wstring & t) = 0; + #endif + + // used for xml and other tagged formats + virtual void load_start(const char * name) = 0; + virtual void load_end(const char * name) = 0; + virtual void register_basic_serializer(const detail::basic_iserializer & bis) = 0; + + // msvc and borland won't automatically pass these to the base class so + // make it explicit here + template + void load_override(T & t, BOOST_PFTO int) + { + archive::load(* this->This(), t); + } + // special treatment for name-value pairs. + template + void load_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + boost::serialization::nvp & t, + int + ){ + load_start(t.name()); + archive::load(* this->This(), t.value()); + load_end(t.name()); + } +protected: + virtual ~polymorphic_iarchive_impl(){}; +public: + // utility function implemented by all legal archives + virtual void set_library_version(unsigned int archive_library_version) = 0; + virtual unsigned int get_library_version() const = 0; + virtual unsigned int get_flags() const = 0; + virtual void delete_created_pointers() = 0; + virtual void reset_object_address( + const void * new_address, + const void * old_address + ) = 0; + + virtual void load_binary(void * t, std::size_t size) = 0; + + // these are used by the serialization library implementation. + virtual void load_object( + void *t, + const detail::basic_iserializer & bis + ) = 0; + virtual const detail::basic_pointer_iserializer * load_pointer( + void * & t, + const detail::basic_pointer_iserializer * bpis_ptr + ) = 0; +}; + +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include + +namespace boost { +namespace archive { + +class polymorphic_iarchive : + public polymorphic_iarchive_impl, + public detail::shared_ptr_helper +{ +public: + virtual ~polymorphic_iarchive(){}; +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_iarchive) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_oarchive.hpp new file mode 100644 index 0000000000..19aedf5f44 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_oarchive.hpp @@ -0,0 +1,174 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_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 +// polymorphic_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // size_t +#include // ULONG_MAX +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include // must be the last header + +// determine if its necessary to handle (u)int64_t specifically +// i.e. that its not a synonym for (unsigned) long +// if there is no 64 bit int or if its the same as a long +// we shouldn't define separate functions for int64 data types. +#if defined(BOOST_NO_INT64_T) + #define BOOST_NO_INTRINSIC_INT64_T +#else + #if defined(ULLONG_MAX) + #if(ULONG_MAX == 18446744073709551615ul) // 2**64 - 1 + #define BOOST_NO_INTRINSIC_INT64_T + #endif + #elif defined(ULONG_MAX) + #if(ULONG_MAX != 0xffffffff && ULONG_MAX == 18446744073709551615ul) // 2**64 - 1 + #define BOOST_NO_INTRINSIC_INT64_T + #endif + #else + #define BOOST_NO_INTRINSIC_INT64_T + #endif +#endif + +namespace boost { +template +class shared_ptr; +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail { + class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive; + class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer; +} + +class polymorphic_oarchive; + +class polymorphic_oarchive_impl : + public detail::interface_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive; + friend class save_access; +#endif + // primitive types the only ones permitted by polymorphic archives + virtual void save(const bool t) = 0; + + virtual void save(const char t) = 0; + virtual void save(const signed char t) = 0; + virtual void save(const unsigned char t) = 0; + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + virtual void save(const wchar_t t) = 0; + #endif + #endif + virtual void save(const short t) = 0; + virtual void save(const unsigned short t) = 0; + virtual void save(const int t) = 0; + virtual void save(const unsigned int t) = 0; + virtual void save(const long t) = 0; + virtual void save(const unsigned long t) = 0; + #if !defined(BOOST_NO_INTRINSIC_INT64_T) + virtual void save(const boost::int64_t t) = 0; + virtual void save(const boost::uint64_t t) = 0; + #endif + virtual void save(const float t) = 0; + virtual void save(const double t) = 0; + + // string types are treated as primitives + virtual void save(const std::string & t) = 0; + #ifndef BOOST_NO_STD_WSTRING + virtual void save(const std::wstring & t) = 0; + #endif + + virtual void save_null_pointer() = 0; + // used for xml and other tagged formats + virtual void save_start(const char * name) = 0; + virtual void save_end(const char * name) = 0; + virtual void register_basic_serializer(const detail::basic_oserializer & bos) = 0; + + virtual void end_preamble() = 0; + + // msvc and borland won't automatically pass these to the base class so + // make it explicit here + template + void save_override(T & t, BOOST_PFTO int) + { + archive::save(* this->This(), t); + } + // special treatment for name-value pairs. + template + void save_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + ::boost::serialization::nvp & t, int + ){ + save_start(t.name()); + archive::save(* this->This(), t.const_value()); + save_end(t.name()); + } +protected: + virtual ~polymorphic_oarchive_impl(){}; +public: + // utility functions implemented by all legal archives + virtual unsigned int get_flags() const = 0; + virtual unsigned int get_library_version() const = 0; + virtual void save_binary(const void * t, std::size_t size) = 0; + + virtual void save_object( + const void *x, + const detail::basic_oserializer & bos + ) = 0; + virtual void save_pointer( + const void * t, + const detail::basic_pointer_oserializer * bpos_ptr + ) = 0; +}; + +// note: preserve naming symmetry +class polymorphic_oarchive : + public polymorphic_oarchive_impl +{ +public: + virtual ~polymorphic_oarchive(){}; +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_oarchive) + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_iarchive.hpp new file mode 100644 index 0000000000..9dbc6c471d --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_iarchive.hpp @@ -0,0 +1,45 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_IARCHIVE_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 +// polymorphic_text_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { + +class polymorphic_text_iarchive : + public detail::polymorphic_iarchive_route +{ +public: + polymorphic_text_iarchive(std::istream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route(is, flags) + {} + ~polymorphic_text_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_iarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_IARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_oarchive.hpp new file mode 100644 index 0000000000..82b48924f9 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_oarchive.hpp @@ -0,0 +1,39 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_OARCHIVE_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 +// polymorphic_text_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { + +typedef detail::polymorphic_oarchive_route< + text_oarchive_impl +> polymorphic_text_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_oarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_OARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_wiarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_wiarchive.hpp new file mode 100644 index 0000000000..a04283ac3b --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_wiarchive.hpp @@ -0,0 +1,50 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_WIARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_WIARCHIVE_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 +// polymorphic_text_wiarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include + +namespace boost { +namespace archive { + +class polymorphic_text_wiarchive : + public detail::polymorphic_iarchive_route +{ +public: + polymorphic_text_wiarchive(std::wistream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route(is, flags) + {} + ~polymorphic_text_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_wiarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_WIARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_woarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_woarchive.hpp new file mode 100644 index 0000000000..bc44947416 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_text_woarchive.hpp @@ -0,0 +1,44 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_WOARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_WOARCHIVE_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 +// polymorphic_text_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include + +namespace boost { +namespace archive { + +typedef detail::polymorphic_oarchive_route< + text_woarchive_impl +> polymorphic_text_woarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_woarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_WOARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_iarchive.hpp new file mode 100644 index 0000000000..bcd7254c72 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_iarchive.hpp @@ -0,0 +1,45 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_IARCHIVE_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 +// polymorphic_xml_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { + +class polymorphic_xml_iarchive : + public detail::polymorphic_iarchive_route +{ +public: + polymorphic_xml_iarchive(std::istream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route(is, flags) + {} + ~polymorphic_xml_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_iarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_IARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_oarchive.hpp new file mode 100644 index 0000000000..8576694288 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_oarchive.hpp @@ -0,0 +1,39 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_OARCHIVE_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 +// polymorphic_xml_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { + +typedef detail::polymorphic_oarchive_route< + xml_oarchive_impl +> polymorphic_xml_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_oarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_OARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_wiarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_wiarchive.hpp new file mode 100644 index 0000000000..b3f7db2582 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_wiarchive.hpp @@ -0,0 +1,50 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_WIARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_WIARCHIVE_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 +// polymorphic_xml_wiarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include + +namespace boost { +namespace archive { + +class polymorphic_xml_wiarchive : + public detail::polymorphic_iarchive_route +{ +public: + polymorphic_xml_wiarchive(std::wistream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route(is, flags) + {} + ~polymorphic_xml_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_wiarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_WIARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_woarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_woarchive.hpp new file mode 100644 index 0000000000..8884b43c75 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/polymorphic_xml_woarchive.hpp @@ -0,0 +1,44 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_WOARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_WOARCHIVE_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 +// polymorphic_xml_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include + +namespace boost { +namespace archive { + +typedef detail::polymorphic_oarchive_route< + xml_woarchive_impl +> polymorphic_xml_woarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_woarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_WOARCHIVE_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/shared_ptr_helper.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/shared_ptr_helper.hpp new file mode 100644 index 0000000000..b54c654437 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/shared_ptr_helper.hpp @@ -0,0 +1,187 @@ +#ifndef BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP +#define BOOST_ARCHIVE_SHARED_PTR_HELPER_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 +// shared_ptr_helper.hpp: serialization for boost shared pointer + +// (C) Copyright 2004-2009 Robert Ramey, Martin Ecker and Takatoshi Kondo +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include +#include // NULL + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include // must be the last header + +namespace boost_132 { + template class shared_ptr; +} +namespace boost { + template class shared_ptr; + namespace serialization { + class extended_type_info; + template + inline void load( + Archive & ar, + boost::shared_ptr &t, + const unsigned int file_version + ); + } +namespace archive{ +namespace detail { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// a common class for holding various types of shared pointers + +class shared_ptr_helper { + typedef std::map< + void *, + boost::shared_ptr + > collection_type; + typedef collection_type::const_iterator iterator_type; + // list of shared_pointers create accessable by raw pointer. This + // is used to "match up" shared pointers loaded at different + // points in the archive. Note, we delay construction until + // it is actually used since this is by default included as + // a "mix-in" even if shared_ptr isn't used. + collection_type * m_pointers; + + struct null_deleter { + void operator()(void const *) const {} + }; + +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + template + friend inline void boost::serialization::load( + Archive & ar, + boost::shared_ptr &t, + const unsigned int file_version + ); +#endif + +// #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP + // list of loaded pointers. This is used to be sure that the pointers + // stay around long enough to be "matched" with other pointers loaded + // by the same archive. These are created with a "null_deleter" so that + // when this list is destroyed - the underlaying raw pointers are not + // destroyed. This has to be done because the pointers are also held by + // new system which is disjoint from this set. This is implemented + // by a change in load_construct_data below. It makes this file suitable + // only for loading pointers into a 1.33 or later boost system. + std::list > * m_pointers_132; +// #endif + + typedef std::pair result_type; + + // returns pointer to object and an indicator whether this is a + // new entry (true) or a previous one (false) + BOOST_ARCHIVE_DECL(result_type) get_od( + void * od, + const boost::serialization::extended_type_info * true_type, + const boost::serialization::extended_type_info * this_type + ); + + template + struct non_polymorphic { + static const boost::serialization::extended_type_info * + get_object_identifier(T & t){ + return boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation::type + >::get_const_instance(); + } + }; + template + struct polymorphic { + static const boost::serialization::extended_type_info * + get_object_identifier(T & t){ + return boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation::type + >::get_const_instance().get_derived_extended_type_info(t); + } + }; +public: + template + void reset(shared_ptr & s, T * t){ + if(NULL == t){ + s.reset(); + return; + } + const boost::serialization::extended_type_info * this_type + = & boost::serialization::type_info_implementation::type + ::get_const_instance(); + + // get pointer to the most derived object. This is effectively + // the object identifer + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_polymorphic, + mpl::identity >, + mpl::identity > + >::type type; + + const boost::serialization::extended_type_info * true_type + = type::get_object_identifier(*t); + + // note:if this exception is thrown, be sure that derived pointer + // is either registered or exported. + if(NULL == true_type) + boost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_class, + this_type->get_debug_info() + ) + ); + result_type r = + get_od( + t, + true_type, + this_type + ); + s = shared_ptr( + r.first->second, + static_cast(r.second) + ); + } + +// #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP + BOOST_ARCHIVE_DECL(void) + append(const boost_132::shared_ptr & t); +// #endif +public: + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + shared_ptr_helper(); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + ~shared_ptr_helper(); +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/text_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/text_iarchive.hpp new file mode 100644 index 0000000000..3b1a99d147 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/text_iarchive.hpp @@ -0,0 +1,126 @@ +#ifndef BOOST_ARCHIVE_TEXT_IARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_IARCHIVE_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 +// text_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +template +class text_iarchive_impl : + public basic_text_iprimitive, + public basic_text_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive; + friend class basic_text_iarchive; + friend class load_access; +protected: +#endif + template + void load(T & t){ + basic_text_iprimitive::load(t); + } + BOOST_ARCHIVE_DECL(void) + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL(void) + load(wchar_t * t); + #endif + BOOST_ARCHIVE_DECL(void) + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL(void) + load(std::wstring &ws); + #endif + // note: the following should not needed - but one compiler (vc 7.1) + // fails to compile one test (test_shared_ptr) without it !!! + // make this protected so it can be called from a derived archive + template + void load_override(T & t, BOOST_PFTO int){ + basic_text_iarchive::load_override(t, 0); + } + BOOST_ARCHIVE_DECL(void) + load_override(class_name_type & t, int); + BOOST_ARCHIVE_DECL(void) + init(); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + text_iarchive_impl(std::istream & is, unsigned int flags); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + ~text_iarchive_impl(){}; +}; + +// do not derive from the classes below. If you want to extend this functionality +// via inhertance, derived from text_iarchive_impl instead. This will +// preserve correct static polymorphism. + +// same as text_iarchive below - without the shared_ptr_helper +class naked_text_iarchive : + public text_iarchive_impl +{ +public: + naked_text_iarchive(std::istream & is_, unsigned int flags = 0) : + // note: added _ to suppress useless gcc warning + text_iarchive_impl(is_, flags) + {} + ~naked_text_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include + +namespace boost { +namespace archive { + +class text_iarchive : + public text_iarchive_impl, + public detail::shared_ptr_helper +{ +public: + text_iarchive(std::istream & is_, unsigned int flags = 0) : + // note: added _ to suppress useless gcc warning + text_iarchive_impl(is_, flags) + {} + ~text_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_iarchive) + +#endif // BOOST_ARCHIVE_TEXT_IARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/text_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/text_oarchive.hpp new file mode 100644 index 0000000000..5268752ec0 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/text_oarchive.hpp @@ -0,0 +1,103 @@ +#ifndef BOOST_ARCHIVE_TEXT_OARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_OARCHIVE_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 +// text_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // std::size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +template +class text_oarchive_impl : + /* protected ? */ public basic_text_oprimitive, + public basic_text_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive; + friend class basic_text_oarchive; + friend class save_access; +protected: +#endif + template + void save(const T & t){ + this->newtoken(); + basic_text_oprimitive::save(t); + } + BOOST_ARCHIVE_DECL(void) + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL(void) + save(const wchar_t * t); + #endif + BOOST_ARCHIVE_DECL(void) + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL(void) + save(const std::wstring &ws); + #endif + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + text_oarchive_impl(std::ostream & os, unsigned int flags); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + ~text_oarchive_impl(){}; +public: + BOOST_ARCHIVE_DECL(void) + save_binary(const void *address, std::size_t count); +}; + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from text_oarchive_impl instead. This will +// preserve correct static polymorphism. +class text_oarchive : + public text_oarchive_impl +{ +public: + + text_oarchive(std::ostream & os_, unsigned int flags = 0) : + // note: added _ to suppress useless gcc warning + text_oarchive_impl(os_, flags) + {} + ~text_oarchive(){} +}; + +typedef text_oarchive naked_text_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_oarchive) + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_TEXT_OARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/text_wiarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/text_wiarchive.hpp new file mode 100644 index 0000000000..82d9a71a4c --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/text_wiarchive.hpp @@ -0,0 +1,123 @@ +#ifndef BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_WIARCHIVE_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 +// text_wiarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include + +#include +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +template +class text_wiarchive_impl : + public basic_text_iprimitive, + public basic_text_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive; + friend class basic_text_iarchive; + friend class load_access; +protected: +#endif + template + void load(T & t){ + basic_text_iprimitive::load(t); + } + BOOST_WARCHIVE_DECL(void) + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL(void) + load(wchar_t * t); + #endif + BOOST_WARCHIVE_DECL(void) + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL(void) + load(std::wstring &ws); + #endif + // note: the following should not needed - but one compiler (vc 7.1) + // fails to compile one test (test_shared_ptr) without it !!! + template + void load_override(T & t, BOOST_PFTO int){ + basic_text_iarchive::load_override(t, 0); + } + BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) + text_wiarchive_impl(std::wistream & is, unsigned int flags); + ~text_wiarchive_impl(){}; +}; + +// do not derive from the classes below. If you want to extend this functionality +// via inhertance, derived from text_iarchive_impl instead. This will +// preserve correct static polymorphism. + +// same as text_wiarchive below - without the shared_ptr_helper +class naked_text_wiarchive : + public text_wiarchive_impl +{ +public: + naked_text_wiarchive(std::wistream & is, unsigned int flags = 0) : + text_wiarchive_impl(is, flags) + {} + ~naked_text_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include + +namespace boost { +namespace archive { + +class text_wiarchive : + public text_wiarchive_impl, + public detail::shared_ptr_helper +{ +public: + text_wiarchive(std::wistream & is, unsigned int flags = 0) : + text_wiarchive_impl(is, flags) + {} + ~text_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_wiarchive) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/text_woarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/text_woarchive.hpp new file mode 100644 index 0000000000..79d374216e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/text_woarchive.hpp @@ -0,0 +1,129 @@ +#ifndef BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_WOARCHIVE_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 +// text_woarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include // size_t + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +template +class text_woarchive_impl : + public basic_text_oprimitive, + public basic_text_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive; + friend class basic_text_oarchive; + friend class save_access; +protected: +#endif + template + void save(const T & t){ + this->newtoken(); + basic_text_oprimitive::save(t); + } + BOOST_WARCHIVE_DECL(void) + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL(void) + save(const wchar_t * t); + #endif + BOOST_WARCHIVE_DECL(void) + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL(void) + save(const std::wstring &ws); + #endif + text_woarchive_impl(std::wostream & os, unsigned int flags) : + basic_text_oprimitive( + os, + 0 != (flags & no_codecvt) + ), + basic_text_oarchive(flags) + { + if(0 == (flags & no_header)) + basic_text_oarchive::init(); + } +public: + void save_binary(const void *address, std::size_t count){ + put(L'\n'); + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + put(L'\n'); + this->delimiter = this->none; + } + +}; + +// we use the following because we can't use +// typedef text_oarchive_impl > text_oarchive; + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from text_oarchive_impl instead. This will +// preserve correct static polymorphism. +class text_woarchive : + public text_woarchive_impl +{ +public: + text_woarchive(std::wostream & os, unsigned int flags = 0) : + text_woarchive_impl(os, flags) + {} + ~text_woarchive(){} +}; + +typedef text_woarchive naked_text_woarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_woarchive) + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/tmpdir.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/tmpdir.hpp new file mode 100644 index 0000000000..f962e1160b --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/tmpdir.hpp @@ -0,0 +1,50 @@ +#ifndef BOOST_ARCHIVE_TMPDIR_HPP +#define BOOST_ARCHIVE_TMPDIR_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 +// tmpdir.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // getenv +#include // NULL +//#include + +#include +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std { + using ::getenv; +} +#endif + +namespace boost { +namespace archive { + +inline const char * tmpdir(){ + const char *dirname; + dirname = std::getenv("TMP"); + if(NULL == dirname) + dirname = std::getenv("TMPDIR"); + if(NULL == dirname) + dirname = std::getenv("TEMP"); + if(NULL == dirname){ + //assert(false); // no temp directory found + dirname = "."; + } + return dirname; +} + +} // archive +} // boost + +#endif // BOOST_ARCHIVE_TMPDIR_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/wcslen.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/wcslen.hpp new file mode 100644 index 0000000000..5c14acfff3 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/wcslen.hpp @@ -0,0 +1,56 @@ +#ifndef BOOST_ARCHIVE_WCSLEN_HPP +#define BOOST_ARCHIVE_WCSLEN_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 +// wcslen.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // size_t +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR + +// a couple of libraries which include wchar_t don't include +// wcslen + +#if defined(BOOST_DINKUMWARE_STDLIB) && BOOST_DINKUMWARE_STDLIB < 306 \ +|| defined(__LIBCOMO__) + +namespace std { +inline std::size_t wcslen(const wchar_t * ws) +{ + const wchar_t * eows = ws; + while(* eows != 0) + ++eows; + return eows - ws; +} +} // namespace std + +#else + +#include +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif + +#endif // wcslen + +#endif //BOOST_NO_CWCHAR + +#endif //BOOST_ARCHIVE_WCSLEN_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_archive_exception.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_archive_exception.hpp new file mode 100644 index 0000000000..741c468686 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_archive_exception.hpp @@ -0,0 +1,55 @@ +#ifndef BOOST_ARCHIVE_XML_ARCHIVE_EXCEPTION_HPP +#define BOOST_ARCHIVE_XML_ARCHIVE_EXCEPTION_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 +// xml_archive_exception.hpp: + +// (C) Copyright 2007 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include + +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by xml archives +// +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) xml_archive_exception : + public virtual archive_exception +{ +public: + typedef enum { + xml_archive_parsing_error, // see save_register + xml_archive_tag_mismatch, + xml_archive_tag_name_error + } exception_code; + xml_archive_exception( + exception_code c, + const char * e1 = NULL, + const char * e2 = NULL + ); +}; + +}// namespace archive +}// namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_XML_ARCHIVE_ARCHIVE_EXCEPTION_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_iarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_iarchive.hpp new file mode 100644 index 0000000000..a3bc9f5587 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_iarchive.hpp @@ -0,0 +1,133 @@ +#ifndef BOOST_ARCHIVE_XML_IARCHIVE_HPP +#define BOOST_ARCHIVE_XML_IARCHIVE_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 +// xml_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +//#include +#include +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +template +class basic_xml_grammar; +typedef basic_xml_grammar xml_grammar; + +template +class xml_iarchive_impl : + public basic_text_iprimitive, + public basic_xml_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive; + friend class basic_xml_iarchive; + friend class load_access; +protected: +#endif + // instances of micro xml parser to parse start preambles + // scoped_ptr doesn't play nice with borland - so use a naked pointer + // scoped_ptr gimpl; + xml_grammar *gimpl; + + std::istream & get_is(){ + return is; + } + template + void load(T & t){ + basic_text_iprimitive::load(t); + } + BOOST_ARCHIVE_DECL(void) + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL(void) + load(wchar_t * t); + #endif + BOOST_ARCHIVE_DECL(void) + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL(void) + load(std::wstring &ws); + #endif + template + void load_override(T & t, BOOST_PFTO int){ + basic_xml_iarchive::load_override(t, 0); + } + BOOST_ARCHIVE_DECL(void) + load_override(class_name_type & t, int); + BOOST_ARCHIVE_DECL(void) + init(); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + xml_iarchive_impl(std::istream & is, unsigned int flags); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + ~xml_iarchive_impl(); +}; + +// do not derive from the classes below. If you want to extend this functionality +// via inhertance, derived from text_iarchive_impl instead. This will +// preserve correct static polymorphism. + +// same as xml_iarchive below - without the shared_ptr_helper +class naked_xml_iarchive : + public xml_iarchive_impl +{ +public: + naked_xml_iarchive(std::istream & is, unsigned int flags = 0) : + xml_iarchive_impl(is, flags) + {} + ~naked_xml_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include + +namespace boost { +namespace archive { + +class xml_iarchive : + public xml_iarchive_impl, + public detail::shared_ptr_helper +{ +public: + xml_iarchive(std::istream & is, unsigned int flags = 0) : + xml_iarchive_impl(is, flags) + {} + ~xml_iarchive(){}; +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_iarchive) + +#endif // BOOST_ARCHIVE_XML_IARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_oarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_oarchive.hpp new file mode 100644 index 0000000000..790b7398a8 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_oarchive.hpp @@ -0,0 +1,115 @@ +#ifndef BOOST_ARCHIVE_XML_OARCHIVE_HPP +#define BOOST_ARCHIVE_XML_OARCHIVE_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 +// xml_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include // size_t +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +template +class xml_oarchive_impl : + public basic_text_oprimitive, + public basic_xml_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive; + friend class basic_xml_oarchive; + friend class save_access; +protected: +#endif + //void end_preamble(){ + // basic_xml_oarchive::end_preamble(); + //} + template + void save(const T & t){ + basic_text_oprimitive::save(t); + } + BOOST_ARCHIVE_DECL(void) + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL(void) + save(const wchar_t * t); + #endif + BOOST_ARCHIVE_DECL(void) + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL(void) + save(const std::wstring &ws); + #endif + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + xml_oarchive_impl(std::ostream & os, unsigned int flags); + ~xml_oarchive_impl(){} +public: + void save_binary(const void *address, std::size_t count){ + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->indent_next = true; + } +}; + +// we use the following because we can't use +// typedef xml_oarchive_impl > xml_oarchive; + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from xml_oarchive_impl instead. This will +// preserve correct static polymorphism. +class xml_oarchive : + public xml_oarchive_impl +{ +public: + xml_oarchive(std::ostream & os, unsigned int flags = 0) : + xml_oarchive_impl(os, flags) + {} + ~xml_oarchive(){} +}; + +typedef xml_oarchive naked_xml_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_oarchive) + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_wiarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_wiarchive.hpp new file mode 100644 index 0000000000..3675741241 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_wiarchive.hpp @@ -0,0 +1,138 @@ +#ifndef BOOST_ARCHIVE_XML_WIARCHIVE_HPP +#define BOOST_ARCHIVE_XML_WIARCHIVE_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 +// xml_wiarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include + +//#include +#include +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +template +class basic_xml_grammar; +typedef basic_xml_grammar xml_wgrammar; + +template +class xml_wiarchive_impl : + public basic_text_iprimitive, + public basic_xml_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive; + friend class basic_xml_iarchive; + friend class load_access; +protected: +#endif + // instances of micro xml parser to parse start preambles + // scoped_ptr doesn't play nice with borland - so use a naked pointer + // scoped_ptr gimpl; + xml_wgrammar *gimpl; + std::wistream & get_is(){ + return is; + } + template + void load(T & t){ + basic_text_iprimitive::load(t); + } + BOOST_WARCHIVE_DECL(void) + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL(void) + load(wchar_t * t); + #endif + BOOST_WARCHIVE_DECL(void) + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL(void) + load(std::wstring &ws); + #endif + template + void load_override(T & t, BOOST_PFTO int){ + basic_xml_iarchive::load_override(t, 0); + } + BOOST_WARCHIVE_DECL(void) + load_override(class_name_type & t, int); + BOOST_WARCHIVE_DECL(void) + init(); + BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) + xml_wiarchive_impl(std::wistream & is, unsigned int flags) ; + BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~xml_wiarchive_impl(); +}; + +// do not derive from the classes below. If you want to extend this functionality +// via inhertance, derived from xml_wiarchive_impl instead. This will +// preserve correct static polymorphism. + +// same as xml_wiarchive below - without the shared_ptr_helper +class naked_xml_wiarchive : + public xml_wiarchive_impl +{ +public: + naked_xml_wiarchive(std::wistream & is, unsigned int flags = 0) : + xml_wiarchive_impl(is, flags) + {} + ~naked_xml_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include + +namespace boost { +namespace archive { + +class xml_wiarchive : + public xml_wiarchive_impl, + public detail::shared_ptr_helper +{ +public: + xml_wiarchive(std::wistream & is, unsigned int flags = 0) : + xml_wiarchive_impl(is, flags) + {} + ~xml_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_wiarchive) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_woarchive.hpp b/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_woarchive.hpp new file mode 100644 index 0000000000..e396143c9e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/archive/xml_woarchive.hpp @@ -0,0 +1,130 @@ +#ifndef BOOST_ARCHIVE_XML_WOARCHIVE_HPP +#define BOOST_ARCHIVE_XML_WOARCHIVE_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 +// xml_woarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include // size_t +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +#if 0 +BOOST_WARCHIVE_DECL(std::wostream &) +operator<<(std::wostream &os, const char *t); + +BOOST_WARCHIVE_DECL(std::wostream &) +operator<<(std::wostream &os, const char t); +#endif + +template +class xml_woarchive_impl : + public basic_text_oprimitive, + public basic_xml_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive; + friend class basic_xml_oarchive; + friend class save_access; +protected: +#endif + //void end_preamble(){ + // basic_xml_oarchive::end_preamble(); + //} + template + void + save(const T & t){ + basic_text_oprimitive::save(t); + } + BOOST_WARCHIVE_DECL(void) + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL(void) + save(const wchar_t * t); + #endif + BOOST_WARCHIVE_DECL(void) + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL(void) + save(const std::wstring &ws); + #endif + BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) + xml_woarchive_impl(std::wostream & os, unsigned int flags); + ~xml_woarchive_impl(){} +public: + void + save_binary(const void *address, std::size_t count){ + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->indent_next = true; + } +}; + +// we use the following because we can't use +// typedef xml_woarchive_impl > xml_woarchive; + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from xml_woarchive_impl instead. This will +// preserve correct static polymorphism. +class xml_woarchive : + public xml_woarchive_impl +{ +public: + xml_woarchive(std::wostream & os, unsigned int flags = 0) : + xml_woarchive_impl(os, flags) + {} + ~xml_woarchive(){} +}; + +typedef xml_woarchive naked_xml_woarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_woarchive) + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP diff --git a/deal.II/contrib/boost/include/boost/array.hpp b/deal.II/contrib/boost-1.41.0/include/boost/array.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/array.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/array.hpp index 52218aac51..8ef73c4250 100644 --- a/deal.II/contrib/boost/include/boost/array.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/array.hpp @@ -27,6 +27,7 @@ #include #include #include +#include // Handles broken standard libraries better than #include @@ -131,7 +132,8 @@ namespace boost { // swap (note: linear complexity) void swap (array& y) { - std::swap_ranges(begin(),end(),y.begin()); + for (size_type i = 0; i < N; ++i) + boost::swap(elems[i],y.elems[i]); } // direct access to data (read-only) @@ -209,19 +211,19 @@ namespace boost { } // operator[] - reference operator[](size_type i) + reference operator[](size_type /*i*/) { return failed_rangecheck(); } - const_reference operator[](size_type i) const + 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(); } + reference at(size_type /*i*/) { return failed_rangecheck(); } + const_reference at(size_type /*i*/) const { return failed_rangecheck(); } // front() and back() reference front() @@ -250,7 +252,7 @@ namespace boost { static size_type max_size() { return 0; } enum { static_size = 0 }; - void swap (array& y) { + void swap (array& /*y*/) { } // direct access to data (read-only) diff --git a/deal.II/contrib/boost/include/boost/asio.hpp b/deal.II/contrib/boost-1.41.0/include/boost/asio.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/asio.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/asio.hpp diff --git a/deal.II/contrib/boost/include/boost/assert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/assert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/assert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/assert.hpp diff --git a/deal.II/contrib/boost/include/boost/assign.hpp b/deal.II/contrib/boost-1.41.0/include/boost/assign.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/assign.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/assign.hpp diff --git a/deal.II/contrib/boost/include/boost/bimap.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bimap.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bimap.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bimap.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/bind.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind.hpp new file mode 100644 index 0000000000..fd3421ea5a --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/bind.hpp @@ -0,0 +1,24 @@ +#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) 2009 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 + +#endif // #ifndef BOOST_BIND_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/bind/apply.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/apply.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bind/apply.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/apply.hpp diff --git a/deal.II/contrib/boost/include/boost/bind/arg.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/arg.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bind/arg.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/arg.hpp diff --git a/deal.II/contrib/boost/include/boost/bind.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/bind.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/bind.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/bind.hpp index 07b84d377a..1e5c9e0324 100644 --- a/deal.II/contrib/boost/include/boost/bind.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/bind/bind.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_BIND_HPP_INCLUDED -#define BOOST_BIND_HPP_INCLUDED +#ifndef BOOST_BIND_BIND_HPP_INCLUDED +#define BOOST_BIND_BIND_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -48,6 +48,8 @@ namespace boost { +template class weak_ptr; + namespace _bi // implementation details { @@ -100,6 +102,11 @@ template bool ref_compare( reference_wrapper const & a, reference_wr template class bind_t; +template bool ref_compare( bind_t const & a, bind_t const & b, int ) +{ + return a.compare( b ); +} + // value template class value @@ -121,6 +128,13 @@ private: T t_; }; +// ref_compare for weak_ptr + +template bool ref_compare( value< weak_ptr > const & a, value< weak_ptr > const & b, int ) +{ + return !(a.get() < b.get()) && !(b.get() < a.get()); +} + // type template class type {}; @@ -1615,7 +1629,7 @@ template _bi::bind_t< R, _mfi::dm, typename _bi::list_av_1::type > @@ -1716,4 +1730,4 @@ BOOST_BIND( M T::*f, A1 a1 ) # pragma warning(pop) #endif -#endif // #ifndef BOOST_BIND_HPP_INCLUDED +#endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/bind/bind_cc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/bind_cc.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bind/bind_cc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/bind_cc.hpp diff --git a/deal.II/contrib/boost/include/boost/bind/bind_mf2_cc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/bind_mf2_cc.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bind/bind_mf2_cc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/bind_mf2_cc.hpp diff --git a/deal.II/contrib/boost/include/boost/bind/bind_mf_cc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/bind_mf_cc.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bind/bind_mf_cc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/bind_mf_cc.hpp diff --git a/deal.II/contrib/boost/include/boost/bind/bind_template.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/bind_template.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bind/bind_template.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/bind_template.hpp diff --git a/deal.II/contrib/boost/include/boost/bind/make_adaptable.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/make_adaptable.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bind/make_adaptable.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/make_adaptable.hpp diff --git a/deal.II/contrib/boost/include/boost/mem_fn.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/mem_fn.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/mem_fn.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/mem_fn.hpp index 9695f57e80..956e7d8885 100644 --- a/deal.II/contrib/boost/include/boost/mem_fn.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/bind/mem_fn.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_MEM_FN_HPP_INCLUDED -#define BOOST_MEM_FN_HPP_INCLUDED +#ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED +#define BOOST_BIND_MEM_FN_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -386,4 +386,4 @@ template _mfi::dm mem_fn(R T::*f) } // namespace boost -#endif // #ifndef BOOST_MEM_FN_HPP_INCLUDED +#endif // #ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/bind/mem_fn_cc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/mem_fn_cc.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bind/mem_fn_cc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/mem_fn_cc.hpp diff --git a/deal.II/contrib/boost/include/boost/bind/mem_fn_template.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/mem_fn_template.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bind/mem_fn_template.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/mem_fn_template.hpp diff --git a/deal.II/contrib/boost/include/boost/bind/mem_fn_vw.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/mem_fn_vw.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bind/mem_fn_vw.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/mem_fn_vw.hpp diff --git a/deal.II/contrib/boost/include/boost/bind/placeholders.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/placeholders.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/bind/placeholders.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/placeholders.hpp index 43baee6bde..37d01db133 100644 --- a/deal.II/contrib/boost/include/boost/bind/placeholders.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/bind/placeholders.hpp @@ -25,7 +25,7 @@ namespace { -#if defined(__BORLANDC__) || defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ <= 400) +#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>(); } @@ -37,7 +37,8 @@ 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__) +#elif defined(BOOST_MSVC) || (defined(__DECCXX_VER) && __DECCXX_VER <= 60590031) || defined(__MWERKS__) || \ + defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ == 400) static boost::arg<1> _1; static boost::arg<2> _2; diff --git a/deal.II/contrib/boost-1.41.0/include/boost/bind/protect.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/protect.hpp new file mode 100644 index 0000000000..749e158c34 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/bind/protect.hpp @@ -0,0 +1,304 @@ +#ifndef BOOST_BIND_PROTECT_HPP_INCLUDED +#define BOOST_BIND_PROTECT_HPP_INCLUDED + +// +// protect.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2009 Steven Watanabe +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +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); + } + + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(const A1 & a1) + { + return f_(a1); + } + + template result_type operator()(const A1 & a1) const + { + return f_(a1); + } + +#endif + + 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); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 & a2) + { + return f_(a1, a2); + } + + template result_type operator()(A1 const & a1, A2 & a2) const + { + return f_(a1, a2); + } + + template result_type operator()(A1 & a1, A2 const & a2) + { + return f_(a1, a2); + } + + template result_type operator()(A1 & a1, A2 const & a2) const + { + return f_(a1, a2); + } + + template result_type operator()(A1 const & a1, A2 const & a2) + { + return f_(a1, a2); + } + + template result_type operator()(A1 const & a1, A2 const & a2) const + { + return f_(a1, a2); + } + +#endif + + 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); + } + +#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) + { + return f_(a1, a2, a3); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const + { + return f_(a1, a2, a3); + } + +#endif + + 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); + } + +#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) + { + return f_(a1, a2, a3, a4); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const + { + return f_(a1, a2, a3, a4); + } + +#endif + + 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); + } + +#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) + { + return f_(a1, a2, a3, a4, a5); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const + { + return f_(a1, a2, a3, a4, a5); + } + +#endif + + 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); + } + +#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) + { + return f_(a1, a2, a3, a4, a5, a6); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const + { + return f_(a1, a2, a3, a4, a5, a6); + } + +#endif + + 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); + } + +#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) + { + return f_(a1, a2, a3, a4, a5, a6, a7); + } + + 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 + { + return f_(a1, a2, a3, a4, a5, a6, a7); + } + +#endif + + 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); + } + +#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) + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8); + } + + 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 + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8); + } + +#endif + + 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); + } + +#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) + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + 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 + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + +#endif + +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/bind/storage.hpp b/deal.II/contrib/boost-1.41.0/include/boost/bind/storage.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/bind/storage.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/bind/storage.hpp diff --git a/deal.II/contrib/boost/include/boost/blank.hpp b/deal.II/contrib/boost-1.41.0/include/boost/blank.hpp similarity index 93% rename from deal.II/contrib/boost/include/boost/blank.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/blank.hpp index f84f2d9ea0..d0fe5abca5 100644 --- a/deal.II/contrib/boost/include/boost/blank.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/blank.hpp @@ -15,9 +15,11 @@ #include "boost/blank_fwd.hpp" +#if !defined(BOOST_NO_IOSTREAM) #include // for std::basic_ostream forward declare - #include "boost/detail/templated_streams.hpp" +#endif // BOOST_NO_IOSTREAM + #include "boost/mpl/bool.hpp" #include "boost/type_traits/is_empty.hpp" #include "boost/type_traits/is_pod.hpp" @@ -85,6 +87,8 @@ inline bool operator>(const blank&, const blank&) // streaming support // +#if !defined(BOOST_NO_IOSTREAM) + BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<( BOOST_TEMPLATED_STREAM(ostream, E,T)& out @@ -95,6 +99,8 @@ inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<( return out; } +#endif // BOOST_NO_IOSTREAM + } // namespace boost #endif // BOOST_BLANK_HPP diff --git a/deal.II/contrib/boost/include/boost/blank_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/blank_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/blank_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/blank_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/call_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/call_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/call_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/call_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/cast.hpp b/deal.II/contrib/boost-1.41.0/include/boost/cast.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/cast.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/cast.hpp diff --git a/deal.II/contrib/boost/include/boost/cerrno.hpp b/deal.II/contrib/boost-1.41.0/include/boost/cerrno.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/cerrno.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/cerrno.hpp diff --git a/deal.II/contrib/boost/include/boost/checked_delete.hpp b/deal.II/contrib/boost-1.41.0/include/boost/checked_delete.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/checked_delete.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/checked_delete.hpp diff --git a/deal.II/contrib/boost/include/boost/circular_buffer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/circular_buffer.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/circular_buffer.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/circular_buffer.hpp diff --git a/deal.II/contrib/boost/include/boost/circular_buffer_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/circular_buffer_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/circular_buffer_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/circular_buffer_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cassert b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cassert similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cassert rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cassert diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cctype b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cctype similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cctype rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cctype diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cerrno b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cerrno similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cerrno rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cerrno diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cfloat b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cfloat similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cfloat rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cfloat diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/climits b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/climits similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/climits rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/climits diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/clocale b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/clocale similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/clocale rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/clocale diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cmath b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cmath similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cmath rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cmath diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/csetjmp b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/csetjmp similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/csetjmp rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/csetjmp diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/csignal b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/csignal similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/csignal rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/csignal diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cstdarg b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cstdarg similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cstdarg rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cstdarg diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cstddef b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cstddef similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cstddef rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cstddef diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cstdio b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cstdio similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cstdio rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cstdio diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cstdlib b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cstdlib similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cstdlib rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cstdlib diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cstring b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cstring similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cstring rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cstring diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/ctime b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/ctime similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/ctime rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/ctime diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cwchar b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cwchar similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cwchar rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cwchar diff --git a/deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cwctype b/deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cwctype similarity index 100% rename from deal.II/contrib/boost/include/boost/compatibility/cpp_c_headers/cwctype rename to deal.II/contrib/boost-1.41.0/include/boost/compatibility/cpp_c_headers/cwctype diff --git a/deal.II/contrib/boost/include/boost/compressed_pair.hpp b/deal.II/contrib/boost-1.41.0/include/boost/compressed_pair.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/compressed_pair.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/compressed_pair.hpp diff --git a/deal.II/contrib/boost/include/boost/concept/assert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept/assert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept/assert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept/assert.hpp diff --git a/deal.II/contrib/boost/include/boost/concept/detail/borland.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept/detail/borland.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept/detail/borland.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept/detail/borland.hpp diff --git a/deal.II/contrib/boost/include/boost/concept/detail/concept_def.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept/detail/concept_def.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept/detail/concept_def.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept/detail/concept_def.hpp diff --git a/deal.II/contrib/boost/include/boost/concept/detail/concept_undef.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept/detail/concept_undef.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept/detail/concept_undef.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept/detail/concept_undef.hpp diff --git a/deal.II/contrib/boost/include/boost/concept/detail/general.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept/detail/general.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept/detail/general.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept/detail/general.hpp diff --git a/deal.II/contrib/boost/include/boost/concept/detail/has_constraints.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept/detail/has_constraints.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept/detail/has_constraints.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept/detail/has_constraints.hpp diff --git a/deal.II/contrib/boost/include/boost/concept/detail/msvc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept/detail/msvc.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept/detail/msvc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept/detail/msvc.hpp diff --git a/deal.II/contrib/boost/include/boost/concept/requires.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept/requires.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept/requires.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept/requires.hpp diff --git a/deal.II/contrib/boost/include/boost/concept/usage.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept/usage.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept/usage.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept/usage.hpp diff --git a/deal.II/contrib/boost/include/boost/concept_archetype.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept_archetype.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept_archetype.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept_archetype.hpp diff --git a/deal.II/contrib/boost/include/boost/concept_check.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept_check.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/concept_check.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept_check.hpp index 4e9fddfb41..12ec2ad775 100644 --- a/deal.II/contrib/boost/include/boost/concept_check.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/concept_check.hpp @@ -144,6 +144,8 @@ namespace boost void const_constraints(const TT& b) { #if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL a = b; // const required for argument to assignment +#else + ignore_unused_variable_warning(b); #endif } private: @@ -169,6 +171,11 @@ namespace boost TT b; }; +#if (defined _MSC_VER) +# pragma warning( push ) +# pragma warning( disable : 4510 ) // default constructor could not be generated +# pragma warning( disable : 4610 ) // object 'class' can never be instantiated - user-defined constructor required +#endif // The SGI STL version of Assignable requires copy constructor and operator= BOOST_concept(SGIAssignable,(TT)) { @@ -190,6 +197,9 @@ namespace boost } TT a; }; +#if (defined _MSC_VER) +# pragma warning( pop ) +#endif BOOST_concept(Convertible,(X)(Y)) { diff --git a/deal.II/contrib/boost/include/boost/concept_check/borland.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept_check/borland.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept_check/borland.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept_check/borland.hpp diff --git a/deal.II/contrib/boost/include/boost/concept_check/general.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept_check/general.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept_check/general.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept_check/general.hpp diff --git a/deal.II/contrib/boost/include/boost/concept_check/has_constraints.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept_check/has_constraints.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept_check/has_constraints.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept_check/has_constraints.hpp diff --git a/deal.II/contrib/boost/include/boost/concept_check/msvc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/concept_check/msvc.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/concept_check/msvc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/concept_check/msvc.hpp diff --git a/deal.II/contrib/boost/include/boost/config.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config.hpp diff --git a/deal.II/contrib/boost/include/boost/config/abi/borland_prefix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/abi/borland_prefix.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/abi/borland_prefix.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/abi/borland_prefix.hpp diff --git a/deal.II/contrib/boost/include/boost/config/abi/borland_suffix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/abi/borland_suffix.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/abi/borland_suffix.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/abi/borland_suffix.hpp diff --git a/deal.II/contrib/boost/include/boost/config/abi/msvc_prefix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/abi/msvc_prefix.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/abi/msvc_prefix.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/abi/msvc_prefix.hpp diff --git a/deal.II/contrib/boost/include/boost/config/abi/msvc_suffix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/abi/msvc_suffix.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/abi/msvc_suffix.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/abi/msvc_suffix.hpp diff --git a/deal.II/contrib/boost/include/boost/config/abi_prefix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/abi_prefix.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/abi_prefix.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/abi_prefix.hpp diff --git a/deal.II/contrib/boost/include/boost/config/abi_suffix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/abi_suffix.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/abi_suffix.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/abi_suffix.hpp diff --git a/deal.II/contrib/boost/include/boost/config/auto_link.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/auto_link.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/config/auto_link.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/auto_link.hpp index df58d4f926..f2eb583f04 100644 --- a/deal.II/contrib/boost/include/boost/config/auto_link.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/auto_link.hpp @@ -135,11 +135,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. // vc80: # define BOOST_LIB_TOOLSET "vc80" -#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1500) +#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1500) // vc90: # define BOOST_LIB_TOOLSET "vc90" +#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1600) + + // vc10: +# define BOOST_LIB_TOOLSET "vc100" + #elif defined(__BORLANDC__) // CBuilder 6: diff --git a/deal.II/contrib/boost/include/boost/config/compiler/borland.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/borland.hpp similarity index 82% rename from deal.II/contrib/boost/include/boost/config/compiler/borland.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/borland.hpp index d16c06d069..91f064c68e 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/borland.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/borland.hpp @@ -16,9 +16,8 @@ # 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) +// last known compiler version: +#if (__BORLANDC__ > 0x613) //# if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" //# else @@ -108,27 +107,29 @@ # endif #endif -// Borland C++ Builder 2007 December 2007 Update and below: -#if (__BORLANDC__ <= 0x593) +#if (__BORLANDC__ <= 0x613) // Beman has asked Alisdair for more info // 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 +# define BOOST_NO_USING_TEMPLATE +# define BOOST_SP_NO_SP_CONVERTIBLE // 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 +# define BOOST_NO_NESTED_FRIENDSHIP +# define BOOST_NO_TYPENAME_WITH_CTOR +#if (__BORLANDC__ < 0x600) +# define BOOST_ILLEGAL_CV_REFERENCES #endif // @@ -138,26 +139,47 @@ #if (__BORLANDC__ >= 0x599) # pragma defineonoption BOOST_CODEGEAR_0X_SUPPORT -Ax #endif - -#if defined( BOOST_CODEGEAR_0X_SUPPORT ) -# #if __BORLANDC__ >= 0x610 +// +// C++0x Macros: +// +#if !defined( BOOST_CODEGEAR_0X_SUPPORT ) || (__BORLANDC__ < 0x610) +# define BOOST_NO_CHAR16_T +# define BOOST_NO_CHAR32_T +# define BOOST_NO_DECLTYPE +# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_STATIC_ASSERT +#else # 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 +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported +#define BOOST_NO_VARIADIC_TEMPLATES + #if __BORLANDC__ >= 0x590 # define BOOST_HAS_TR1_HASH @@ -169,6 +191,8 @@ #if __BORLANDC__ >= 0x561 # ifndef __NO_LONG_LONG # define BOOST_HAS_LONG_LONG +# else +# define BOOST_NO_LONG_LONG # endif // On non-Win32 platforms let the platform config figure this out: # ifdef _WIN32 @@ -212,7 +236,7 @@ // // ABI fixing headers: // -#if __BORLANDC__ < 0x600 // not implemented for version 6 compiler yet +#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 diff --git a/deal.II/contrib/boost/include/boost/config/compiler/codegear.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/codegear.hpp similarity index 71% rename from deal.II/contrib/boost/include/boost/config/compiler/codegear.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/codegear.hpp index d27817a94e..3915cd54f9 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/codegear.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/codegear.hpp @@ -20,7 +20,7 @@ // // versions check: // last known and checked version is 0x610 -#if (__CODEGEARC__ > 0x610) +#if (__CODEGEARC__ > 0x613) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else @@ -29,7 +29,7 @@ #endif // CodeGear C++ Builder 2009 -#if (__CODEGEARC__ <= 0x610) +#if (__CODEGEARC__ <= 0x613) # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS @@ -42,6 +42,7 @@ # 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 +# define BOOST_SP_NO_SP_CONVERTIBLE // Temporary hack, until specific MPL preprocessed headers are generated # define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS @@ -59,31 +60,55 @@ #endif +// +// C++0x macros: +// +#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_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES -# 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 +// +// TR1 macros: +// +#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 +#define BOOST_HAS_MACRO_USE_FACET +#define BOOST_NO_INITIALIZER_LISTS - // On non-Win32 platforms let the platform config figure this out: -# ifdef _WIN32 -# define BOOST_HAS_STDINT_H -# endif +// On non-Win32 platforms let the platform config figure this out: +#ifdef _WIN32 +# define BOOST_HAS_STDINT_H +#endif // // __int64: diff --git a/deal.II/contrib/boost/include/boost/config/compiler/comeau.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/comeau.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/compiler/comeau.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/comeau.hpp diff --git a/deal.II/contrib/boost/include/boost/config/compiler/common_edg.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/common_edg.hpp similarity index 64% rename from deal.II/contrib/boost/include/boost/config/compiler/common_edg.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/common_edg.hpp index 0443be1aea..9dc4cef8eb 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/common_edg.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/common_edg.hpp @@ -50,8 +50,43 @@ # if !defined(__NO_LONG_LONG) # define BOOST_HAS_LONG_LONG +# else +# define BOOST_NO_LONG_LONG # endif +// +// C++0x features +// +// See above for BOOST_NO_LONG_LONG +// +#if (__EDG_VERSION__ <= 310) || !defined(BOOST_STRICT_CONFIG) +// No support for initializer lists +# define BOOST_NO_INITIALIZER_LISTS +#endif + +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + #ifdef c_plusplus // EDG has "long long" in non-strict mode // However, some libraries have insufficient "long long" support diff --git a/deal.II/contrib/boost/include/boost/config/compiler/compaq_cxx.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/compaq_cxx.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/compiler/compaq_cxx.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/compaq_cxx.hpp diff --git a/deal.II/contrib/boost/include/boost/config/compiler/digitalmars.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/digitalmars.hpp similarity index 72% rename from deal.II/contrib/boost/include/boost/config/compiler/digitalmars.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/digitalmars.hpp index 46848479b7..a01b4c28ec 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/digitalmars.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/digitalmars.hpp @@ -55,6 +55,32 @@ # define BOOST_NO_EXCEPTIONS #endif +// +// C++0x features +// +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + #if __DMC__ < 0x800 #error "Compiler not supported or configured - please reconfigure" #endif diff --git a/deal.II/contrib/boost/include/boost/config/compiler/gcc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/gcc.hpp similarity index 66% rename from deal.II/contrib/boost/include/boost/config/compiler/gcc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/gcc.hpp index 27df829b24..6cae94cae6 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/gcc.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/gcc.hpp @@ -64,6 +64,9 @@ // All problems to gcc-3.x and earlier here: // #define BOOST_NO_TWO_PHASE_NAME_LOOKUP +# ifdef __OPEN64__ +# define BOOST_NO_IS_ABSTRACT +# endif #endif #ifndef __EXCEPTIONS @@ -101,29 +104,70 @@ # endif #endif +// C++0x features not implemented in any GCC version // -// C++0x features +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS + +// C++0x features in 4.3.n and later // -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2) +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && defined(__GXX_EXPERIMENTAL_CXX0X__) // 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 +// __GXX_EXPERIMENTAL_CXX0X__. +# define BOOST_HAS_DECLTYPE +# define BOOST_HAS_RVALUE_REFS +# define BOOST_HAS_STATIC_ASSERT +# define BOOST_HAS_VARIADIC_TMPL +#else +# define BOOST_NO_DECLTYPE +# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_STATIC_ASSERT + +// Variadic templates compiler: +// http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html +# ifdef __VARIADIC_TEMPLATES # define BOOST_HAS_VARIADIC_TMPL -# define BOOST_HAS_RVALUE_REFS -# define BOOST_HAS_DECLTYPE +# else +# define BOOST_NO_VARIADIC_TEMPLATES # endif #endif +// C++0x features in 4.4.n and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_AUTO_DECLARATIONS +# define BOOST_NO_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CHAR16_T +# define BOOST_NO_CHAR32_T +# define BOOST_NO_DEFAULTED_FUNCTIONS +# define BOOST_NO_DELETED_FUNCTIONS +# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_SCOPED_ENUMS +#endif + +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) +# define BOOST_NO_SFINAE_EXPR +#endif + +// C++0x features in 4.4.1 and later // -// Potential C++0x features -// +#if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40401) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_SCOPED_ENUMS before 4.4.1 +// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 +# define BOOST_NO_SCOPED_ENUMS +#endif -// Variadic templates compiler: -// http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html -#ifdef __VARIADIC_TEMPLATES -# define BOOST_HAS_VARIADIC_TMPL +// C++0x features in 4.5.n and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #endif // ConceptGCC compiler: @@ -131,6 +175,8 @@ #ifdef __GXX_CONCEPTS__ # define BOOST_HAS_CONCEPTS # define BOOST_COMPILER "ConceptGCC version " __VERSION__ +#else +# define BOOST_NO_CONCEPTS #endif #ifndef BOOST_COMPILER @@ -144,8 +190,8 @@ # 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)) +// last known and checked version is 4.4 (Pre-release): +#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 4)) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else diff --git a/deal.II/contrib/boost/include/boost/config/compiler/gcc_xml.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/gcc_xml.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/compiler/gcc_xml.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/gcc_xml.hpp diff --git a/deal.II/contrib/boost/include/boost/config/compiler/greenhills.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/greenhills.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/compiler/greenhills.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/greenhills.hpp diff --git a/deal.II/contrib/boost/include/boost/config/compiler/hp_acc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/hp_acc.hpp similarity index 78% rename from deal.II/contrib/boost/include/boost/config/compiler/hp_acc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/hp_acc.hpp index 5a766c590c..98e7772af2 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/hp_acc.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/hp_acc.hpp @@ -85,6 +85,38 @@ # endif //PA-RISC #endif +// +// C++0x features +// +// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG +// +#if !defined(__EDG__) + +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES +#endif + // // last known and checked version for HP-UX/ia64 is 61300 // last known and checked version for PA-RISC is 38000 diff --git a/deal.II/contrib/boost/include/boost/config/compiler/intel.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/intel.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/config/compiler/intel.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/intel.hpp index bc3d4e99a3..531242e964 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/intel.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/intel.hpp @@ -99,7 +99,7 @@ # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # endif #endif -#if (defined(__GNUC__) && (__GNUC__ < 4)) || defined(_WIN32) +#if (defined(__GNUC__) && (__GNUC__ < 4)) || defined(_WIN32) || (BOOST_INTEL_CXX_VERSION <= 1110) // GCC or VC emulation: #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif @@ -159,7 +159,7 @@ template<> struct assert_intrinsic_wchar_t {}; // // last known and checked version: -#if (BOOST_INTEL_CXX_VERSION > 1010) +#if (BOOST_INTEL_CXX_VERSION > 1110) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # elif defined(_MSC_VER) diff --git a/deal.II/contrib/boost/include/boost/config/compiler/kai.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/kai.hpp similarity index 93% rename from deal.II/contrib/boost/include/boost/config/compiler/kai.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/kai.hpp index de16f1a675..ea06f9f4d0 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/kai.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/kai.hpp @@ -21,8 +21,6 @@ # 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) diff --git a/deal.II/contrib/boost/include/boost/config/compiler/metrowerks.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/metrowerks.hpp similarity index 75% rename from deal.II/contrib/boost/include/boost/config/compiler/metrowerks.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/metrowerks.hpp index 2b60b56f7f..aeba7f805c 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/metrowerks.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/metrowerks.hpp @@ -39,7 +39,7 @@ // the "|| !defined(BOOST_STRICT_CONFIG)" part should apply to the last // tested version *only*: -# if(__MWERKS__ <= 0x3206) || !defined(BOOST_STRICT_CONFIG) // 9.5 +# if(__MWERKS__ <= 0x3207) || !defined(BOOST_STRICT_CONFIG) // 9.6 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_IS_ABSTRACT # endif @@ -73,6 +73,8 @@ # define BOOST_COMPILER_VERSION 9.4 # elif __MWERKS__ == 0x3206 # define BOOST_COMPILER_VERSION 9.5 +# elif __MWERKS__ == 0x3207 +# define BOOST_COMPILER_VERSION 9.6 # else # define BOOST_COMPILER_VERSION __MWERKS__ # endif @@ -83,9 +85,35 @@ // // C++0x features // +// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG +// #if __MWERKS__ > 0x3206 && __option(rvalue_refs) # define BOOST_HAS_RVALUE_REFS +#else +# define BOOST_NO_RVALUE_REFERENCES #endif +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) diff --git a/deal.II/contrib/boost/include/boost/config/compiler/mpw.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/mpw.hpp similarity index 65% rename from deal.II/contrib/boost/include/boost/config/compiler/mpw.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/mpw.hpp index 8ab2aacb6e..4db14ddef3 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/mpw.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/mpw.hpp @@ -32,8 +32,38 @@ # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_STD_ALLOCATOR /* actually a bug with const reference overloading */ + #endif +// +// C++0x features +// +// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG +// +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + // // versions check: // we don't support MPW prior to version 8.9: diff --git a/deal.II/contrib/boost/include/boost/config/compiler/pgi.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/pgi.hpp similarity index 50% rename from deal.II/contrib/boost/include/boost/config/compiler/pgi.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/pgi.hpp index 41f29c75fd..e40553efc0 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/pgi.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/pgi.hpp @@ -27,6 +27,35 @@ # error "Pgi compiler not configured - please reconfigure" #endif +// +// C++0x features +// +// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG +// +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + // // version check: // probably nothing to do here? diff --git a/deal.II/contrib/boost/include/boost/config/compiler/sgi_mipspro.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/sgi_mipspro.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/config/compiler/sgi_mipspro.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/sgi_mipspro.hpp index 33e97e9af3..90688314ad 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/sgi_mipspro.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/sgi_mipspro.hpp @@ -21,6 +21,7 @@ #undef BOOST_NO_SWPRINTF #undef BOOST_DEDUCED_TYPENAME + // // version check: // probably nothing to do here? diff --git a/deal.II/contrib/boost/include/boost/config/compiler/sunpro_cc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/sunpro_cc.hpp similarity index 80% rename from deal.II/contrib/boost/include/boost/config/compiler/sunpro_cc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/sunpro_cc.hpp index f513c2dce8..f5184887f1 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/sunpro_cc.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/sunpro_cc.hpp @@ -75,10 +75,43 @@ #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_ADL_BARRIER +// +// C++0x features +// + #if(__SUNPRO_CC >= 0x590) # define BOOST_HAS_LONG_LONG +#else +# define BOOST_NO_LONG_LONG #endif +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + +// +// Version +// #define BOOST_COMPILER "Sun compiler version " BOOST_STRINGIZE(__SUNPRO_CC) @@ -95,9 +128,3 @@ # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif - - - - - - diff --git a/deal.II/contrib/boost/include/boost/config/compiler/vacpp.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/vacpp.hpp similarity index 68% rename from deal.II/contrib/boost/include/boost/config/compiler/vacpp.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/vacpp.hpp index 826939f120..01956d3a70 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/vacpp.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/vacpp.hpp @@ -27,6 +27,7 @@ #if (__IBMCPP__ <= 600) || !defined(BOOST_STRICT_CONFIG) # define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS +# define BOOST_NO_INITIALIZER_LISTS #endif // @@ -46,7 +47,7 @@ #endif // // last known and checked version is 600: -#if (__IBMCPP__ > 600) +#if (__IBMCPP__ > 1010) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif @@ -55,6 +56,33 @@ // Some versions of the compiler have issues with default arguments on partial specializations #define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS +// +// C++0x features +// +// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG +// +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES diff --git a/deal.II/contrib/boost/include/boost/config/compiler/visualc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/visualc.hpp similarity index 77% rename from deal.II/contrib/boost/include/boost/config/compiler/visualc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/compiler/visualc.hpp index 187591be9d..fd21f26bab 100644 --- a/deal.II/contrib/boost/include/boost/config/compiler/visualc.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/compiler/visualc.hpp @@ -14,6 +14,12 @@ #define BOOST_MSVC _MSC_VER +#if _MSC_FULL_VER > 100000000 +# define BOOST_MSVC_FULL_VER _MSC_FULL_VER +#else +# define BOOST_MSVC_FULL_VER (_MSC_FULL_VER * 10) +#endif + // turn off the warnings before we #include anything #pragma warning( disable : 4503 ) // warning: decorated name length exceeded @@ -22,6 +28,11 @@ # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_VOID_RETURNS # define BOOST_NO_EXCEPTION_STD_NAMESPACE + +# if BOOST_MSVC == 1202 +# define BOOST_NO_STD_TYPEINFO +# endif + // disable min/max macro defines on vc6: // #endif @@ -79,7 +90,7 @@ # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif -#if _MSC_VER <= 1500 // 1500 == VC++ 9.0 +#if _MSC_VER <= 1600 // 1600 == VC++ 10.0 # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif @@ -88,6 +99,10 @@ # define BOOST_NO_ADL_BARRIER #endif +#if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 +# define BOOST_NO_INITIALIZER_LISTS +#endif + #ifndef _NATIVE_WCHAR_T_DEFINED # define BOOST_NO_INTRINSIC_WCHAR_T #endif @@ -112,6 +127,8 @@ #endif #if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS) # define BOOST_HAS_LONG_LONG +#else +# define BOOST_NO_LONG_LONG #endif #if (_MSC_VER >= 1400) && !defined(_DEBUG) # define BOOST_HAS_NRVO @@ -120,10 +137,10 @@ // disable Win32 API's if compiler extentions are // turned off: // -#ifndef _MSC_EXTENSIONS +#if !defined(_MSC_EXTENSIONS) && !defined(BOOST_DISABLE_WIN32) # define BOOST_DISABLE_WIN32 #endif -#ifndef _CPPRTTI +#if !defined(_CPPRTTI) && !defined(BOOST_NO_RTTI) # define BOOST_NO_RTTI #endif @@ -131,6 +148,42 @@ // all versions support __declspec: // #define BOOST_HAS_DECLSPEC + +// +// C++0x features +// +// See above for BOOST_NO_LONG_LONG + +// C++ features supported by VC++ 10 (aka 2010) +// +#if _MSC_VER < 1600 +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_DECLTYPE +#define BOOST_NO_LAMBDAS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_STATIC_ASSERT +#endif // _MSC_VER < 1600 + +// C++0x features not supported by any versions +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + // // prefix and suffix headers: // @@ -154,6 +207,10 @@ # define BOOST_COMPILER_VERSION evc4.0 # elif _MSC_VER == 1400 # define BOOST_COMPILER_VERSION evc8 +# elif _MSC_VER == 1500 +# define BOOST_COMPILER_VERSION evc9 +# elif _MSC_VER == 1600 +# define BOOST_COMPILER_VERSION evc10 # else # if defined(BOOST_ASSERT_CONFIG) # error "Unknown EVC++ compiler version - please run the configure tests and report the results" @@ -175,6 +232,8 @@ # define BOOST_COMPILER_VERSION 8.0 # elif _MSC_VER == 1500 # define BOOST_COMPILER_VERSION 9.0 +# elif _MSC_VER == 1600 +# define BOOST_COMPILER_VERSION 10.0 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif @@ -189,8 +248,8 @@ #error "Compiler not supported or configured - please reconfigure" #endif // -// last known and checked version is 1500 (VC9): -#if (_MSC_VER > 1500) +// last known and checked version is 1600 (VC10, aka 2010): +#if (_MSC_VER > 1600) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else diff --git a/deal.II/contrib/boost/include/boost/config/no_tr1/cmath.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/no_tr1/cmath.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/no_tr1/cmath.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/no_tr1/cmath.hpp diff --git a/deal.II/contrib/boost/include/boost/config/no_tr1/complex.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/no_tr1/complex.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/no_tr1/complex.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/no_tr1/complex.hpp diff --git a/deal.II/contrib/boost/include/boost/config/no_tr1/functional.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/no_tr1/functional.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/no_tr1/functional.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/no_tr1/functional.hpp diff --git a/deal.II/contrib/boost/include/boost/config/no_tr1/memory.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/no_tr1/memory.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/no_tr1/memory.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/no_tr1/memory.hpp diff --git a/deal.II/contrib/boost/include/boost/config/no_tr1/utility.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/no_tr1/utility.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/no_tr1/utility.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/no_tr1/utility.hpp diff --git a/deal.II/contrib/boost/include/boost/config/platform/aix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/aix.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/platform/aix.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/aix.hpp diff --git a/deal.II/contrib/boost/include/boost/config/platform/amigaos.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/amigaos.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/platform/amigaos.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/amigaos.hpp diff --git a/deal.II/contrib/boost/include/boost/config/platform/beos.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/beos.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/platform/beos.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/beos.hpp diff --git a/deal.II/contrib/boost/include/boost/config/platform/bsd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/bsd.hpp similarity index 91% rename from deal.II/contrib/boost/include/boost/config/platform/bsd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/bsd.hpp index 810d3707be..f02b0e2630 100644 --- a/deal.II/contrib/boost/include/boost/config/platform/bsd.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/bsd.hpp @@ -36,7 +36,8 @@ // FreeBSD 3.x has pthreads support, but defines _POSIX_THREADS in // and not in // -#if (defined(__FreeBSD__) && (__FreeBSD__ <= 3)) || defined(__OpenBSD__) +#if (defined(__FreeBSD__) && (__FreeBSD__ <= 3))\ + || defined(__OpenBSD__) || defined(__DragonFly__) # define BOOST_HAS_PTHREADS #endif @@ -55,13 +56,13 @@ #endif #if !((defined(__FreeBSD__) && (__FreeBSD__ >= 5)) \ - || (__NetBSD_GCC__ >= 2095003)) + || (__NetBSD_GCC__ >= 2095003) || defined(__DragonFly__)) # define BOOST_NO_CWCHAR #endif // // The BSD has macros only, no functions: // -#if !defined(__OpenBSD__) +#if !defined(__OpenBSD__) || defined(__DragonFly__) # define BOOST_NO_CTYPE_FUNCTIONS #endif diff --git a/deal.II/contrib/boost/include/boost/config/platform/cygwin.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/cygwin.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/platform/cygwin.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/cygwin.hpp diff --git a/deal.II/contrib/boost/include/boost/config/platform/hpux.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/hpux.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/platform/hpux.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/hpux.hpp diff --git a/deal.II/contrib/boost/include/boost/config/platform/irix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/irix.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/platform/irix.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/irix.hpp diff --git a/deal.II/contrib/boost/include/boost/config/platform/linux.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/linux.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/platform/linux.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/linux.hpp diff --git a/deal.II/contrib/boost/include/boost/config/platform/macos.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/macos.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/platform/macos.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/macos.hpp diff --git a/deal.II/contrib/boost/include/boost/config/platform/qnxnto.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/qnxnto.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/platform/qnxnto.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/qnxnto.hpp diff --git a/deal.II/contrib/boost/include/boost/config/platform/solaris.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/solaris.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/platform/solaris.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/solaris.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/config/platform/vxworks.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/vxworks.hpp new file mode 100644 index 0000000000..6ec5171e39 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/vxworks.hpp @@ -0,0 +1,31 @@ +// (C) Copyright Dustin Spicuzza 2009. +// 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. + +// vxWorks specific config options: + +#define BOOST_PLATFORM "vxWorks" + +#define BOOST_NO_CWCHAR +#define BOOST_NO_INTRINSIC_WCHAR_T + +#if defined(__GNUC__) && defined(__STRICT_ANSI__) +#define BOOST_NO_INT64_T +#endif + +#define BOOST_HAS_UNISTD_H + +// these allow posix_features to work, since vxWorks doesn't +// define them itself +#define _POSIX_TIMERS 1 +#define _POSIX_THREADS 1 + +// vxworks doesn't work with asio serial ports +#define BOOST_ASIO_DISABLE_SERIAL_PORT + +// boilerplate code: +#include + diff --git a/deal.II/contrib/boost/include/boost/config/platform/win32.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/platform/win32.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/platform/win32.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/platform/win32.hpp diff --git a/deal.II/contrib/boost/include/boost/config/posix_features.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/posix_features.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/posix_features.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/posix_features.hpp diff --git a/deal.II/contrib/boost/include/boost/config/requires_threads.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/requires_threads.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/requires_threads.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/requires_threads.hpp diff --git a/deal.II/contrib/boost/include/boost/config/select_compiler_config.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/select_compiler_config.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/select_compiler_config.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/select_compiler_config.hpp diff --git a/deal.II/contrib/boost/include/boost/config/select_platform_config.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/select_platform_config.hpp similarity index 88% rename from deal.II/contrib/boost/include/boost/config/select_platform_config.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/select_platform_config.hpp index a4c7ad6a87..615bb064ff 100644 --- a/deal.II/contrib/boost/include/boost/config/select_platform_config.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/select_platform_config.hpp @@ -13,8 +13,8 @@ // 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: +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) +// linux, also other platforms (Hurd etc) that use GLIBC, should these really have their own config headers though? # define BOOST_PLATFORM_CONFIG "boost/config/platform/linux.hpp" #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) @@ -61,6 +61,10 @@ // QNX: # define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp" +#elif defined(__VXWORKS__) +// vxWorks: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/vxworks.hpp" + #else # if defined(unix) \ diff --git a/deal.II/contrib/boost/include/boost/config/select_stdlib_config.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/select_stdlib_config.hpp similarity index 74% rename from deal.II/contrib/boost/include/boost/config/select_stdlib_config.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/select_stdlib_config.hpp index 13e5e4cef0..2a1430aef4 100644 --- a/deal.II/contrib/boost/include/boost/config/select_stdlib_config.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/select_stdlib_config.hpp @@ -11,13 +11,10 @@ // 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 +// First include to determine if some version of STLport is in use as the std lib +// (do not rely on this header being included since 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 @@ -25,7 +22,17 @@ // can end up detecting that first rather than STLport: # define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp" -#elif defined(__LIBCOMO__) +#else + +// If our std lib was not some version of STLport, then include as it is about +// the smallest of the std lib headers that includes real C++ stuff. (Some std libs do not +// include their C++-related macros in so this additional include makes sure +// we get those definitions) +// (again do not rely on this header being included since users can short-circuit this +// header if they know whose std lib they are using.) +#include + +#if defined(__LIBCOMO__) // Comeau STL: #define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcomo.hpp" @@ -64,5 +71,7 @@ #endif +#endif + diff --git a/deal.II/contrib/boost/include/boost/config/stdlib/dinkumware.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/dinkumware.hpp similarity index 75% rename from deal.II/contrib/boost/include/boost/config/stdlib/dinkumware.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/dinkumware.hpp index 01f1238d93..ab770599a7 100644 --- a/deal.II/contrib/boost/include/boost/config/stdlib/dinkumware.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/dinkumware.hpp @@ -55,8 +55,10 @@ # 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 + // its own min and max definitions, as does MTA version. +# ifndef __MTA__ +# define BOOST_NO_STD_MIN_MAX +# endif # define BOOST_NO_MS_INT64_NUMERIC_LIMITS # endif #endif @@ -84,6 +86,36 @@ # define BOOST_NO_STD_LOCALE #endif +// C++0x headers implemented in 520 (as shipped by Microsoft) +// +#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520 +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET +#endif + +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE + #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER #else diff --git a/deal.II/contrib/boost/include/boost/config/stdlib/libcomo.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/libcomo.hpp similarity index 59% rename from deal.II/contrib/boost/include/boost/config/stdlib/libcomo.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/libcomo.hpp index 749781fece..06731e32e7 100644 --- a/deal.II/contrib/boost/include/boost/config/stdlib/libcomo.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/libcomo.hpp @@ -33,6 +33,31 @@ # define BOOST_HAS_SLIST #endif +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + // // Intrinsic type_traits support. // The SGI STL has it's own __type_traits class, which diff --git a/deal.II/contrib/boost/include/boost/config/stdlib/libstdcpp3.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/libstdcpp3.hpp similarity index 60% rename from deal.II/contrib/boost/include/boost/config/stdlib/libstdcpp3.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/libstdcpp3.hpp index a619e3ebaa..6a57319ffd 100644 --- a/deal.II/contrib/boost/include/boost/config/stdlib/libstdcpp3.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/libstdcpp3.hpp @@ -76,3 +76,52 @@ # define BOOST_HASH_MAP_HEADER # endif #endif + +// stdlibc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly +// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the stdlibc++ +// developers. He also commented: +// +// "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in +// GCC 4.2.4 it is set to 20080519 but in GCC 4.3.0 it is set to 20080305. +// Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support +// than any release in the 4.2 series." +// +// Another resource for understanding stdlibc++ features is: +// http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x + +// C++0x headers in GCC 4.3.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET +#endif + +// C++0x headers in GCC 4.4.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +#endif + +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS + +// --- end --- diff --git a/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/modena.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/modena.hpp new file mode 100644 index 0000000000..7bd50cecb7 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/modena.hpp @@ -0,0 +1,55 @@ +// (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 + +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + +#define BOOST_STDLIB "Modena C++ standard library" + + + + + diff --git a/deal.II/contrib/boost/include/boost/config/stdlib/msl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/msl.hpp similarity index 59% rename from deal.II/contrib/boost/include/boost/config/stdlib/msl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/msl.hpp index f8d8752bf7..6bcd232a57 100644 --- a/deal.II/contrib/boost/include/boost/config/stdlib/msl.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/msl.hpp @@ -46,6 +46,30 @@ # define BOOST_HAS_TWO_ARG_USE_FACET #endif +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) diff --git a/deal.II/contrib/boost/include/boost/config/stdlib/roguewave.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/roguewave.hpp similarity index 83% rename from deal.II/contrib/boost/include/boost/config/stdlib/roguewave.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/roguewave.hpp index ebf4c1f8f4..cba2f54a1a 100644 --- a/deal.II/contrib/boost/include/boost/config/stdlib/roguewave.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/roguewave.hpp @@ -151,3 +151,29 @@ # define _HP_INSTANTIATE_STD2_VL # endif #endif + +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + diff --git a/deal.II/contrib/boost/include/boost/config/stdlib/sgi.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/sgi.hpp similarity index 78% rename from deal.II/contrib/boost/include/boost/config/stdlib/sgi.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/sgi.hpp index f3fa05b260..c505008b7d 100644 --- a/deal.II/contrib/boost/include/boost/config/stdlib/sgi.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/sgi.hpp @@ -105,6 +105,31 @@ // #define BOOST_HAS_SGI_TYPE_TRAITS +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + #define BOOST_STDLIB "SGI standard library" diff --git a/deal.II/contrib/boost/include/boost/config/stdlib/stlport.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/stlport.hpp similarity index 84% rename from deal.II/contrib/boost/include/boost/config/stdlib/stlport.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/stlport.hpp index b1dabf23f6..3dfd529eff 100644 --- a/deal.II/contrib/boost/include/boost/config/stdlib/stlport.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/stlport.hpp @@ -10,7 +10,7 @@ // STLPort standard library config: #if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) -# include +# include # if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) # error "This is not STLPort!" # endif @@ -61,6 +61,14 @@ # endif #endif +#if defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x500) || (_STLPORT_VERSION >= 0x520)) +# define BOOST_NO_STD_UNORDERED +#endif + +#if defined(_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x520) +# define BOOST_HAS_TR1_UNORDERED_SET +# define BOOST_HAS_TR1_UNORDERED_MAP +#endif // // Without member template support enabled, their are no template // iterate constructors, and no std::allocator: @@ -192,6 +200,31 @@ namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy; namespace boost { using std::min; using std::max; } #endif +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) diff --git a/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/vacpp.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/vacpp.hpp new file mode 100644 index 0000000000..c8d6d5ad69 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/stdlib/vacpp.hpp @@ -0,0 +1,43 @@ +// (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 + +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + +#define BOOST_STDLIB "Visual Age default standard library" + + + diff --git a/deal.II/contrib/boost/include/boost/config/suffix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/suffix.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/config/suffix.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/suffix.hpp index f71c644f79..fa44986946 100644 --- a/deal.II/contrib/boost/include/boost/config/suffix.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/config/suffix.hpp @@ -31,11 +31,13 @@ // remember that since these just declare a bunch of macros, there should be // no namespace issues from this. // -#if !defined(BOOST_HAS_LONG_LONG) \ +#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG) \ && !defined(BOOST_MSVC) && !defined(__BORLANDC__) # include # if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) # define BOOST_HAS_LONG_LONG +# else +# define BOOST_NO_LONG_LONG # endif #endif @@ -223,7 +225,8 @@ // from here then add to the appropriate compiler section): // #if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \ - || defined(_PTHREADS)) && !defined(BOOST_HAS_THREADS) + || defined(_PTHREADS) || defined(__APPLE__) || defined(__DragonFly__)) \ + && !defined(BOOST_HAS_THREADS) # define BOOST_HAS_THREADS #endif @@ -303,6 +306,14 @@ # define BOOST_HASH_MAP_HEADER #endif +// +// Set BOOST_NO_INITIALIZER_LISTS if there is no library support. +// + +#if defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) +# define BOOST_NO_INITIALIZER_LISTS +#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: diff --git a/deal.II/contrib/boost/include/boost/config/user.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/user.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/user.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/user.hpp diff --git a/deal.II/contrib/boost/include/boost/config/warning_disable.hpp b/deal.II/contrib/boost-1.41.0/include/boost/config/warning_disable.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/config/warning_disable.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/config/warning_disable.hpp diff --git a/deal.II/contrib/boost/include/boost/crc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/crc.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/crc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/crc.hpp index e70c834033..6be5aa1d8b 100644 --- a/deal.II/contrib/boost/include/boost/crc.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/crc.hpp @@ -464,6 +464,10 @@ namespace detail // 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 ]; +#elif defined(__GNUC__) + // old versions of GCC (before 4.0.2) choke on using byte_combos + // as a constant expression when compiling with -pedantic. + typedef value_type table_type[1ul << CHAR_BIT]; #else typedef value_type table_type[ byte_combos ]; #endif diff --git a/deal.II/contrib/boost/include/boost/cregex.hpp b/deal.II/contrib/boost-1.41.0/include/boost/cregex.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/cregex.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/cregex.hpp diff --git a/deal.II/contrib/boost/include/boost/cstdint.hpp b/deal.II/contrib/boost-1.41.0/include/boost/cstdint.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/cstdint.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/cstdint.hpp index 31a432a886..d55a4840b9 100644 --- a/deal.II/contrib/boost/include/boost/cstdint.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/cstdint.hpp @@ -36,7 +36,7 @@ // this is triggered with GCC, because it defines __cplusplus < 199707L # define BOOST_NO_INT64_T # endif -# elif defined(__FreeBSD__) || defined(__IBMCPP__) +# elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX) # include # else # include diff --git a/deal.II/contrib/boost/include/boost/cstdlib.hpp b/deal.II/contrib/boost-1.41.0/include/boost/cstdlib.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/cstdlib.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/cstdlib.hpp diff --git a/deal.II/contrib/boost/include/boost/current_function.hpp b/deal.II/contrib/boost-1.41.0/include/boost/current_function.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/current_function.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/current_function.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/adjust_functors.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/adjust_functors.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/adjust_functors.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/adjust_functors.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/c_local_time_adjustor.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/c_local_time_adjustor.hpp similarity index 84% rename from deal.II/contrib/boost/include/boost/date_time/c_local_time_adjustor.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/c_local_time_adjustor.hpp index 7c03dc9825..f8025828f7 100644 --- a/deal.II/contrib/boost/include/boost/date_time/c_local_time_adjustor.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/c_local_time_adjustor.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ /*! @file c_local_time_adjustor.hpp @@ -14,7 +14,9 @@ */ #include -#include "boost/date_time/c_time.hpp" +#include +#include +#include namespace boost { namespace date_time { @@ -35,14 +37,14 @@ namespace date_time { 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"); + boost::throw_exception(std::out_of_range("Cannot convert dates prior to Jan 1, 1970")); + BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return time_t_start_time); // should never reach } 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)); diff --git a/deal.II/contrib/boost/include/boost/date_time/c_time.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/c_time.hpp similarity index 72% rename from deal.II/contrib/boost/include/boost/date_time/c_time.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/c_time.hpp index 6ce5340a49..048a66563c 100644 --- a/deal.II/contrib/boost/include/boost/date_time/c_time.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/c_time.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2009-10-03 06:22:58 -0400 (Sat, 03 Oct 2009) $ */ @@ -14,10 +14,13 @@ 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 +#include // to be able to convert from string literals to exceptions +#include +#include +#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; } @@ -40,7 +43,12 @@ namespace date_time { * 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. */ + * pointer to it. This struct may be used to store the resulting time. + * The returned pointer may or may not point to this struct, however, + * it will point to the result of the corresponding function. + * All functions do proper checking of the C function results and throw + * exceptions on error. Therefore the functions will never return NULL. + */ struct c_time { public: #if defined(BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS) @@ -50,6 +58,8 @@ namespace date_time { { // localtime_r() not in namespace std??? result = localtime_r(t, result); + if (!result) + boost::throw_exception(std::runtime_error("could not convert calendar time to local time")); return result; } //! requires a pointer to a user created std::tm struct @@ -58,6 +68,8 @@ namespace date_time { { // gmtime_r() not in namespace std??? result = gmtime_r(t, result); + if (!result) + boost::throw_exception(std::runtime_error("could not convert calendar time to UTC time")); return result; } #else // BOOST_HAS_THREADS @@ -71,6 +83,8 @@ namespace date_time { static std::tm* localtime(const std::time_t* t, std::tm* result) { result = std::localtime(t); + if (!result) + boost::throw_exception(std::runtime_error("could not convert calendar time to local time")); return result; } //! requires a pointer to a user created std::tm struct @@ -78,6 +92,8 @@ namespace date_time { static std::tm* gmtime(const std::time_t* t, std::tm* result) { result = std::gmtime(t); + if (!result) + boost::throw_exception(std::runtime_error("could not convert calendar time to UTC time")); return result; } #if (defined(_MSC_VER) && (_MSC_VER >= 1400)) diff --git a/deal.II/contrib/boost/include/boost/date_time/compiler_config.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/compiler_config.hpp similarity index 80% rename from deal.II/contrib/boost/include/boost/date_time/compiler_config.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/compiler_config.hpp index 137888e649..0dc893f9fb 100644 --- a/deal.II/contrib/boost/include/boost/date_time/compiler_config.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/compiler_config.hpp @@ -5,10 +5,12 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ - #include "boost/detail/workaround.hpp" +#include +#include +#include // With boost release 1.33, date_time will be using a different, // more flexible, IO system. This new system is not compatible with @@ -26,7 +28,7 @@ // This file performs some local compiler configurations -#include "boost/date_time/locale_config.hpp" //set up locale configurations +#include //set up locale configurations //Set up a configuration parameter for platforms that have //GetTimeOfDay @@ -49,7 +51,7 @@ #endif // include these types before we try to re-define them -#include "boost/cstdint.hpp" +#include //Define INT64_C for compilers that don't have it #if (!defined(INT64_C)) @@ -85,12 +87,32 @@ namespace std { #define BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS #endif +// The macro marks up places where compiler complains for missing return statement or +// uninitialized variables after calling to boost::throw_exception. +// BOOST_UNREACHABLE_RETURN doesn't work since even compilers that support +// unreachable statements detection emit such warnings. +#if defined(_MSC_VER) +// Use special MSVC extension to markup unreachable code +# define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) __assume(false) +#elif !defined(BOOST_NO_UNREACHABLE_RETURN_DETECTION) +// Call to a non-returning function should suppress the warning +# if defined(BOOST_NO_STDC_NAMESPACE) +namespace std { + using ::abort; +} +# endif // defined(BOOST_NO_STDC_NAMESPACE) +# define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) std::abort() +#else +// For other poor compilers the specified expression is compiled. Usually, this would be a return statement. +# define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) x +#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 + * The corresponding .cpp file must have BOOST_DATE_TIME_SOURCE * defined before including its header. For examples see: * greg_month.hpp & greg_month.cpp * diff --git a/deal.II/contrib/boost/include/boost/date_time/constrained_value.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/constrained_value.hpp similarity index 67% rename from deal.II/contrib/boost/include/boost/date_time/constrained_value.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/constrained_value.hpp index c010b40dcf..b273dd5aa8 100644 --- a/deal.II/contrib/boost/include/boost/date_time/constrained_value.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/constrained_value.hpp @@ -6,10 +6,15 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ +#include +#include #include +#include +#include +#include namespace boost { @@ -38,21 +43,21 @@ namespace CV { public: typedef typename value_policies::value_type value_type; // typedef except_type exception_type; - constrained_value(value_type value) + constrained_value(value_type value) : value_((min)()) { assign(value); - }; - constrained_value& operator=(value_type v) - { + } + 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)();}; + 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)();}; + static value_type min BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::min)();} //! Coerce into the representation type - operator value_type() const {return value_;}; + operator value_type() const {return value_;} protected: value_type value_; private: @@ -69,7 +74,6 @@ namespace CV { return; } value_ = value; - } }; @@ -78,13 +82,32 @@ namespace CV { rep_type max_value, class exception_type> class simple_exception_policy { + struct exception_wrapper : public exception_type + { + // In order to support throw_exception mechanism in the BOOST_NO_EXCEPTIONS mode, + // we'll have to provide a way to acquire std::exception from the exception being thrown. + // However, we cannot derive from it, since it would make it interceptable by this class, + // which might not be what the user wanted. + operator std::out_of_range () const + { + // TODO: Make the message more descriptive by using arguments to on_error + return std::out_of_range("constrained value boundary has been violated"); + } + }; + + typedef typename mpl::if_< + is_base_of< std::exception, exception_type >, + exception_type, + exception_wrapper + >::type actual_exception_type; + 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 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(); + boost::throw_exception(actual_exception_type()); } }; diff --git a/deal.II/contrib/boost/include/boost/date_time/date.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date.hpp similarity index 87% rename from deal.II/contrib/boost/include/boost/date_time/date.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date.hpp index beab047700..677f6286ad 100644 --- a/deal.II/contrib/boost/include/boost/date_time/date.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date.hpp @@ -6,12 +6,12 @@ * 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) $ + * $Date: 2009-09-28 14:10:02 -0400 (Mon, 28 Sep 2009) $ */ -#include "boost/date_time/year_month_day.hpp" -#include "boost/date_time/special_defs.hpp" -#include "boost/operators.hpp" +#include +#include +#include namespace boost { namespace date_time { @@ -138,8 +138,19 @@ namespace date_time { } 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()); + if (!this->is_special() && !d.is_special()) + { + // The duration underlying type may be wider than the date underlying type. + // Thus we calculate the difference in terms of two durations from some common fixed base date. + typedef typename duration_type::duration_rep_type duration_rep_type; + return duration_type(static_cast< duration_rep_type >(days_) - static_cast< duration_rep_type >(d.days_)); + } + else + { + // In this case the difference will be a special value, too + date_rep_type val = date_rep_type(days_) - date_rep_type(d.days_); + return duration_type(val.as_special()); + } } date_type operator-(const duration_type& dd) const @@ -158,7 +169,7 @@ namespace date_time { date_rep_type day_count() const { return days_; - }; + } //allow internal access from operators date_type operator+(const duration_type& dd) const { diff --git a/deal.II/contrib/boost/include/boost/date_time/date_clock_device.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_clock_device.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/date_clock_device.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_clock_device.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/date_defs.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_defs.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/date_defs.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_defs.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/date_duration.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_duration.hpp similarity index 83% rename from deal.II/contrib/boost/include/boost/date_time/date_duration.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_duration.hpp index 366fb9c6c5..3871aac0ce 100644 --- a/deal.II/contrib/boost/include/boost/date_time/date_duration.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_duration.hpp @@ -6,11 +6,12 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ #include +#include namespace boost { namespace date_time { @@ -19,11 +20,12 @@ 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> - > > > > + boost::less_than_comparable1< date_duration< duration_rep_traits > + , boost::equality_comparable1< date_duration< duration_rep_traits > + , boost::addable1< date_duration< duration_rep_traits > + , boost::subtractable1< date_duration< duration_rep_traits > + , boost::dividable2< date_duration< duration_rep_traits >, int + > > > > > { public: typedef typename duration_rep_traits::int_type duration_rep_type; @@ -80,40 +82,37 @@ namespace date_time { * so this will not compile */ //! Subtract another duration -- result is signed - date_duration operator-=(const date_duration& rhs) + 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) + 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 + date_duration operator-() const { return date_duration(get_rep() * (-1)); } //! Division operations on a duration with an integer. - date_duration operator/=(int divisor) + 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_; }; diff --git a/deal.II/contrib/boost/include/boost/date_time/date_duration_types.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_duration_types.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/date_duration_types.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_duration_types.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/date_facet.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_facet.hpp similarity index 73% rename from deal.II/contrib/boost/include/boost/date_time/date_facet.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_facet.hpp index bd61695935..3eda4c7d09 100644 --- a/deal.II/contrib/boost/include/boost/date_time/date_facet.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_facet.hpp @@ -2,28 +2,32 @@ #define _DATE_TIME_DATE_FACET__HPP___ /* Copyright (c) 2004-2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * 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) $ + * $Date: 2009-06-04 07:40:18 -0400 (Thu, 04 Jun 2009) $ */ - -#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 #include +#include // ostreambuf_iterator +#include +#include +#include +#include +#include +#include +#include +#include +#include +#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. @@ -40,7 +44,7 @@ namespace boost { namespace date_time { * Default weekday format == %a */ template > > class date_facet : public std::locale::facet { public: @@ -77,9 +81,9 @@ namespace boost { namespace date_time { #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), + + 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), @@ -88,22 +92,22 @@ namespace boost { namespace date_time { explicit date_facet(const char_type* format_str, const input_collection_type& short_names, - ::size_t ref_count = 0) - : std::locale::facet(ref_count), + ::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) + m_month_short_names(short_names) {} - - explicit date_facet(const char_type* format_str, - period_formatter_type per_formatter = period_formatter_type(), + + 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), + : 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), @@ -127,11 +131,11 @@ namespace boost { namespace date_time { 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) + void special_values_formatter(const special_values_formatter_type& svf) { m_special_values_formatter = svf; } @@ -160,24 +164,24 @@ namespace boost { namespace date_time { 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 + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const date_type& d) const { - if (d.is_special()) { + 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 + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const duration_type& dd) const { - if (dd.is_special()) { + if (dd.is_special()) { return do_put_special(next, a_ios, fill_char, dd.get_rep().as_special()); } @@ -195,164 +199,148 @@ namespace boost { namespace date_time { } - OutItrT put(OutItrT next, - std::ios_base& a_ios, - char_type fill_char, - const month_type& m) const + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const month_type& m) const { - //if (d.is_special()) { + //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; + std::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 + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const day_type& day) const { - tm dtm; - init_tm(dtm); + std::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 + OutItrT put(OutItrT next, + std::ios_base& a_ios, + char_type fill_char, + const day_of_week_type& dow) const { - //if (d.is_special()) { + //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); + std::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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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, + 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 + 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, + 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, + 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, + 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, + 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, + const char_type* p_format = a_format.c_str(); + return std::use_facet >(a_ios.getloc()).put(next, a_ios, + fill_char, &tm_value, - &*a_format.begin(), - &*a_format.begin()+a_format.size()); + p_format, + p_format + a_format.size()); } protected: string_type m_format; @@ -371,51 +359,51 @@ namespace boost { namespace date_time { template std::locale::id date_facet::id; - template - const typename date_facet::char_type + template + const typename date_facet::char_type date_facet::long_weekday_format[3] = {'%','A'}; - template - const typename date_facet::char_type + template + const typename date_facet::char_type date_facet::short_weekday_format[3] = {'%','a'}; - template - const typename date_facet::char_type + template + const typename date_facet::char_type date_facet::long_month_format[3] = {'%','B'}; - template - const typename date_facet::char_type + template + const typename date_facet::char_type date_facet::short_month_format[3] = {'%','b'}; - template - const typename date_facet::char_type + 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] = + 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] = + 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] = + 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] = + 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: @@ -429,7 +417,7 @@ namespace boost { namespace date_time { 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 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 @@ -453,9 +441,9 @@ namespace boost { namespace date_time { 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), + + 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), @@ -465,8 +453,8 @@ namespace boost { namespace date_time { {} explicit date_input_facet(const string_type& format_str, - ::size_t a_ref = 0) - : std::locale::facet(a_ref), + ::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), @@ -513,7 +501,7 @@ namespace boost { namespace date_time { 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; } @@ -549,7 +537,7 @@ namespace boost { namespace date_time { 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); } @@ -559,68 +547,68 @@ namespace boost { namespace date_time { m_sv_parser = sv_parser; } - InItrT get(InItrT& from, - InItrT& to, - std::ios_base& /*a_ios*/, + 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*/, + 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*/, + 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*/, + 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*/, + 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, + 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 + 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'; + char_type c = '\0'; // TODO Are these characters somewhere in the locale? - if(*from == '-' || *from == '+') { + 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); } @@ -638,67 +626,68 @@ namespace boost { namespace date_time { } 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 + "'"); + boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'")); + BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return from); // should never reach } - dd = duration_type(static_cast(mr.current_match)); + 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, + 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); + 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, + 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, + 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, + 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, + 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, + 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, + 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); @@ -721,52 +710,52 @@ namespace boost { namespace date_time { template std::locale::id date_input_facet::id; - template - const typename date_input_facet::char_type + template + const typename date_input_facet::char_type date_input_facet::long_weekday_format[3] = {'%','A'}; - template - const typename date_input_facet::char_type + template + const typename date_input_facet::char_type date_input_facet::short_weekday_format[3] = {'%','a'}; - template - const typename date_input_facet::char_type + template + const typename date_input_facet::char_type date_input_facet::long_month_format[3] = {'%','B'}; - template - const typename date_input_facet::char_type + template + const typename date_input_facet::char_type date_input_facet::short_month_format[3] = {'%','b'}; - template - const typename date_input_facet::char_type + 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 + 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 + 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] = + 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] = + 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] = + 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] = + template + const typename date_input_facet::char_type + date_input_facet::default_date_format[9] = {'%','Y','-','%','b','-','%','d'}; } } // namespaces diff --git a/deal.II/contrib/boost/include/boost/date_time/date_format_simple.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_format_simple.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/date_format_simple.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_format_simple.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/date_formatting.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_formatting.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/date_formatting.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_formatting.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/date_formatting_limited.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_formatting_limited.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/date_formatting_limited.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_formatting_limited.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/date_formatting_locales.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_formatting_locales.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/date_formatting_locales.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_formatting_locales.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/date_generator_formatter.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_generator_formatter.hpp similarity index 90% rename from deal.II/contrib/boost/include/boost/date_time/date_generator_formatter.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_generator_formatter.hpp index 919cc0b338..88cd7e1aba 100644 --- a/deal.II/contrib/boost/include/boost/date_time/date_generator_formatter.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_generator_formatter.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $ */ #include @@ -63,6 +63,7 @@ namespace date_time { //! Default format elements used date_generator_formatter() { + phrase_strings.reserve(number_of_phrase_elements); phrase_strings.push_back(string_type(first_string)); phrase_strings.push_back(string_type(second_string)); phrase_strings.push_back(string_type(third_string)); @@ -75,25 +76,26 @@ namespace date_time { } //! 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) + date_generator_formatter(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) { - 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)); + phrase_strings.reserve(number_of_phrase_elements); + phrase_strings.push_back(first_str); + phrase_strings.push_back(second_str); + phrase_strings.push_back(third_str); + phrase_strings.push_back(fourth_str); + phrase_strings.push_back(fifth_str); + phrase_strings.push_back(last_str); + phrase_strings.push_back(before_str); + phrase_strings.push_back(after_str); + phrase_strings.push_back(of_str); } //! Replace the set of phrase elements with those contained in new_strings @@ -148,7 +150,7 @@ namespace date_time { 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, diff --git a/deal.II/contrib/boost/include/boost/date_time/date_generator_parser.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_generator_parser.hpp similarity index 90% rename from deal.II/contrib/boost/include/boost/date_time/date_generator_parser.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_generator_parser.hpp index fd662e44c7..f11eb42d52 100644 --- a/deal.II/contrib/boost/include/boost/date_time/date_generator_parser.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_generator_parser.hpp @@ -7,15 +7,17 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 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 +#include // istreambuf_iterator +#include +#include +#include +#include +#include namespace boost { namespace date_time { @@ -66,10 +68,10 @@ namespace boost { namespace date_time { 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]; - + static const char_type of_string[3]; + enum phrase_elements {first=0, second, third, fourth, fifth, last, - before, after, of, number_of_phrase_elements}; + before, after, of, number_of_phrase_elements}; //! Creates a date_generator_parser with the default set of "element_strings" date_generator_parser() @@ -96,7 +98,7 @@ namespace boost { namespace date_time { const string_type& after_str, const string_type& of_str) { - element_strings(first_str, second_str, third_str, fourth_str, fifth_str, + element_strings(first_str, second_str, third_str, fourth_str, fifth_str, last_str, before_str, after_str, of_str); } @@ -128,19 +130,18 @@ namespace boost { namespace date_time { { 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, + get_partial_date_type(stream_itr_type& sitr, stream_itr_type& stream_end, - std::ios_base& a_ios, + std::ios_base& a_ios, const facet_type& facet) const { // skip leading whitespace - while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } - + while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + day_type d(1); month_type m(1); facet.get(sitr, stream_end, a_ios, d); @@ -152,18 +153,18 @@ namespace boost { namespace date_time { //! returns nth_kday_of_week parsed from stream template nth_kday_type - get_nth_kday_type(stream_itr_type& sitr, + get_nth_kday_type(stream_itr_type& sitr, stream_itr_type& stream_end, - std::ios_base& a_ios, + std::ios_base& a_ios, const facet_type& facet) const { // skip leading whitespace - while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } - + 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; } @@ -173,98 +174,98 @@ namespace boost { namespace date_time { case fifth : { wn = nth_kday_type::fifth; break; } default: { - throw std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'"); - break; + boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'")); + BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(wn = nth_kday_type::first); } } // 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, + get_first_kday_type(stream_itr_type& sitr, stream_itr_type& stream_end, - std::ios_base& a_ios, + std::ios_base& a_ios, const facet_type& facet) const { // skip leading whitespace - while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } - + 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, + get_last_kday_type(stream_itr_type& sitr, stream_itr_type& stream_end, - std::ios_base& a_ios, + std::ios_base& a_ios, const facet_type& facet) const { // skip leading whitespace - while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } - + 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, + get_kday_before_type(stream_itr_type& sitr, stream_itr_type& stream_end, - std::ios_base& a_ios, + std::ios_base& a_ios, const facet_type& facet) const { // skip leading whitespace - while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } - + 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, + get_kday_after_type(stream_itr_type& sitr, stream_itr_type& stream_end, - std::ios_base& a_ios, + std::ios_base& a_ios, const facet_type& facet) const { // skip leading whitespace - while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } - + 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); } @@ -277,13 +278,13 @@ namespace boost { namespace date_time { typename date_generator_parser::phrase_elements ele) const { // skip leading whitespace - while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } + 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 + "'"); + boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'")); } } - + }; template diff --git a/deal.II/contrib/boost/include/boost/date_time/date_generators.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_generators.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/date_time/date_generators.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_generators.hpp index 96cdeead43..1f1a34a667 100644 --- a/deal.II/contrib/boost/include/boost/date_time/date_generators.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_generators.hpp @@ -6,16 +6,18 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 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" +#include +#include +#include namespace boost { namespace date_time { @@ -99,13 +101,11 @@ namespace date_time { date_type get_date(year_type y) const { if((day_ == 29) && (month_ == 2) && !(calendar_type::is_leap_year(y))) { - std::stringstream ss(""); + std::ostringstream 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_); + boost::throw_exception(std::invalid_argument(ss.str())); } + return date_type(y, month_, day_); } date_type operator()(year_type y) const { @@ -141,7 +141,7 @@ namespace date_time { * Dec-31 == "365" */ virtual std::string to_string() const { - std::stringstream ss; + std::ostringstream 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... @@ -154,6 +154,9 @@ namespace date_time { }; + //! 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 /*! Based on the idea in Cal. Calc. for finding holidays that are * the 'first Monday of September'. When instantiated with @@ -229,7 +232,7 @@ namespace date_time { /*! Returns a string formatted as "M4.3.0" ==> 3rd Sunday in April. */ virtual std::string to_string() const { - std::stringstream ss; + std::ostringstream ss; ss << 'M' << static_cast(month_) << '.' << static_cast(wn_) << '.' @@ -242,9 +245,6 @@ namespace date_time { 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 @@ -275,7 +275,7 @@ namespace date_time { d = d + one_day; } return d; - } + } // added for streaming month_type month() const { @@ -289,7 +289,7 @@ namespace date_time { /*! Returns a string formatted as "M4.1.0" ==> 1st Sunday in April. */ virtual std::string to_string() const { - std::stringstream ss; + std::ostringstream ss; ss << 'M' << static_cast(month_) << '.' << 1 << '.' @@ -350,7 +350,7 @@ namespace date_time { /*! Returns a string formatted as "M4.5.0" ==> last Sunday in April. */ virtual std::string to_string() const { - std::stringstream ss; + std::ostringstream ss; ss << 'M' << static_cast(month_) << '.' << 5 << '.' diff --git a/deal.II/contrib/boost/include/boost/date_time/date_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/date_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/date_names_put.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_names_put.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/date_names_put.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_names_put.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/date_parsing.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_parsing.hpp similarity index 69% rename from deal.II/contrib/boost/include/boost/date_time/date_parsing.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/date_parsing.hpp index ae09158967..f361bc8096 100644 --- a/deal.II/contrib/boost/include/boost/date_time/date_parsing.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/date_parsing.hpp @@ -2,22 +2,22 @@ #define _DATE_TIME_DATE_PARSING_HPP___ /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * 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) $ + * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ */ -#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 +#include +#include +#include +#include -#if defined(BOOST_NO_STD_LOCALE) +#if defined(BOOST_DATE_TIME_NO_LOCALE) #include // ::tolower(int) #else #include // std::tolower(char, locale) @@ -29,43 +29,43 @@ 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 + * 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++))); + std::string + convert_to_lower(std::string inp) + { +#if !defined(BOOST_DATE_TIME_NO_LOCALE) + const std::locale loc(std::locale::classic()); +#endif + std::string::size_type i = 0, n = inp.length(); + for (; i < n; ++i) { + inp[i] = +#if defined(BOOST_DATE_TIME_NO_LOCALE) + static_cast(std::tolower(inp[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); + std::tolower(inp[i], loc); #endif - - } - return tmp; } - + return inp; + } + //! 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) { + inline unsigned short + month_str_to_ushort(std::string const& s) { if((s.at(0) >= '0') && (s.at(0) <= '9')) { return boost::lexical_cast(s); - } + } else { - s = convert_to_lower(s); + std::string str = 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); + typename month_type::month_map_type::iterator iter = ptr->find(str); if(iter != ptr->end()) { // required for STLport return iter->second; } @@ -74,44 +74,45 @@ namespace date_time { } //! 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. + /*! find_match searches both arrays for a match to 's'. Both arrays + * must contain 'size' elements. The index of the match is returned. + * If no match is found, 'size' 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 */ + * 'size' can be sent in with: (greg_month::max)() (which 12), + * (greg_weekday::max)() + 1 (which is 7) or date_time::NumSpecialValues */ template - short find_match(const charT* const* short_names, - const charT* const* long_names, - short limit, + short find_match(const charT* const* short_names, + const charT* const* long_names, + short size, const std::basic_string& s) { - for(short i = 0; i <= limit; ++i){ + for(short i = 0; i < size; ++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 + return size; // 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 + * "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(""); + 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; @@ -128,21 +129,21 @@ namespace date_time { 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(); + for(tokenizer_iterator beg=tok.begin(); + beg!=tok.end() && pos < spec_str.size(); ++beg, ++pos) { switch(spec_str.at(pos)) { - case 'y': + case 'y': { year = boost::lexical_cast(*beg); break; } - case 'm': + case 'm': { month = month_str_to_ushort(*beg); break; } - case 'd': + case 'd': { day = boost::lexical_cast(*beg); break; @@ -151,7 +152,7 @@ namespace date_time { } return date_type(year, month, day); } - + //! Generic function to parse undelimited date (eg: 20020201) template date_type @@ -161,16 +162,16 @@ namespace date_time { 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. + + /* 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, + + 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) { @@ -184,34 +185,34 @@ namespace date_time { } 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 + * begining & end of a char[] or string. All elements are * used in output string */ template - inline + inline date_type - from_stream_type(iterator_type& beg, - iterator_type& end, - char) + from_stream_type(iterator_type& beg, + iterator_type const& end, + char) { - std::stringstream ss(""); + std::ostringstream 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 + inline date_type - from_stream_type(iterator_type& beg, - iterator_type& end, - std::string) + from_stream_type(iterator_type& beg, + iterator_type const& /* end */, + std::string const&) { return parse_date(*beg); } @@ -220,22 +221,30 @@ namespace date_time { * 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 + * 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) + inline + date_type from_stream_type(iterator_type& beg, + iterator_type const& end, + wchar_t) { - std::stringstream ss(""); - while(beg != end) { + std::ostringstream ss; #if !defined(BOOST_DATE_TIME_NO_LOCALE) - ss << std::use_facet >(std::locale()).narrow(*beg++, 'X'); // 'X' will cause exception to be thrown + std::locale loc; + std::ctype const& fac = std::use_facet >(loc); + while(beg != end) { + ss << fac.narrow(*beg++, 'X'); // 'X' will cause exception to be thrown + } #else - ss << ss.narrow(*beg++, 'X'); -#endif + while(beg != end) { + char c = 'X'; // 'X' will cause exception to be thrown + const wchar_t wc = *beg++; + if (wc >= 0 && wc <= 127) + c = static_cast< char >(wc); + ss << c; } +#endif return parse_date(ss.str()); } #ifndef BOOST_NO_STD_WSTRING @@ -243,21 +252,29 @@ namespace date_time { /*! Creates a string from the first wstring found in the stream * referenced by the begining & end iterators */ template - inline + inline date_type - from_stream_type(iterator_type& beg, - iterator_type& end, - std::wstring) { + from_stream_type(iterator_type& beg, + iterator_type const& /* end */, + std::wstring const&) { std::wstring ws = *beg; - std::stringstream ss(""); + std::ostringstream 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 + std::locale loc; + std::ctype const& fac = std::use_facet >(loc); + while(wsb != wse) { + ss << fac.narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown + } #else - ss << ss.narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown -#endif + while(wsb != wse) { + char c = 'X'; // 'X' will cause exception to be thrown + const wchar_t wc = *wsb++; + if (wc >= 0 && wc <= 127) + c = static_cast< char >(wc); + ss << c; } +#endif return parse_date(ss.str()); } #endif // BOOST_NO_STD_WSTRING @@ -266,30 +283,30 @@ namespace date_time { #else //! function called by wrapper functions: date_period_from_(w)string() template - period + 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, + 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(); + 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(); + 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_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); + return period(d1, d2); } #endif - + } } //namespace date_time diff --git a/deal.II/contrib/boost/include/boost/date_time/dst_rules.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/dst_rules.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/dst_rules.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/dst_rules.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/dst_transition_generators.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/dst_transition_generators.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/dst_transition_generators.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/dst_transition_generators.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/date_time/filetime_functions.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/filetime_functions.hpp new file mode 100644 index 0000000000..27ed754f74 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/filetime_functions.hpp @@ -0,0 +1,170 @@ +#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: 2009-06-06 07:24:09 -0400 (Sat, 06 Jun 2009) $ + */ + +/*! @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 + +#if defined(BOOST_USE_WINDOWS_H) +# include +#endif + +#include +#include +#include + +namespace boost { + +namespace date_time { + +namespace winapi { + +#if !defined(BOOST_USE_WINDOWS_H) + + extern "C" { + + struct FILETIME + { + boost::uint32_t dwLowDateTime; + boost::uint32_t dwHighDateTime; + }; + struct SYSTEMTIME + { + boost::uint16_t wYear; + boost::uint16_t wMonth; + boost::uint16_t wDayOfWeek; + boost::uint16_t wDay; + boost::uint16_t wHour; + boost::uint16_t wMinute; + boost::uint16_t wSecond; + boost::uint16_t wMilliseconds; + }; + + __declspec(dllimport) void __stdcall GetSystemTimeAsFileTime(FILETIME* lpFileTime); + __declspec(dllimport) int __stdcall FileTimeToLocalFileTime(const FILETIME* lpFileTime, FILETIME* lpLocalFileTime); + __declspec(dllimport) void __stdcall GetSystemTime(SYSTEMTIME* lpSystemTime); + __declspec(dllimport) int __stdcall SystemTimeToFileTime(const SYSTEMTIME* lpSystemTime, FILETIME* lpFileTime); + + } // extern "C" + +#endif // defined(BOOST_USE_WINDOWS_H) + + typedef FILETIME file_time; + typedef SYSTEMTIME system_time; + + inline void get_system_time_as_file_time(file_time& ft) + { +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + // Some runtime library implementations expect local times as the norm for ctime. + file_time ft_utc; + GetSystemTimeAsFileTime(&ft_utc); + FileTimeToLocalFileTime(&ft_utc, &ft); +#elif defined(BOOST_NO_GETSYSTEMTIMEASFILETIME) + system_time st; + GetSystemTime(&st); + SystemTimeToFileTime(&st, &ft); +#else + GetSystemTimeAsFileTime(&ft); +#endif + } + + /*! + * The function converts file_time into number of microseconds elapsed since 1970-Jan-01 + * + * \note Only dates after 1970-Jan-01 are supported. Dates before will be wrapped. + * + * \note The function is templated on the FILETIME type, so that + * it can be used with both native FILETIME and the ad-hoc + * boost::date_time::winapi::file_time type. + */ + template< typename FileTimeT > + inline boost::uint64_t file_time_to_microseconds(FileTimeT const& ft) + { + /* shift is difference between 1970-Jan-01 & 1601-Jan-01 + * in 100-nanosecond intervals */ + const uint64_t shift = 116444736000000000ULL; // (27111902 << 32) + 3577643008 + + union { + FileTimeT as_file_time; + uint64_t as_integer; // 100-nanos since 1601-Jan-01 + } caster; + caster.as_file_time = ft; + + caster.as_integer -= shift; // filetime is now 100-nanos since 1970-Jan-01 + return (caster.as_integer / 10); // truncate to microseconds + } + +} // namespace winapi + +//! 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 file_time's sub second value + * will be truncated. Nanosecond resolution has no truncation. + * + * \note The function is templated on the FILETIME type, so that + * it can be used with both native FILETIME and the ad-hoc + * boost::date_time::winapi::file_time type. + */ +template< typename TimeT, typename FileTimeT > +inline +TimeT time_from_ftime(const FileTimeT& ft) +{ + typedef typename TimeT::date_type date_type; + typedef typename TimeT::date_duration_type date_duration_type; + typedef typename TimeT::time_duration_type time_duration_type; + + // https://svn.boost.org/trac/boost/ticket/2523 + // Since this function can be called with arbitrary times, including ones that + // are before 1970-Jan-01, we'll have to cast the time a bit differently, + // than it is done in the file_time_to_microseconds function. This allows to + // avoid integer wrapping for dates before 1970-Jan-01. + union { + FileTimeT as_file_time; + uint64_t as_integer; // 100-nanos since 1601-Jan-01 + } caster; + caster.as_file_time = ft; + + uint64_t sec = caster.as_integer / 10000000UL; + uint32_t sub_sec = (caster.as_integer % 10000000UL) // 100-nanoseconds since the last second +#if !defined(BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG) + / 10; // microseconds since the last second +#else + * 100; // nanoseconds since the last second +#endif + + // split sec into usable chunks: days, hours, minutes, & seconds + const uint32_t sec_per_day = 86400; // seconds per day + uint32_t days = static_cast< uint32_t >(sec / sec_per_day); + uint32_t tmp = static_cast< uint32_t >(sec % sec_per_day); + uint32_t hours = tmp / 3600; // sec_per_hour + tmp %= 3600; + uint32_t minutes = tmp / 60; // sec_per_min + tmp %= 60; + uint32_t seconds = tmp; // seconds + + date_duration_type dd(days); + date_type d = date_type(1601, Jan, 01) + dd; + return TimeT(d, time_duration_type(hours, minutes, seconds, sub_sec)); +} + +}} // boost::date_time + +#endif // BOOST_HAS_FTIME + +#endif // DATE_TIME_FILETIME_FUNCTIONS_HPP__ diff --git a/deal.II/contrib/boost/include/boost/date_time/format_date_parser.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/format_date_parser.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/date_time/format_date_parser.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/format_date_parser.hpp index 63a78396ce..a4a4d0dfbe 100644 --- a/deal.II/contrib/boost/include/boost/date_time/format_date_parser.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/format_date_parser.hpp @@ -7,7 +7,7 @@ * 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) $ + * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ */ @@ -17,7 +17,20 @@ #include "boost/date_time/special_values_parser.hpp" #include #include +#include +#include +#ifndef BOOST_NO_STDC_NAMESPACE +# include +#else +# include +#endif +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std { + using ::isspace; + using ::isdigit; +} +#endif namespace boost { namespace date_time { //! Helper function for parsing fixed length strings into integers @@ -57,7 +70,7 @@ fixed_string_to_int(std::istreambuf_iterator& itr, } try { i = boost::lexical_cast(mr.cache); - }catch(bad_lexical_cast blc){ + }catch(bad_lexical_cast&){ // we want to return -1 if the cast fails so nothing to do here } return i; @@ -87,19 +100,19 @@ template inline int_type var_string_to_int(std::istreambuf_iterator& itr, - std::istreambuf_iterator& /* stream_end */, + const 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)) { + while (itr != stream_end && (j < max_length) && std::isdigit(*itr)) { s += (*itr); - itr++; - j++; + ++itr; + ++j; } int_type i = -1; - if(s.length() != 0) { + if(!s.empty()) { i = boost::lexical_cast(s); } return i; @@ -139,7 +152,7 @@ class format_date_parser { public: typedef std::basic_string string_type; - typedef std::basic_ostringstream stringstream_type; + typedef std::basic_istringstream 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; @@ -216,8 +229,7 @@ class format_date_parser const string_type& format_str, const special_values_parser& sv_parser) const { - stringstream_type ss; - ss << value; + stringstream_type ss(value); stream_itr_type sitr(ss); stream_itr_type stream_end; return parse_date(sitr, stream_end, format_str, sv_parser); diff --git a/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/conversion.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/conversion.hpp new file mode 100644 index 0000000000..f35796ee7f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/conversion.hpp @@ -0,0 +1,66 @@ +#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: 2009-06-06 07:27:35 -0400 (Sat, 06 Jun 2009) $ + */ + +#include +#include +#include +#include +#include +#include + +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_special()) + { + std::string s = "tm unable to handle "; + switch (d.as_special()) + { + case date_time::not_a_date_time: + s += "not-a-date-time value"; break; + case date_time::neg_infin: + s += "-infinity date value"; break; + case date_time::pos_infin: + s += "+infinity date value"; break; + default: + s += "a special date value"; break; + } + boost::throw_exception(std::out_of_range(s)); + } + + std::tm datetm = {}; // zero initialization is needed for extension members, like tm_zone + 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_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/date_time/gregorian/formatters.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/formatters.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/formatters.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/formatters.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/formatters_limited.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/formatters_limited.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/formatters_limited.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/formatters_limited.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_calendar.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_calendar.hpp similarity index 74% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/greg_calendar.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_calendar.hpp index b8b1f5a69d..48b84604d1 100644 --- a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_calendar.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_calendar.hpp @@ -6,20 +6,21 @@ * 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) $ + * $Date: 2009-09-28 14:10:02 -0400 (Mon, 28 Sep 2009) $ */ -#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" +#include +#include +#include +#include +#include +#include namespace boost { namespace gregorian { //!An internal date representation that includes infinities, not a date - typedef date_time::int_adapter fancy_date_rep; + typedef date_time::int_adapter fancy_date_rep; //! Gregorian calendar for this implementation, hard work in the base class gregorian_calendar : diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_date.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_date.hpp similarity index 90% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/greg_date.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_date.hpp index 2d34b2a0e0..772c783d9d 100644 --- a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_date.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_date.hpp @@ -6,13 +6,14 @@ * 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) $ + * $Date: 2009-09-28 14:10:02 -0400 (Mon, 28 Sep 2009) $ */ -#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" +#include +#include +#include +#include +#include namespace boost { namespace gregorian { @@ -55,7 +56,7 @@ namespace gregorian { : 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")); + boost::throw_exception(bad_day_of_month(std::string("Day of month is not valid for year"))); } } //! Constructor from a ymd_type structure @@ -98,7 +99,7 @@ namespace gregorian { return day_of_year_type(doy); } //!Return the Modified Julian Day number for the date. - long modjulian_day() const + date_int_type modjulian_day() const { ymd_type ymd = year_month_day(); return gregorian_calendar::modjulian_day_number(ymd); diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_day.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_day.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/greg_day.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_day.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_day_of_year.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_day_of_year.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/greg_day_of_year.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_day_of_year.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_duration.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_duration.hpp new file mode 100644 index 0000000000..fd7554201e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_duration.hpp @@ -0,0 +1,134 @@ +#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-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + */ + +#include +#include +#include + +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 + */ + class date_duration : + public boost::date_time::date_duration< date_duration_rep > + { + typedef boost::date_time::date_duration< date_duration_rep > base_type; + + public: + typedef base_type::duration_rep duration_rep; + + //! Construct from a day count + explicit date_duration(duration_rep day_count = 0) : base_type(day_count) {} + + //! construct from special_values + date_duration(date_time::special_values sv) : base_type(sv) {} + + //! Copy constructor + date_duration(const date_duration& other) : base_type(static_cast< base_type const& >(other)) + {} + + //! Construct from another date_duration + date_duration(const base_type& other) : base_type(other) + {} + + // Relational operators + // NOTE: Because of date_time::date_duration< T > design choice we don't use Boost.Operators here, + // because we need the class to be a direct base. Either lose EBO, or define operators by hand. + // The latter is more effecient. + bool operator== (const date_duration& rhs) const + { + return base_type::operator== (rhs); + } + bool operator!= (const date_duration& rhs) const + { + return !operator== (rhs); + } + bool operator< (const date_duration& rhs) const + { + return base_type::operator< (rhs); + } + bool operator> (const date_duration& rhs) const + { + return !(base_type::operator< (rhs) || base_type::operator== (rhs)); + } + bool operator<= (const date_duration& rhs) const + { + return (base_type::operator< (rhs) || base_type::operator== (rhs)); + } + bool operator>= (const date_duration& rhs) const + { + return !base_type::operator< (rhs); + } + + //! Subtract another duration -- result is signed + date_duration& operator-= (const date_duration& rhs) + { + base_type::operator-= (rhs); + return *this; + } + friend date_duration operator- (date_duration rhs, date_duration const& lhs) + { + rhs -= lhs; + return rhs; + } + + //! Add a duration -- result is signed + date_duration& operator+= (const date_duration& rhs) + { + base_type::operator+= (rhs); + return *this; + } + friend date_duration operator+ (date_duration rhs, date_duration const& lhs) + { + rhs += lhs; + return rhs; + } + + //! 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) + { + base_type::operator/= (divisor); + return *this; + } + friend date_duration operator/ (date_duration rhs, int lhs) + { + rhs /= lhs; + return rhs; + } + + //! Returns the smallest duration -- used by to calculate 'end' + static date_duration unit() + { + return date_duration(base_type::unit().get_rep()); + } + }; + + //! Shorthand for date_duration + typedef date_duration days; + +} } //namespace gregorian + +#if defined(BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES) +#include +#endif + +#endif diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_duration_types.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_duration_types.hpp similarity index 62% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/greg_duration_types.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_duration_types.hpp index 9e85ae768f..3d1ce62183 100644 --- a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_duration_types.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_duration_types.hpp @@ -5,15 +5,15 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 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" +#include +#include +#include +#include +#include namespace boost { namespace gregorian { @@ -27,7 +27,16 @@ namespace gregorian { typedef date_time::months_duration months; typedef date_time::years_duration years; - typedef date_time::weeks_duration weeks; + + class weeks_duration : public date_duration { + public: + weeks_duration(duration_rep w) + : date_duration(w * 7) {} + weeks_duration(date_time::special_values sv) + : date_duration(sv) {} + }; + + typedef weeks_duration weeks; }} // namespace boost::gregorian diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_facet.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_facet.hpp similarity index 90% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/greg_facet.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_facet.hpp index 876c980471..9c3877ed03 100644 --- a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_facet.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_facet.hpp @@ -6,18 +6,21 @@ * 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) $ + * $Date: 2008-11-23 06:13:35 -0500 (Sun, 23 Nov 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 +#include +#include +#include +#include +#include namespace boost { namespace gregorian { @@ -281,22 +284,22 @@ namespace gregorian { 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); + (greg_month::max)(), s); // greg_month spans 1..12, so max returns the array size, + // which is needed by find_match } /* 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; + catch(std::bad_cast&){ charT a = '\0'; - const facet_def* f = create_facet_def(a); + std::auto_ptr< 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); + (greg_month::max)(), s); // greg_month spans 1..12, so max returns the array size, + // which is needed by find_match } - num += 1; // months numbered 1-12 + ++num; // months numbered 1-12 m = greg_month(num); return is; @@ -323,19 +326,19 @@ namespace gregorian { 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); + (greg_weekday::max)() + 1, s); // greg_weekday spans 0..6, so increment is needed + // to form the array size which is needed by find_match } /* 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; + catch(std::bad_cast&){ charT a = '\0'; - const facet_def* f = create_facet_def(a); + std::auto_ptr< 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); + (greg_weekday::max)() + 1, s); // greg_weekday spans 0..6, so increment is needed + // to form the array size which is needed by find_match } wd = greg_weekday(num); // weekdays numbered 0-6 diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_month.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_month.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/greg_month.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_month.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_serialize.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_serialize.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/greg_serialize.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_serialize.hpp index b39b3a4e01..c48cc0ae37 100644 --- a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_serialize.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_serialize.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ #include "boost/date_time/gregorian/gregorian_types.hpp" @@ -72,10 +72,10 @@ void load(Archive & ar, ar & make_nvp("date", ds); try{ d = ::boost::gregorian::from_undelimited_string(ds); - }catch(bad_lexical_cast be) { + }catch(bad_lexical_cast&) { gregorian::special_values sv = gregorian::special_value_from_string(ds); if(sv == gregorian::not_special) { - throw(be); // no match found, rethrow original exception + throw; // no match found, rethrow original exception } else { d = gregorian::date(sv); diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_weekday.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_weekday.hpp similarity index 93% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/greg_weekday.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_weekday.hpp index 3c4a6a5667..9b566c440d 100644 --- a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_weekday.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_weekday.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ #include "boost/date_time/constrained_value.hpp" @@ -31,7 +31,7 @@ namespace gregorian { //! 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")) {} + bad_weekday() : std::out_of_range(std::string("Weekday is out of range 0..6")) {} }; typedef CV::simple_exception_policy greg_weekday_policies; typedef CV::constrained_value greg_weekday_rep; diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_year.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_year.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/greg_year.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_year.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/greg_ymd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_ymd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/greg_ymd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/greg_ymd.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/gregorian.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/gregorian.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/gregorian.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/gregorian.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/gregorian_io.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/gregorian_io.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/gregorian_io.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/gregorian_io.hpp index 5f4fd85ec1..62a759f55c 100644 --- a/deal.II/contrib/boost/include/boost/date_time/gregorian/gregorian_io.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/gregorian_io.hpp @@ -6,13 +6,20 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ -#include "boost/date_time/date_facet.hpp" -#include "boost/io/ios_state.hpp" -#include #include +#include +#include // i/ostreambuf_iterator +#include +#include +#include +#include +#include +#include +#include +#include // to_tm will be needed in the facets namespace boost { namespace gregorian { diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/gregorian_types.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/gregorian_types.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/gregorian_types.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/gregorian_types.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian/parsers.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/parsers.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/gregorian/parsers.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian/parsers.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian_calendar.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian_calendar.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/date_time/gregorian_calendar.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian_calendar.hpp index 6386008bea..3df1ed59f9 100644 --- a/deal.II/contrib/boost/include/boost/date_time/gregorian_calendar.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian_calendar.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2009-09-28 14:10:02 -0400 (Mon, 28 Sep 2009) $ */ @@ -44,10 +44,10 @@ namespace date_time { //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 date_int_type 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 ymd_type from_modjulian_day_number(date_int_type); static bool is_leap_year(year_type); static unsigned short end_of_month_day(year_type y, month_type m); static ymd_type epoch(); diff --git a/deal.II/contrib/boost/include/boost/date_time/gregorian_calendar.ipp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian_calendar.ipp similarity index 97% rename from deal.II/contrib/boost/include/boost/date_time/gregorian_calendar.ipp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian_calendar.ipp index 36bb4b9f8d..85a3747d09 100644 --- a/deal.II/contrib/boost/include/boost/date_time/gregorian_calendar.ipp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/gregorian_calendar.ipp @@ -3,7 +3,7 @@ * 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) $ + * $Date: 2009-09-28 14:10:02 -0400 (Mon, 28 Sep 2009) $ */ #ifndef NO_BOOST_DATE_TIME_INLINE @@ -14,7 +14,7 @@ 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 + /*! Converts a year-month-day into a day of the week number */ template BOOST_DATE_TIME_INLINE @@ -99,7 +99,7 @@ namespace date_time { */ template BOOST_DATE_TIME_INLINE - long + date_int_type_ gregorian_calendar_base::modjulian_day_number(const ymd_type& ymd) { return julian_day_number(ymd)-2400001; //prerounded @@ -149,7 +149,7 @@ namespace date_time { template BOOST_DATE_TIME_INLINE ymd_type_ - gregorian_calendar_base::from_modjulian_day_number(long dayNumber) { + gregorian_calendar_base::from_modjulian_day_number(date_int_type dayNumber) { date_int_type jd = dayNumber + 2400001; //is 2400000.5 prerounded return from_julian_day_number(jd); } diff --git a/deal.II/contrib/boost/include/boost/date_time/int_adapter.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/int_adapter.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/date_time/int_adapter.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/int_adapter.hpp index a6ce1ec404..fc98fc1278 100644 --- a/deal.II/contrib/boost/include/boost/date_time/int_adapter.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/int_adapter.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ @@ -14,7 +14,9 @@ #include "boost/limits.hpp" //work around compilers without limits #include "boost/date_time/special_defs.hpp" #include "boost/date_time/locale_config.hpp" -#include +#ifndef BOOST_DATE_TIME_NO_LOCALE +# include +#endif namespace boost { namespace date_time { diff --git a/deal.II/contrib/boost/include/boost/date_time/iso_format.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/iso_format.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/iso_format.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/iso_format.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/local_time/conversion.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/conversion.hpp similarity index 83% rename from deal.II/contrib/boost/include/boost/date_time/local_time/conversion.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/conversion.hpp index 03c612f3ff..13e4d3eb5c 100644 --- a/deal.II/contrib/boost/include/boost/date_time/local_time/conversion.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/conversion.hpp @@ -5,7 +5,7 @@ * 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) $ + * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ */ @@ -18,9 +18,8 @@ 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()); +std::tm to_tm(const local_date_time& lt) { + std::tm lt_tm = posix_time::to_tm(lt.local_time()); if(lt.is_dst()){ lt_tm.tm_isdst = 1; } diff --git a/deal.II/contrib/boost/include/boost/date_time/local_time/custom_time_zone.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/custom_time_zone.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/local_time/custom_time_zone.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/custom_time_zone.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/local_time/date_duration_operators.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/date_duration_operators.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/local_time/date_duration_operators.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/date_duration_operators.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/local_time/dst_transition_day_rules.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/dst_transition_day_rules.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/local_time/dst_transition_day_rules.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/dst_transition_day_rules.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/local_time/local_date_time.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/local_date_time.hpp similarity index 93% rename from deal.II/contrib/boost/include/boost/date_time/local_time/local_date_time.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/local_date_time.hpp index d1967fe242..166c4034e1 100644 --- a/deal.II/contrib/boost/include/boost/date_time/local_time/local_date_time.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/local_date_time.hpp @@ -5,18 +5,21 @@ * 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) $ + * $Date: 2009-09-28 14:10:02 -0400 (Mon, 28 Sep 2009) $ */ - -#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 #include +#include +#include +#include +#include +#include //todo remove? +#include +#include +#include +#include // absolute_value namespace boost { namespace local_time { @@ -24,19 +27,19 @@ 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)) {} + ambiguous_result (std::string const& msg = std::string()) : + 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)) {} + time_label_invalid (std::string const& msg = std::string()) : + 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)) {} + dst_not_valid(std::string const& msg = std::string()) : + 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 @@ -110,17 +113,17 @@ namespace local_time { // 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; + std::ostringstream ss; ss << "time given: " << d << ' ' << td; - throw time_label_invalid(ss.str()); + boost::throw_exception(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()); + std::ostringstream ss; + ss.setf(std::ios_base::boolalpha); + ss << "flag given: dst=" << dst_flag << ", dst calculated: dst=" << in_dst; + boost::throw_exception(dst_not_valid(ss.str())); } // everything checks out and conversion to utc already done @@ -146,9 +149,9 @@ namespace local_time { time_is_dst_result result = check_dst(d, td, tz); if(result == ambiguous) { if(calc_option == EXCEPTION_ON_ERROR){ - std::stringstream ss; + std::ostringstream ss; ss << "time given: " << d << ' ' << td; - throw ambiguous_result(ss.str()); + boost::throw_exception(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)); @@ -156,9 +159,9 @@ namespace local_time { } else if(result == invalid_time_label){ if(calc_option == EXCEPTION_ON_ERROR){ - std::stringstream ss; + std::ostringstream ss; ss << "time given: " << d << ' ' << td; - throw time_label_invalid(ss.str()); + boost::throw_exception(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)); @@ -278,7 +281,7 @@ namespace local_time { std::string to_string() const { //TODO is this a temporary function ??? - std::stringstream ss; + std::ostringstream ss; if(this->is_special()){ ss << utc_time(); return ss.str(); @@ -497,7 +500,7 @@ namespace local_time { std::string zone_as_offset(const time_duration_type& td, const std::string& separator) const { - std::stringstream ss; + std::ostringstream ss; if(td.is_negative()) { // a negative duration is represented as "-[h]h:mm" // we require two digits for the hour. A positive duration diff --git a/deal.II/contrib/boost/include/boost/date_time/local_time/local_time.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/local_time.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/local_time/local_time.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/local_time.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/local_time/local_time_io.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/local_time_io.hpp similarity index 57% rename from deal.II/contrib/boost/include/boost/date_time/local_time/local_time_io.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/local_time_io.hpp index fbd34b6f98..c161ff7e23 100644 --- a/deal.II/contrib/boost/include/boost/date_time/local_time/local_time_io.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/local_time_io.hpp @@ -5,15 +5,18 @@ * 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) $ + * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $ */ +#include #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" +#include // i/ostreambuf_iterator +#include +#include +#include +#include +#include +#include // to_tm will be needed in the facets namespace boost { namespace local_time { @@ -23,7 +26,7 @@ namespace local_time { 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 @@ -35,7 +38,7 @@ namespace local_time { 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, @@ -60,7 +63,7 @@ namespace local_time { 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); + typename std::basic_istream::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename local_date_time::utc_time_type utc_time_type; @@ -69,7 +72,7 @@ namespace local_time { // 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); @@ -92,27 +95,92 @@ namespace local_time { ldt = local_date_time(pt.date(), pt.time_of_day(), tz_ptr, local_date_time::EXCEPTION_ON_ERROR); } } - catch(...) { + 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); } + 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); - } - + is.setstate(std::ios_base::failbit); + } + + } + } + return is; + } + + //! output operator for local_time_period + template + inline + std::basic_ostream& + operator<<(std::basic_ostream& os, + const boost::local_time::local_time_period& p) { + boost::io::ios_flags_saver iflags(os); + typedef boost::date_time::time_facet custom_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. + custom_facet* f = new custom_facet(); + std::locale l = std::locale(os.getloc(), f); + os.imbue(l); + f->put(oitr, os, os.fill(), p); + } + return os; + } + + //! input operator for local_time_period + template + inline + std::basic_istream& + operator>>(std::basic_istream& is, boost::local_time::local_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; } - } } // namespaces #endif // BOOST_DATE_TIME_LOCAL_TIME_IO_HPP__ diff --git a/deal.II/contrib/boost/include/boost/date_time/local_time/local_time_types.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/local_time_types.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/local_time/local_time_types.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/local_time_types.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/local_time/posix_time_zone.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/posix_time_zone.hpp similarity index 86% rename from deal.II/contrib/boost/include/boost/date_time/local_time/posix_time_zone.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/posix_time_zone.hpp index c8f0fb798a..416c95b68b 100644 --- a/deal.II/contrib/boost/include/boost/date_time/local_time/posix_time_zone.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/posix_time_zone.hpp @@ -5,20 +5,21 @@ * 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) $ + * $Date: 2009-10-03 06:04:00 -0400 (Sat, 03 Oct 2009) $ */ #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 +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace boost{ namespace local_time{ @@ -26,12 +27,14 @@ 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)) {} + bad_offset(std::string const& msg = std::string()) : + 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)) {} + bad_adjustment(std::string const& msg = std::string()) : + std::out_of_range(std::string("Adjustment out of range: " + msg)) {} }; typedef boost::date_time::dst_adjustment_offsets dst_adjustment_offsets; @@ -56,9 +59,12 @@ namespace local_time{ * 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 UTC zone that is greater than +14 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)
+ * + * Note that UTC zone offsets can be greater than +12: + * http://www.worldtimezone.com/utc/utc+1200.html */ template class posix_time_zone_base : public date_time::time_zone_base { @@ -86,7 +92,13 @@ namespace local_time{ dst_offsets_(posix_time::hours(0),posix_time::hours(0),posix_time::hours(0)), dst_calc_rules_() { +#ifdef __HP_aCC + // Work around bug in aC++ compiler: see QXCR1000880488 in the + // HP bug tracking system + const char_type sep_chars[2] = {',',0}; +#else const char_type sep_chars[2] = {','}; +#endif char_separator_type sep(sep_chars); tokenizer_type tokens(s, sep); tokenizer_iterator_type it = tokens.begin(); @@ -231,7 +243,7 @@ namespace local_time{ 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(); + typename string_type::const_pointer sit = obj.c_str(), obj_end = sit + obj.size(); string_type l_std_zone_abbrev, l_dst_zone_abbrev; // get 'std' name/abbrev @@ -242,37 +254,37 @@ namespace local_time{ ss.str(empty_string); // get UTC offset - if(sit != obj.end()){ + if(sit != obj_end){ // get duration - while(sit != obj.end() && !std::isalpha(*sit)){ - ss << *sit++; + 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 + // base offset must be within range of -12 hours to +14 hours if(base_utc_offset_ < time_duration_type(-12,0,0) || - base_utc_offset_ > time_duration_type(12,0,0)) + base_utc_offset_ > time_duration_type(14,0,0)) { - throw bad_offset(posix_time::to_simple_string(base_utc_offset_)); + boost::throw_exception(bad_offset(posix_time::to_simple_string(base_utc_offset_))); } } // get DST data if given - if(sit != obj.end()){ + if(sit != obj_end){ has_dst_ = true; // get 'dst' name/abbrev - while(sit != obj.end() && std::isalpha(*sit)){ + 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()){ + if(sit != obj_end){ // get duration - while(sit != obj.end() && !std::isalpha(*sit)){ + while(sit != obj_end && !std::isalpha(*sit)){ ss << *sit++; } dst_offsets_.dst_adjust_ = date_time::str_from_delimited_time_duration(ss.str()); @@ -286,7 +298,7 @@ namespace local_time{ 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_)); + boost::throw_exception(bad_adjustment(posix_time::to_simple_string(dst_offsets_.dst_adjust_))); } } // full names not extracted so abbrevs used in their place @@ -294,7 +306,13 @@ namespace local_time{ } void calc_rules(const string_type& start, const string_type& end){ +#ifdef __HP_aCC + // Work around bug in aC++ compiler: see QXCR1000880488 in the + // HP bug tracking system + const char_type sep_chars[2] = {'/',0}; +#else const char_type sep_chars[2] = {'/'}; +#endif char_separator_type sep(sep_chars); tokenizer_type st_tok(start, sep); tokenizer_type et_tok(end, sep); @@ -328,7 +346,7 @@ namespace local_time{ 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_)); + boost::throw_exception(bad_offset(posix_time::to_simple_string(dst_offsets_.dst_start_offset_))); } // ending offset @@ -343,7 +361,7 @@ namespace local_time{ 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_)); + boost::throw_exception(bad_offset(posix_time::to_simple_string(dst_offsets_.dst_end_offset_))); } } @@ -354,7 +372,13 @@ namespace local_time{ 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 +#ifdef __HP_aCC + // Work around bug in aC++ compiler: see QXCR1000880488 in the + // HP bug tracking system + const char_type sep_chars[3] = {'M','.',0}; +#else const char_type sep_chars[3] = {'M','.'}; +#endif char_separator_type sep(sep_chars); tokenizer_type stok(s, sep), etok(e, sep); diff --git a/deal.II/contrib/boost/include/boost/date_time/local_time/tz_database.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/tz_database.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/local_time/tz_database.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time/tz_database.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/local_time_adjustor.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time_adjustor.hpp similarity index 89% rename from deal.II/contrib/boost/include/boost/date_time/local_time_adjustor.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time_adjustor.hpp index 500a730436..eea4d37ae3 100644 --- a/deal.II/contrib/boost/include/boost/date_time/local_time_adjustor.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_time_adjustor.hpp @@ -6,16 +6,20 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 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 +#include +#include +#include +#include +#include // boost::date_time::dst_flags +#include // not_a_date_time namespace boost { namespace date_time { @@ -109,7 +113,7 @@ namespace boost { 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_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: { @@ -125,15 +129,15 @@ namespace boost { } } }//case - //TODO better excpetion type - throw std::out_of_range("Unreachable case"); - + //TODO better exception type + boost::throw_exception(std::out_of_range("Unreachable case")); + BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return time_duration_type(not_a_date_time)); // should never reach } //! 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(); @@ -146,13 +150,14 @@ namespace boost { 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"); + case invalid_time_label: break; } - } - throw std::out_of_range("Time label invalid"); + } + boost::throw_exception(std::out_of_range("Time label invalid")); + BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return time_duration_type(not_a_date_time)); // should never reach } - + private: }; diff --git a/deal.II/contrib/boost/include/boost/date_time/local_timezone_defs.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_timezone_defs.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/date_time/local_timezone_defs.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/local_timezone_defs.hpp index 508fa7f742..fd6d3c2fab 100644 --- a/deal.II/contrib/boost/include/boost/date_time/local_timezone_defs.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/local_timezone_defs.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $ */ #include "boost/date_time/dst_rules.hpp" @@ -66,7 +66,7 @@ namespace boost { if (y < 2007) return Apr; return Mar; } - static day_of_week_type end_day(year_type y) {return Sunday;} + static day_of_week_type end_day(year_type) {return Sunday;} static month_type end_month(year_type y) { if (y < 2007) return Oct; diff --git a/deal.II/contrib/boost/include/boost/date_time/locale_config.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/locale_config.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/locale_config.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/locale_config.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/date_time/microsec_time_clock.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/microsec_time_clock.hpp new file mode 100644 index 0000000000..e6f3b8ecdf --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/microsec_time_clock.hpp @@ -0,0 +1,127 @@ +#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: 2009-06-04 07:36:43 -0400 (Thu, 04 Jun 2009) $ + */ + + +/*! @file microsec_time_clock.hpp + This file contains a high resolution time clock implementation. +*/ + +#include +#include +#include +#include +#include +#include +#include + +#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 + { + private: + //! Type for the function used to convert time_t to tm + typedef std::tm* (*time_converter)(const std::time_t*, std::tm*); + + 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); + } + + //! Returns the local time based on computer clock settings + static time_type local_time() + { + return create_time(&c_time::localtime); + } + + //! Returns the UTC time based on computer settings + static time_type universal_time() + { + return create_time(&c_time::gmtime); + } + + private: + static time_type create_time(time_converter converter) + { +#ifdef BOOST_HAS_GETTIMEOFDAY + timeval tv; + gettimeofday(&tv, 0); //gettimeofday does not support TZ adjust on Linux. + std::time_t t = tv.tv_sec; + boost::uint32_t sub_sec = tv.tv_usec; +#elif defined(BOOST_HAS_FTIME) + winapi::file_time ft; + winapi::get_system_time_as_file_time(ft); + uint64_t micros = winapi::file_time_to_microseconds(ft); // it will not wrap, since ft is the current time + // and cannot be before 1970-Jan-01 + std::time_t t = static_cast(micros / 1000000UL); // seconds since epoch + // microseconds -- static casts supress warnings + boost::uint32_t sub_sec = static_cast(micros % 1000000UL); +#else +#error Internal Boost.DateTime error: BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK is defined, however neither gettimeofday nor FILETIME support is detected. +#endif + + std::tm curr; + std::tm* curr_ptr = converter(&t, &curr); + date_type d(curr_ptr->tm_year + 1900, + curr_ptr->tm_mon + 1, + curr_ptr->tm_mday); + + //The following line will adjust 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< int >(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); + + return time_type(d,td); + } + }; + + +} } //namespace date_time + +#endif //BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK + + +#endif + diff --git a/deal.II/contrib/boost/include/boost/date_time/parse_format_base.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/parse_format_base.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/parse_format_base.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/parse_format_base.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/period.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/period.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/period.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/period.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/period_formatter.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/period_formatter.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/period_formatter.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/period_formatter.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/period_parser.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/period_parser.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/date_time/period_parser.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/period_parser.hpp index 6c480148a5..9cd57e18c7 100644 --- a/deal.II/contrib/boost/include/boost/date_time/period_parser.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/period_parser.hpp @@ -7,11 +7,12 @@ * 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) $ + * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $ */ -#include "boost/date_time/string_parse_tree.hpp" -#include "boost/date_time/string_convert.hpp" +#include +#include +#include namespace boost { namespace date_time { @@ -32,7 +33,7 @@ namespace boost { namespace date_time { * where the date format is controlled by the date facet */ template - class period_parser { + class period_parser { public: typedef std::basic_string string_type; typedef CharT char_type; @@ -41,7 +42,7 @@ namespace boost { namespace date_time { 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]; @@ -50,12 +51,12 @@ namespace boost { namespace date_time { 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, + period_parser(period_range_option range_opt = 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) + : m_range_option(range_opt) { delimiters.push_back(string_type(period_separator)); delimiters.push_back(string_type(period_start_delimeter)); @@ -119,13 +120,13 @@ namespace boost { namespace date_time { period_type get_period(stream_itr_type& sitr, stream_itr_type& stream_end, std::ios_base& a_ios, - const period_type& p, + 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); @@ -144,14 +145,14 @@ namespace boost { namespace date_time { 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; - + 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 @@ -170,7 +171,8 @@ namespace boost { namespace date_time { ++sitr; } if(s != delim) { - throw std::ios_base::failure("Parse failed. Expected '" + convert_string_type(delim) + "' but found '" + convert_string_type(s) + "'"); + boost::throw_exception(std::ios_base::failure("Parse failed. Expected '" + + convert_string_type(delim) + "' but found '" + convert_string_type(s) + "'")); } } }; diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/conversion.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/conversion.hpp similarity index 70% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/conversion.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/conversion.hpp index 27ad6a84f1..a7f84d8d83 100644 --- a/deal.II/contrib/boost/include/boost/date_time/posix_time/conversion.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/conversion.hpp @@ -6,14 +6,15 @@ * 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) $ + * $Date: 2009-09-28 14:10:02 -0400 (Mon, 28 Sep 2009) $ */ -#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" +#include +#include +#include +#include +#include // absolute_value +#include namespace boost { @@ -22,7 +23,7 @@ namespace posix_time { //! Function that converts a time_t into a ptime. inline - ptime from_time_t(std::time_t t) + ptime from_time_t(std::time_t t) { ptime start(gregorian::date(1970,1,1)); return start + seconds(static_cast(t)); @@ -42,14 +43,8 @@ namespace posix_time { //! 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()); + std::tm timetm = {}; + 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 @@ -72,14 +67,18 @@ namespace posix_time { * 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 + * \note FILETIME is part of the Win32 API, so it is not portable to non-windows * platforms. + * + * \note The function is templated on the FILETIME type, so that + * it can be used with both native FILETIME and the ad-hoc + * boost::date_time::winapi::file_time type. */ - template + template< typename TimeT, typename FileTimeT > inline - time_type from_ftime(const FILETIME& ft) + TimeT from_ftime(const FileTimeT& ft) { - return boost::date_time::time_from_ftime(ft); + return boost::date_time::time_from_ftime(ft); } #endif // BOOST_HAS_FTIME diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/date_duration_operators.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/date_duration_operators.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/date_duration_operators.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/date_duration_operators.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_config.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_config.hpp similarity index 88% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_config.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_config.hpp index c40a15cec8..60c3f7ee37 100644 --- a/deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_config.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_config.hpp @@ -2,22 +2,22 @@ #define POSIX_TIME_CONFIG_HPP___ /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * 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) $ + * $Date: 2009-06-04 07:52:28 -0400 (Thu, 04 Jun 2009) $ */ -#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) +#include +#include +#include +#include +#include +#include +#include +#include namespace boost { namespace posix_time { @@ -30,7 +30,7 @@ namespace posix_time { #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 @@ -38,14 +38,14 @@ namespace posix_time { #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, + 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 @@ -82,8 +82,8 @@ namespace posix_time { //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) + explicit time_duration(impl_type tick_count) : + date_time::time_duration(tick_count) {} }; @@ -134,7 +134,7 @@ namespace posix_time { } }; - class posix_time_system_config + class posix_time_system_config { public: typedef simple_time_rep time_rep_type; @@ -143,7 +143,7 @@ namespace posix_time { 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 +#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers #else BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000000); #endif @@ -151,7 +151,7 @@ namespace posix_time { #else - class millisec_posix_time_system_config + class millisec_posix_time_system_config { public: typedef boost::int64_t time_rep_type; @@ -162,7 +162,7 @@ namespace posix_time { 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 +#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers #else BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000); #endif diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_duration.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_duration.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_duration.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_duration.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_io.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_io.hpp similarity index 88% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_io.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_io.hpp index 5fa9ce2845..9a80737a47 100644 --- a/deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_io.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_io.hpp @@ -6,17 +6,19 @@ * 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) $ + * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 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 +#include +#include // i/ostreambuf_iterator +#include +#include +#include +#include +#include +#include +#include // to_tm will be needed in the facets namespace boost { namespace posix_time { @@ -39,9 +41,9 @@ namespace posix_time { typedef boost::date_time::time_input_facet time_input_facet; template - inline + inline std::basic_ostream& - operator<<(std::basic_ostream& os, + operator<<(std::basic_ostream& os, const ptime& p) { boost::io::ios_flags_saver iflags(os); typedef boost::date_time::time_facet custom_ptime_facet; @@ -55,7 +57,6 @@ namespace posix_time { //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); @@ -71,11 +72,10 @@ namespace posix_time { operator>>(std::basic_istream& is, ptime& pt) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream::sentry strm_sentry(is, false); + 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); @@ -87,31 +87,30 @@ namespace posix_time { f->get(sit, str_end, is, pt); } } - catch(...) { + 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); } + 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); - } - + is.setstate(std::ios_base::failbit); + } } } return is; } - + template inline std::basic_ostream& - operator<<(std::basic_ostream& os, + 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; @@ -126,7 +125,6 @@ namespace posix_time { //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); @@ -142,11 +140,10 @@ namespace posix_time { operator>>(std::basic_istream& is, time_period& tp) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream::sentry strm_sentry(is, false); + 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); @@ -158,22 +155,21 @@ namespace posix_time { f->get(sit, str_end, is, tp); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } } } return is; } - + //! ostream operator for posix_time::time_duration // todo fix to use facet -- place holder for now... @@ -194,7 +190,6 @@ namespace posix_time { //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); @@ -210,11 +205,10 @@ namespace posix_time { operator>>(std::basic_istream& is, time_duration& td) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream::sentry strm_sentry(is, false); + 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); @@ -226,21 +220,20 @@ namespace posix_time { f->get(sit, str_end, is, td); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + 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/date_time/posix_time/posix_time_legacy_io.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_legacy_io.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_legacy_io.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_legacy_io.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_system.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_system.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_system.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_system.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_types.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_types.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/posix_time_types.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/posix_time_types.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/ptime.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/ptime.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/ptime.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/ptime.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/time_formatters.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_formatters.hpp similarity index 94% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/time_formatters.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_formatters.hpp index dc8facf57a..255129276e 100644 --- a/deal.II/contrib/boost/include/boost/date_time/posix_time/time_formatters.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_formatters.hpp @@ -6,17 +6,17 @@ * 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) $ + * $Date: 2009-09-28 14:10:02 -0400 (Mon, 28 Sep 2009) $ */ -#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" +#include +#include +#include +#include +#include +#include +#include // absolute_value +#include /* NOTE: The "to_*_string" code for older compilers, ones that define * BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/time_formatters_limited.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_formatters_limited.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/time_formatters_limited.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_formatters_limited.hpp index def51694a1..e4d1a6ef0a 100644 --- a/deal.II/contrib/boost/include/boost/date_time/posix_time/time_formatters_limited.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_formatters_limited.hpp @@ -6,15 +6,16 @@ * 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) $ + * $Date: 2009-09-28 14:10:02 -0400 (Mon, 28 Sep 2009) $ */ -#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 +#include +#include +#include +#include +#include +#include // absolute_value namespace boost { diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/time_parsers.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_parsers.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/time_parsers.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_parsers.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/time_period.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_period.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/time_period.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_period.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/posix_time/time_serialize.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_serialize.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/posix_time/time_serialize.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/posix_time/time_serialize.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/special_defs.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/special_defs.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/special_defs.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/special_defs.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/special_values_formatter.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/special_values_formatter.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/special_values_formatter.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/special_values_formatter.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/special_values_parser.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/special_values_parser.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/special_values_parser.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/special_values_parser.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/string_convert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/string_convert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/string_convert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/string_convert.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/string_parse_tree.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/string_parse_tree.hpp similarity index 81% rename from deal.II/contrib/boost/include/boost/date_time/string_parse_tree.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/string_parse_tree.hpp index 1ed5fe8db9..0d515ff824 100644 --- a/deal.II/contrib/boost/include/boost/date_time/string_parse_tree.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/string_parse_tree.hpp @@ -2,16 +2,16 @@ #define BOOST_DATE_TIME_STRING_PARSE_TREE___HPP__ /* Copyright (c) 2004-2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ #include "boost/lexical_cast.hpp" //error without? -#include "boost/algorithm/string/case_conv.hpp" +#include "boost/algorithm/string/case_conv.hpp" #include #include #include @@ -37,21 +37,21 @@ struct parse_match_result return cache; } //some of the cache was used return the rest - return string_type(cache, match_depth); + 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. + /*! 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; @@ -64,8 +64,8 @@ template std::basic_ostream& operator<<(std::basic_ostream& os, parse_match_result& mr) { - os << "cm: " << mr.current_match - << " C: '" << mr.cache + os << "cm: " << mr.current_match + << " C: '" << mr.cache << "' md: " << mr.match_depth << " R: " << mr.remaining(); return os; @@ -93,11 +93,11 @@ struct string_parse_tree 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, + + /*! Parameter "starting_point" designates 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) { @@ -126,44 +126,44 @@ struct string_parse_tree while(i < s.size()) { if (i==0) { if (i == (s.size()-1)) { - ti = m_next_chars.insert(value_type(s[i], + ti = m_next_chars.insert(value_type(s[i], string_parse_tree(value))); } else { - ti = m_next_chars.insert(value_type(s[i], + 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], + 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], + 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 + /*! 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, + * 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, + match(std::istreambuf_iterator& sitr, std::istreambuf_iterator& stream_end, parse_match_result_type& result, unsigned int& level) const @@ -171,7 +171,7 @@ struct string_parse_tree level++; charT c; - // if we conditionally advance sitr, we won't have + // 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()) { @@ -181,16 +181,16 @@ struct string_parse_tree //sitr++; } else { - // if we're looking for characters from the cache, + // if we're looking for characters from the cache, // we don't want to increment sitr - adv_itr = false; + 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++; + sitr++; result.cache += c; } if (litr->second.m_value != -1) { // -1 is default value @@ -198,16 +198,16 @@ struct string_parse_tree result.current_match = litr->second.m_value; result.match_depth = static_cast(level); } - litr->second.match(sitr, stream_end, + litr->second.match(sitr, stream_end, result, level); level--; } else { - litr->second.match(sitr, stream_end, + litr->second.match(sitr, stream_end, result, level); level--; } - + if(level <= result.cache.size()) { adv_itr = false; } @@ -218,13 +218,13 @@ struct string_parse_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 + /*! 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, + match(std::istreambuf_iterator& sitr, std::istreambuf_iterator& stream_end) const { // lookup to_lower of char in tree. @@ -242,8 +242,8 @@ struct string_parse_tree iterator end = m_next_chars.end(); // os << "starting level: " << level << std::endl; while (itr != end) { - os << "level: " << level - << " node: " << itr->first + os << "level: " << level + << " node: " << itr->first << " value: " << itr->second.m_value << std::endl; itr->second.printme(os, level); @@ -257,14 +257,14 @@ struct string_parse_tree 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 + os << " node: " << litr->first << " value: " << litr->second.m_value << std::endl; litr++; diff --git a/deal.II/contrib/boost/include/boost/date_time/strings_from_facet.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/strings_from_facet.hpp similarity index 89% rename from deal.II/contrib/boost/include/boost/date_time/strings_from_facet.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/strings_from_facet.hpp index 1d1b234143..2bc26fb33e 100644 --- a/deal.II/contrib/boost/include/boost/date_time/strings_from_facet.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/strings_from_facet.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2009-02-01 06:29:43 -0500 (Sun, 01 Feb 2009) $ */ #include @@ -49,6 +49,7 @@ gather_month_strings(const std::locale& locale, bool short_strings=true) { //grab the needed strings by using the locale to //output each month + const charT* p_outfmt = outfmt.c_str(), *p_outfmt_end = p_outfmt + outfmt.size(); for (int m=0; m < 12; m++) { tm tm_value; tm_value.tm_mon = m; @@ -56,8 +57,8 @@ gather_month_strings(const std::locale& locale, bool short_strings=true) ostream_iter_type oitr(ss); std::use_facet(locale).put(oitr, ss, ss.fill(), &tm_value, - &*outfmt.begin(), - &*outfmt.begin()+outfmt.size()); + p_outfmt, + p_outfmt_end); months.push_back(ss.str()); } } @@ -101,6 +102,7 @@ gather_weekday_strings(const std::locale& locale, bool short_strings=true) { //grab the needed strings by using the locale to //output each month / weekday + const charT* p_outfmt = outfmt.c_str(), *p_outfmt_end = p_outfmt + outfmt.size(); for (int i=0; i < 7; i++) { tm tm_value; tm_value.tm_wday = i; @@ -108,8 +110,8 @@ gather_weekday_strings(const std::locale& locale, bool short_strings=true) ostream_iter_type oitr(ss); std::use_facet(locale).put(oitr, ss, ss.fill(), &tm_value, - &*outfmt.begin(), - &*outfmt.begin()+outfmt.size()); + p_outfmt, + p_outfmt_end); weekdays.push_back(ss.str()); } diff --git a/deal.II/contrib/boost/include/boost/date_time/time.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time.hpp similarity index 94% rename from deal.II/contrib/boost/include/boost/date_time/time.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time.hpp index 58ac8d6567..6a6cbe1f89 100644 --- a/deal.II/contrib/boost/include/boost/date_time/time.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time.hpp @@ -6,16 +6,17 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 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 +#include +#include +#include namespace boost { namespace date_time { @@ -77,21 +78,21 @@ namespace date_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 + 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 + 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(""); + return std::string(); } //! check to see if date is not a value diff --git a/deal.II/contrib/boost/include/boost/date_time/time_clock.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_clock.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/time_clock.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_clock.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/time_defs.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_defs.hpp similarity index 73% rename from deal.II/contrib/boost/include/boost/date_time/time_defs.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_defs.hpp index 312c5df27d..55fe42a594 100644 --- a/deal.II/contrib/boost/include/boost/date_time/time_defs.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_defs.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ @@ -20,7 +20,17 @@ 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 }; + enum time_resolutions { + sec, + tenth, + hundreth, // deprecated misspelled version of hundredth + hundredth = hundreth, + milli, + ten_thousandth, + micro, + nano, + NumResolutions + }; //! Flags for daylight savings or summer time enum dst_flags {not_dst, is_dst, calculate}; diff --git a/deal.II/contrib/boost/include/boost/date_time/time_duration.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_duration.hpp similarity index 88% rename from deal.II/contrib/boost/include/boost/date_time/time_duration.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_duration.hpp index 40041250d3..2fd259012e 100644 --- a/deal.II/contrib/boost/include/boost/date_time/time_duration.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_duration.hpp @@ -6,18 +6,19 @@ * 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) $ + * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ */ -#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" +#include +#include +#include +#include +#include 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 @@ -30,13 +31,13 @@ namespace date_time { */ 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 + * 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: @@ -50,12 +51,12 @@ namespace date_time { 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, + 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)) + 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) @@ -136,17 +137,17 @@ namespace date_time { } duration_type invert_sign() const { - return duration_type(ticks_ * (-1)); - } + return duration_type(ticks_ * (-1)); + } bool is_negative() const { return ticks_ < 0; - } - bool operator<(const time_duration& rhs) const + } + bool operator<(const time_duration& rhs) const { return ticks_ < rhs.ticks_; } - bool operator==(const time_duration& rhs) const + bool operator==(const time_duration& rhs) const { return ticks_ == rhs.ticks_; } @@ -188,13 +189,13 @@ namespace date_time { { return duration_type(ticks_ * rhs); } - duration_type operator*=(int divisor) + duration_type operator*=(int divisor) { ticks_ = ticks_ * divisor; return duration_type(ticks_); } - tick_type ticks() const - { + tick_type ticks() const + { return traits_type::as_number(ticks_); } @@ -258,9 +259,9 @@ namespace date_time { //! Template for instantiating derived adjusting durations /* These templates are designed to work with multiples of - * 10 for frac_of_second and resoultion adjustment + * 10 for frac_of_second and resoultion adjustment */ - template + template class subsecond_duration : public base_duration { public: @@ -270,8 +271,8 @@ namespace date_time { {} }; - - + + } } //namespace date_time diff --git a/deal.II/contrib/boost/include/boost/date_time/time_facet.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_facet.hpp similarity index 87% rename from deal.II/contrib/boost/include/boost/date_time/time_facet.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_facet.hpp index 47f43c6afd..60398dedb5 100644 --- a/deal.II/contrib/boost/include/boost/date_time/time_facet.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_facet.hpp @@ -7,15 +7,27 @@ * 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) $ + * $Date: 2009-10-03 06:04:00 -0400 (Sat, 03 Oct 2009) $ */ -#include "boost/date_time/date_facet.hpp" -#include "boost/date_time/string_convert.hpp" -#include "boost/algorithm/string/erase.hpp" +#include +#include +#include +#include #include #include +#include // i/ostreambuf_iterator #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // absolute_value namespace boost { namespace date_time { @@ -28,6 +40,8 @@ namespace date_time { 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 hours_format[3]; // H + static const char_type unrestricted_hours_format[3]; // O 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 @@ -62,10 +76,18 @@ namespace date_time { time_formats::seconds_with_fractional_seconds_format[3] = {'%','s'}; - template + template const typename time_formats::char_type time_formats::seconds_format[3] = {'%','S'}; + template + const typename time_formats::char_type + time_formats::hours_format[3] = {'%','H'}; + + template + const typename time_formats::char_type + time_formats::unrestricted_hours_format[3] = {'%','O'}; + template const typename time_formats::char_type //time_formats::standard_format[5] = {'%','c',' ','%','z'}; @@ -138,7 +160,7 @@ namespace date_time { template const typename time_formats::char_type time_formats::default_time_duration_format[11] = - {'%','H',':','%','M',':','%','S','%','F'}; + {'%','O',':','%','M',':','%','S','%','F'}; @@ -172,6 +194,8 @@ namespace date_time { 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* hours_format; // %H + static const char_type* unrestricted_hours_format; // %O static const char_type* standard_format; // %x X static const char_type* zone_abbrev_format; // %z static const char_type* zone_name_format; // %Z @@ -197,9 +221,8 @@ namespace date_time { #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), + explicit time_facet(::size_t a_ref = 0) + : base_type(default_time_format, period_formatter_type(), special_values_formatter_type(), date_gen_formatter_type(), a_ref), m_time_duration_format(string_type(duration_sign_negative_only) + default_time_duration_format) {} @@ -242,6 +265,7 @@ namespace date_time { 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 @@ -263,9 +287,7 @@ namespace date_time { 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, - ""); + boost::algorithm::erase_all(format, posix_zone_string_format); } else{ boost::algorithm::replace_all(format, @@ -283,9 +305,7 @@ namespace date_time { // erase zone_name_format & one preceeding space std::basic_ostringstream ss; ss << ' ' << zone_name_format; - boost::algorithm::replace_all(format, - ss.str(), - ""); + boost::algorithm::erase_all(format, ss.str()); } else{ boost::algorithm::replace_all(format, @@ -303,9 +323,7 @@ namespace date_time { // erase zone_abbrev_format & one preceeding space std::basic_ostringstream ss; ss << ' ' << zone_abbrev_format; - boost::algorithm::replace_all(format, - ss.str(), - ""); + boost::algorithm::erase_all(format, ss.str()); } else{ boost::algorithm::replace_all(format, @@ -321,9 +339,7 @@ namespace date_time { // 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, - ""); + boost::algorithm::erase_all(format, zone_iso_extended_format); } else{ boost::algorithm::replace_all(format, @@ -340,9 +356,7 @@ namespace date_time { // if zone_abbrev() returns an empty string, we want to // erase zone_iso_format from format - boost::algorithm::replace_all(format, - zone_iso_format, - ""); + boost::algorithm::erase_all(format, zone_iso_format); } else{ boost::algorithm::replace_all(format, @@ -396,24 +410,45 @@ namespace date_time { 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); + // 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); + 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); + // remove all the %- combos from the string + boost::algorithm::erase_all(format, duration_sign_negative_only); + // remove all the %+ in the string with '+' + boost::algorithm::replace_all(format, + duration_sign_always, + positive_sign); + } + + /* + * It is possible for a time duration to span more then 24 hours. + * Standard time_put::put is obliged to behave the same as strftime + * (See ISO 14882-2003 22.2.5.3.1 par. 1) and strftime's behavior is + * unspecified for the case when tm_hour field is outside 0-23 range + * (See ISO 9899-1999 7.23.3.5 par. 3). So we must output %H and %O + * here ourself. + */ + string_type hours_str; + if (format.find(unrestricted_hours_format) != string_type::npos) { + hours_str = hours_as_string(a_time_dur); + boost::algorithm::replace_all(format, unrestricted_hours_format, hours_str); + } + // We still have to process restricted hours format specifier. In order to + // support parseability of durations in ISO format (%H%M%S), we'll have to + // restrict the stringified hours length to 2 characters. + if (format.find(hours_format) != string_type::npos) { + if (hours_str.empty()) + hours_str = hours_as_string(a_time_dur); + BOOST_ASSERT(hours_str.length() <= 2); + boost::algorithm::replace_all(format, hours_format, hours_str); } string_type frac_str; @@ -485,17 +520,33 @@ namespace date_time { } //make sure there is no sign - frac_sec = date_time::absolute_value(frac_sec); + return integral_as_string( + date_time::absolute_value(frac_sec), + time_duration_type::num_fractional_digits()); + } + + static + string_type + hours_as_string(const time_duration_type& a_time, int width = 2) + { + return integral_as_string(date_time::absolute_value(a_time.hours()), width); + } + + template< typename IntT > + static + string_type + integral_as_string(IntT val, int width = 2) + { 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')); + ss << std::setw(width) + << 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); + ss << _i64toa(static_cast(val), buff, 10); #else - ss << frac_sec; + ss << val; #endif return ss.str(); } @@ -504,7 +555,7 @@ namespace date_time { string_type m_time_duration_format; }; - + template std::locale::id time_facet::id; @@ -546,6 +597,14 @@ namespace date_time { const typename time_facet::char_type* time_facet::seconds_format = time_formats::seconds_format; + template + const typename time_facet::char_type* + time_facet::hours_format = time_formats::hours_format; + + template + const typename time_facet::char_type* + time_facet::unrestricted_hours_format = time_formats::unrestricted_hours_format; + template const typename time_facet::char_type* time_facet::standard_format = time_formats::standard_format; @@ -705,11 +764,15 @@ namespace date_time { c = *sitr; } - long hour = 0; - long min = 0; - long sec = 0; + typedef typename time_duration_type::hour_type hour_type; + typedef typename time_duration_type::min_type min_type; + typedef typename time_duration_type::sec_type sec_type; + + hour_type hour = 0; + min_type min = 0; + sec_type 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(); @@ -720,45 +783,49 @@ namespace date_time { const_itr itr(m_time_duration_format.begin()); while (itr != m_time_duration_format.end() && (sitr != stream_end)) { if (*itr == '%') { - itr++; + ++itr; if (*itr != '%') { switch(*itr) { - case 'H': + case 'O': { - match_results mr; - hour = fixed_string_to_int(sitr, stream_end, mr, 2); + // A period may span more than 24 hours. In that case the format + // string should be composed with the unrestricted hours specifier. + hour = var_string_to_int(sitr, stream_end, + std::numeric_limits::digits10 + 1); if(hour == -1){ return check_special_value(sitr, stream_end, td, c); } break; } - case 'M': + case 'H': { match_results mr; - min = fixed_string_to_int(sitr, stream_end, mr, 2); - if(min == -1){ + hour = fixed_string_to_int(sitr, stream_end, mr, 2); + if(hour == -1){ return check_special_value(sitr, stream_end, td, c); } break; } - case 'S': + case 'M': { match_results mr; - sec = fixed_string_to_int(sitr, stream_end, mr, 2); - if(sec == -1){ + 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': + case 'S': { match_results mr; - sec = fixed_string_to_int(sitr, stream_end, mr, 2); + sec = fixed_string_to_int(sitr, stream_end, mr, 2); if(sec == -1){ return check_special_value(sitr, stream_end, td, c); } + if (*itr == 'S') + break; // %s is the same as %S%f so we drop through into %f - //break; } case 'f': { @@ -796,20 +863,20 @@ namespace date_time { }// switch } else { // itr == '%', second consecutive - sitr++; + ++sitr; } - itr++; //advance past format specifier + ++itr; //advance past format specifier } else { //skip past chars in format and in buffer - itr++; + ++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++; + ++sitr; } } } @@ -858,11 +925,15 @@ namespace date_time { if((sitr != stream_end) && (*sitr == '-' || *sitr == '+')) { c = *sitr; } - + + typedef typename time_duration_type::hour_type hour_type; + typedef typename time_duration_type::min_type min_type; + typedef typename time_duration_type::sec_type sec_type; + // time elements - long hour = 0; - long min = 0; - long sec = 0; + hour_type hour = 0; + min_type min = 0; + sec_type sec = 0; typename time_duration_type::fractional_seconds_type frac(0); // date elements short day_of_year(0); @@ -884,7 +955,7 @@ namespace date_time { const_itr itr(this->m_format.begin()); while (itr != this->m_format.end() && (sitr != stream_end)) { if (*itr == '%') { - itr++; + ++itr; if (*itr != '%') { // the cases are grouped by date & time flags - not alphabetical order switch(*itr) { @@ -898,7 +969,7 @@ namespace date_time { 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 + catch(std::out_of_range&) { // 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; @@ -919,13 +990,13 @@ namespace date_time { 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 + catch(std::out_of_range&) { // 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 + throw; // rethrow bad_month } } // did m_parser already advance sitr to next char? @@ -946,7 +1017,7 @@ namespace date_time { 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 + catch(std::out_of_range&) { // 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; @@ -982,14 +1053,14 @@ namespace date_time { 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 + catch(std::out_of_range&) { // base class for exception bad_day_of_month 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 + throw; // rethrow bad_day_of_month } } break; @@ -998,7 +1069,7 @@ namespace date_time { case 'H': { match_results mr; - hour = fixed_string_to_int(sitr, stream_end, mr, 2); + hour = fixed_string_to_int(sitr, stream_end, mr, 2); if(hour == -1){ return check_special_value(sitr, stream_end, t, c); } @@ -1007,30 +1078,23 @@ namespace date_time { case 'M': { match_results mr; - min = fixed_string_to_int(sitr, stream_end, mr, 2); + 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': + case 'S': { match_results mr; - sec = fixed_string_to_int(sitr, stream_end, mr, 2); + sec = fixed_string_to_int(sitr, stream_end, mr, 2); if(sec == -1){ return check_special_value(sitr, stream_end, t, c); } + if (*itr == 'S') + break; // %s is the same as %S%f so we drop through into %f - //break; } case 'f': { @@ -1097,26 +1161,26 @@ namespace date_time { }// switch } else { // itr == '%', second consecutive - sitr++; + ++sitr; } if(use_current_format_char) { use_current_format_char = false; } else { - itr++; //advance past format specifier + ++itr; //advance past format specifier } } else { //skip past chars in format and in buffer - itr++; + ++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++; + ++sitr; } } } @@ -1149,7 +1213,8 @@ namespace date_time { 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 + "'"); + boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + tmp + "'")); + BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return sitr); // should never reach } tt = temporal_type(static_cast(mr.current_match)); return sitr; diff --git a/deal.II/contrib/boost/include/boost/date_time/time_formatting_streams.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_formatting_streams.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/date_time/time_formatting_streams.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_formatting_streams.hpp index 8ff2ef0890..3537c103cc 100644 --- a/deal.II/contrib/boost/include/boost/date_time/time_formatting_streams.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_formatting_streams.hpp @@ -6,15 +6,19 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ - -#include "boost/date_time/date_formatting_locales.hpp" -#include "boost/date_time/time_resolution_traits.hpp" +#include #ifndef BOOST_DATE_TIME_NO_LOCALE +#include +#include +#include +#include +#include + namespace boost { namespace date_time { @@ -116,4 +120,3 @@ namespace date_time { #endif //BOOST_DATE_TIME_NO_LOCALE #endif - diff --git a/deal.II/contrib/boost/include/boost/date_time/time_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/time_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/time_parsing.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_parsing.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/time_parsing.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_parsing.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/time_resolution_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_resolution_traits.hpp similarity index 78% rename from deal.II/contrib/boost/include/boost/date_time/time_resolution_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_resolution_traits.hpp index 14879117a6..658f3d207c 100644 --- a/deal.II/contrib/boost/include/boost/date_time/time_resolution_traits.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_resolution_traits.hpp @@ -2,26 +2,27 @@ #define DATE_TIME_TIME_RESOLUTION_TRAITS_HPP /* Copyright (c) 2002,2003 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * 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) $ + * $Date: 2009-06-06 07:25:55 -0400 (Sat, 06 Jun 2009) $ */ -#include "boost/date_time/time_defs.hpp" -#include "boost/date_time/int_adapter.hpp" -#include "boost/cstdint.hpp" +#include +#include +#include +#include namespace boost { namespace date_time { //! Simple function to calculate absolute value of a numeric type - template - // JDG [7/6/02 made a template], + template + // JDG [7/6/02 made a template], // moved here from time_duration.hpp 2003-Sept-4. - inline T absolute_value(T x) + inline T absolute_value(T x) { return x < 0 ? -x : x; } @@ -58,16 +59,16 @@ namespace date_time { //! Used to determine if implemented type is int_adapter or int static bool is_adapted() { return true;} }; - - template + unsigned short frac_digits, + typename v_type = boost::int32_t > class time_resolution_traits { public: typedef typename frac_sec_type::int_type fractional_seconds_type; @@ -77,9 +78,9 @@ namespace date_time { 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) + static fractional_seconds_type as_number(impl_type i) { return frac_sec_type::as_number(i); } @@ -87,11 +88,14 @@ namespace date_time { { 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; - +#if (defined(BOOST_MSVC) && (_MSC_VER < 1300)) + BOOST_STATIC_CONSTANT(boost::int64_t, ticks_per_second = resolution_adjust); +#else + BOOST_STATIC_CONSTANT(fractional_seconds_type, ticks_per_second = resolution_adjust); +#endif + static time_resolutions resolution() { return res; @@ -116,16 +120,16 @@ namespace date_time { minutes = absolute_value(minutes); seconds = absolute_value(seconds); fs = absolute_value(fs); - return (((((fractional_seconds_type(hours)*3600) - + (fractional_seconds_type(minutes)*60) + 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) + return (((fractional_seconds_type(hours)*3600) + + (fractional_seconds_type(minutes)*60) + seconds)*res_adjust()) + fs; } - + }; typedef time_resolution_traits milli_res; diff --git a/deal.II/contrib/boost/include/boost/date_time/time_system_counted.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_system_counted.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/time_system_counted.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_system_counted.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/time_system_split.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_system_split.hpp similarity index 90% rename from deal.II/contrib/boost/include/boost/date_time/time_system_split.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_system_split.hpp index a882b12541..08ea1ec2d1 100644 --- a/deal.II/contrib/boost/include/boost/date_time/time_system_split.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_system_split.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $ */ @@ -76,7 +76,7 @@ namespace 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) + 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()) { @@ -132,7 +132,7 @@ namespace date_time { } static std::string zone_name(const time_rep_type&) { - return ""; + return std::string(); } static bool is_equal(const time_rep_type& lhs, const time_rep_type& rhs) { @@ -166,12 +166,9 @@ namespace date_time { 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())); } @@ -185,13 +182,10 @@ namespace date_time { 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; + date_duration_type day_overflow(static_cast< typename date_duration_type::duration_rep_type >(day_offset.add(td.ticks()))); + return time_rep_type(base.day+day_overflow, time_duration_type(0,0,0,day_offset.as_int())); } diff --git a/deal.II/contrib/boost/include/boost/date_time/time_zone_base.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_zone_base.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/time_zone_base.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_zone_base.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/time_zone_names.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/time_zone_names.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/time_zone_names.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/time_zone_names.hpp diff --git a/deal.II/contrib/boost/include/boost/date_time/tz_db_base.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/tz_db_base.hpp similarity index 94% rename from deal.II/contrib/boost/include/boost/date_time/tz_db_base.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/tz_db_base.hpp index ead3c20a44..2440115460 100644 --- a/deal.II/contrib/boost/include/boost/date_time/tz_db_base.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/tz_db_base.hpp @@ -5,20 +5,22 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 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 +#include #include +#include +#include +#include +#include +#include +#include +#include +#include namespace boost { namespace date_time { @@ -158,7 +160,7 @@ namespace boost { 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 boost::date_time::dst_adjustment_offsets dst_adjustment_offsets; typedef std::basic_string string_type; //! Constructs an empty database @@ -173,7 +175,7 @@ namespace boost { std::ifstream ifs(pathspec.c_str()); if(!ifs){ - throw data_not_accessible(pathspec); + boost::throw_exception(data_not_accessible(pathspec)); } std::getline(ifs, buff); // first line is column headings @@ -183,13 +185,13 @@ namespace boost { } //! returns true if record successfully added to map - /*! Takes an id string in the form of "America/Phoenix", and a + /*! Takes a region name 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, + bool add_record(const string_type& region, boost::shared_ptr tz) { - typename map_type::value_type p(id, tz); + typename map_type::value_type p(region, tz); return (m_zone_map.insert(p)).second; } @@ -307,7 +309,6 @@ namespace boost { * 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; @@ -326,10 +327,11 @@ namespace boost { //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; + std::ostringstream msg; msg << "Expecting " << FIELD_COUNT << " fields, got " << result.size() << " fields in line: " << s; - throw bad_field_count(msg.str()); + boost::throw_exception(bad_field_count(msg.str())); + BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return false); // should never reach } // initializations diff --git a/deal.II/contrib/boost/include/boost/date_time/wrapping_int.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/wrapping_int.hpp similarity index 87% rename from deal.II/contrib/boost/include/boost/date_time/wrapping_int.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/wrapping_int.hpp index 1457dc869a..969b078ac1 100644 --- a/deal.II/contrib/boost/include/boost/date_time/wrapping_int.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/date_time/wrapping_int.hpp @@ -6,7 +6,7 @@ * 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) $ + * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ */ @@ -43,10 +43,11 @@ public: * 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) + template< typename IntT > + IntT add(IntT v) { int_type remainder = static_cast(v % (wrap_val)); - int_type overflow = static_cast(v / (wrap_val)); + IntT overflow = static_cast(v / (wrap_val)); value_ = static_cast(value_ + remainder); return calculate_wrap(overflow); } @@ -56,26 +57,28 @@ public: * 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) + template< typename IntT > + IntT subtract(IntT v) { int_type remainder = static_cast(v % (wrap_val)); - int_type underflow = static_cast(-(v / (wrap_val))); + IntT 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) + template< typename IntT > + IntT calculate_wrap(IntT wrap) { if ((value_) >= wrap_val) { - wrap++; + ++wrap; value_ -= (wrap_val); } else if(value_ < 0) { - wrap--; + --wrap; value_ += (wrap_val); } return wrap; @@ -114,10 +117,11 @@ public: * 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) + template< typename IntT > + IntT add(IntT v) { int_type remainder = static_cast(v % (wrap_max - wrap_min + 1)); - int_type overflow = static_cast(v / (wrap_max - wrap_min + 1)); + IntT overflow = static_cast(v / (wrap_max - wrap_min + 1)); value_ = static_cast(value_ + remainder); return calculate_wrap(overflow); } @@ -126,10 +130,11 @@ public: * 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) + template< typename IntT > + IntT subtract(IntT v) { int_type remainder = static_cast(v % (wrap_max - wrap_min + 1)); - int_type underflow = static_cast(-(v / (wrap_max - wrap_min + 1))); + IntT underflow = static_cast(-(v / (wrap_max - wrap_min + 1))); value_ = static_cast(value_ - remainder); return calculate_wrap(underflow); } @@ -137,16 +142,17 @@ public: private: int_type value_; - int_type calculate_wrap(int_type wrap) + template< typename IntT > + IntT calculate_wrap(IntT wrap) { if ((value_) > wrap_max) { - wrap++; + ++wrap; value_ -= (wrap_max - wrap_min + 1); } else if((value_) < wrap_min) { - wrap--; + --wrap; value_ += (wrap_max - wrap_min + 1); } return wrap; diff --git a/deal.II/contrib/boost/include/boost/date_time/year_month_day.hpp b/deal.II/contrib/boost-1.41.0/include/boost/date_time/year_month_day.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/date_time/year_month_day.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/date_time/year_month_day.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/algorithm.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/algorithm.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/algorithm.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/algorithm.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/allocator_utilities.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/allocator_utilities.hpp similarity index 90% rename from deal.II/contrib/boost/include/boost/detail/allocator_utilities.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/allocator_utilities.hpp index 91b0fa7b39..5d6ef48b05 100644 --- a/deal.II/contrib/boost/include/boost/detail/allocator_utilities.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/detail/allocator_utilities.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2008 Joaquin M Lopez Munoz. +/* Copyright 2003-2009 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) @@ -178,12 +178,31 @@ void construct(void* p,const Type& t) new (p) Type(t); } +#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) +/* MSVC++ issues spurious warnings about unreferencend formal parameters + * in destroy when Type is a class with trivial dtor. + */ + +#pragma warning(push) +#pragma warning(disable:4100) +#endif + template void destroy(const Type* p) { + +#if BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590)) + const_cast(p)->~Type(); +#else p->~Type(); +#endif + } +#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) +#pragma warning(pop) +#endif + } /* namespace boost::detail::allocator */ } /* namespace boost::detail */ diff --git a/deal.II/contrib/boost-1.41.0/include/boost/detail/atomic_count.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/atomic_count.hpp new file mode 100644 index 0000000000..5411c7ae99 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/detail/atomic_count.hpp @@ -0,0 +1,21 @@ +#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 + +#include + +#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/detail/binary_search.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/binary_search.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/binary_search.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/binary_search.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/call_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/call_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/call_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/call_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/catch_exceptions.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/catch_exceptions.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/catch_exceptions.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/catch_exceptions.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/compressed_pair.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/compressed_pair.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/compressed_pair.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/compressed_pair.hpp diff --git a/deal.II/contrib/boost/include/boost/functional/detail/container_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/container_fwd.hpp similarity index 89% rename from deal.II/contrib/boost/include/boost/functional/detail/container_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/container_fwd.hpp index 8685905cda..bc7f780b06 100644 --- a/deal.II/contrib/boost/include/boost/functional/detail/container_fwd.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/detail/container_fwd.hpp @@ -6,16 +6,14 @@ #if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP) #define BOOST_DETAIL_CONTAINER_FWD_HPP +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + #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)) \ +#if ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) && defined(_GLIBCXX_DEBUG)) \ || BOOST_WORKAROUND(__BORLANDC__, > 0x551) \ || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \ || (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) @@ -61,7 +59,13 @@ namespace std { template class allocator; template class basic_string; - template struct BOOST_HASH_CHAR_TRAITS; + +#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + template struct string_char_traits; +#else + template struct char_traits; +#endif + template class complex; } diff --git a/deal.II/contrib/boost/include/boost/detail/dynamic_bitset.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/dynamic_bitset.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/dynamic_bitset.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/dynamic_bitset.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/endian.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/endian.hpp similarity index 91% rename from deal.II/contrib/boost/include/boost/detail/endian.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/endian.hpp index 6936dba0f3..36ddb7e1e5 100644 --- a/deal.II/contrib/boost/include/boost/detail/endian.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/detail/endian.hpp @@ -42,15 +42,15 @@ # error Unknown machine endianness detected. # endif # define BOOST_BYTE_ORDER __BYTE_ORDER -#elif defined(_BIG_ENDIAN) +#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) # define BOOST_BIG_ENDIAN # define BOOST_BYTE_ORDER 4321 -#elif defined(_LITTLE_ENDIAN) +#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) # define BOOST_LITTLE_ENDIAN # define BOOST_BYTE_ORDER 1234 #elif defined(__sparc) || defined(__sparc__) \ || defined(_POWER) || defined(__powerpc__) \ - || defined(__ppc__) || defined(__hpux) \ + || defined(__ppc__) || defined(__hpux) || defined(__hppa) \ || defined(_MIPSEB) || defined(_POWER) \ || defined(__s390__) # define BOOST_BIG_ENDIAN @@ -61,7 +61,7 @@ || defined(_M_ALPHA) || defined(__amd64) \ || defined(__amd64__) || defined(_M_AMD64) \ || defined(__x86_64) || defined(__x86_64__) \ - || defined(_M_X64) + || defined(_M_X64) || defined(__bfin__) # define BOOST_LITTLE_ENDIAN # define BOOST_BYTE_ORDER 1234 diff --git a/deal.II/contrib/boost/include/boost/detail/has_default_constructor.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/has_default_constructor.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/has_default_constructor.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/has_default_constructor.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/identifier.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/identifier.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/identifier.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/identifier.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/indirect_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/indirect_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/indirect_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/indirect_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/interlocked.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/interlocked.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/interlocked.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/interlocked.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/is_function_ref_tester.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/is_function_ref_tester.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/is_function_ref_tester.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/is_function_ref_tester.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/is_incrementable.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/is_incrementable.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/detail/is_incrementable.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/is_incrementable.hpp index cb7d7a7b59..1c8fd5785b 100644 --- a/deal.II/contrib/boost/include/boost/detail/is_incrementable.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/detail/is_incrementable.hpp @@ -63,7 +63,12 @@ namespace is_incrementable_ tag operator,(tag,int); # define BOOST_comma(a,b) (a,b) # endif - + +# if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable:4913) // Warning about operator, +# endif + // two check overloads help us identify which operator++ was picked char (& check(tag) )[2]; @@ -92,6 +97,11 @@ namespace is_incrementable_ , value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1 ); }; + +# if defined(BOOST_MSVC) +# pragma warning(pop) +# endif + } # undef BOOST_comma diff --git a/deal.II/contrib/boost/include/boost/detail/is_xxx.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/is_xxx.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/is_xxx.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/is_xxx.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/lcast_precision.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/lcast_precision.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/lcast_precision.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/lcast_precision.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/detail/lightweight_mutex.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/lightweight_mutex.hpp new file mode 100644 index 0000000000..b7a7f6dd4e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/detail/lightweight_mutex.hpp @@ -0,0 +1,22 @@ +#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 +// + +#include + +#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/detail/lightweight_test.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/lightweight_test.hpp similarity index 65% rename from deal.II/contrib/boost/include/boost/detail/lightweight_test.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/lightweight_test.hpp index b651e0e335..ffa750d324 100644 --- a/deal.II/contrib/boost/include/boost/detail/lightweight_test.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/detail/lightweight_test.hpp @@ -10,14 +10,15 @@ // // boost/detail/lightweight_test.hpp - lightweight test library // -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2002, 2009 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) +// Distributed under the 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) +// BOOST_TEST_EQ(expr1, expr2) // // int boost::report_errors() // @@ -49,13 +50,27 @@ inline void error_impl(char const * msg, char const * file, int line, char const ++test_errors(); } +template inline void test_eq_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, T const & t, U const & u ) +{ + if( t == u ) + { + } + else + { + std::cerr << file << "(" << line << "): test '" << expr1 << " == " << expr2 + << "' failed in function '" << function << "': " + << "'" << t << "' != '" << u << "'" << std::endl; + ++test_errors(); + } +} + } // namespace detail inline int report_errors() { int errors = detail::test_errors(); - if(errors == 0) + if( errors == 0 ) { std::cerr << "No errors detected." << std::endl; return 0; @@ -71,5 +86,6 @@ inline int report_errors() #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) +#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) #endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/detail/lightweight_thread.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/lightweight_thread.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/lightweight_thread.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/lightweight_thread.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/limits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/limits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/limits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/limits.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/named_template_params.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/named_template_params.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/named_template_params.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/named_template_params.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/no_exceptions_support.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/no_exceptions_support.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/no_exceptions_support.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/no_exceptions_support.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/none_t.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/none_t.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/none_t.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/none_t.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/numeric_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/numeric_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/numeric_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/numeric_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/ob_call_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/ob_call_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/ob_call_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/ob_call_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/ob_compressed_pair.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/ob_compressed_pair.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/ob_compressed_pair.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/ob_compressed_pair.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/detail/quick_allocator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/quick_allocator.hpp new file mode 100644 index 0000000000..d54b3a792d --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/detail/quick_allocator.hpp @@ -0,0 +1,23 @@ +#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 + +#endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/detail/reference_content.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/reference_content.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/reference_content.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/reference_content.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/detail/scoped_enum_emulation.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/scoped_enum_emulation.hpp new file mode 100644 index 0000000000..644c1386b7 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/detail/scoped_enum_emulation.hpp @@ -0,0 +1,56 @@ +// scoped_enum_emulation.hpp ---------------------------------------------------------// + +// Copyright Beman Dawes, 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x +// scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS +// macro is used to detect feature support. +// +// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a +// description of the scoped enum feature. Note that the committee changed the name +// from strongly typed enum to scoped enum. +// +// Caution: only the syntax is emulated; the semantics are not emulated and +// the syntax emulation doesn't include being able to specify the underlying +// representation type. +// +// The emulation is via struct rather than namespace to allow use within classes. +// Thanks to Andrey Semashev for pointing that out. +// +// Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott, +// Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente +// Botet, and Daniel James. +// +// Sample usage: +// +// BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END +// ... +// BOOST_SCOPED_ENUM(algae) sample( algae::red ); +// void foo( BOOST_SCOPED_ENUM(algae) color ); +// ... +// sample = algae::green; +// foo( algae::cyan ); + +#ifndef BOOST_SCOPED_ENUM_EMULATION_HPP +#define BOOST_SCOPED_ENUM_EMULATION_HPP + +#include + +#ifdef BOOST_NO_SCOPED_ENUMS + +# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_t +# define BOOST_SCOPED_ENUM_END }; +# define BOOST_SCOPED_ENUM(name) name::enum_t + +#else + +# define BOOST_SCOPED_ENUM_START(name) enum class name +# define BOOST_SCOPED_ENUM_END +# define BOOST_SCOPED_ENUM(name) name + +#endif + +#endif // BOOST_SCOPED_ENUM_EMULATION_HPP diff --git a/deal.II/contrib/boost/include/boost/detail/select_type.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/select_type.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/select_type.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/select_type.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/sp_typeinfo.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/sp_typeinfo.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/sp_typeinfo.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/sp_typeinfo.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/templated_streams.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/templated_streams.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/detail/templated_streams.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/templated_streams.hpp diff --git a/deal.II/contrib/boost/include/boost/detail/utf8_codecvt_facet.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/utf8_codecvt_facet.hpp similarity index 94% rename from deal.II/contrib/boost/include/boost/detail/utf8_codecvt_facet.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/utf8_codecvt_facet.hpp index ac7e7bfded..b777ff934e 100644 --- a/deal.II/contrib/boost/include/boost/detail/utf8_codecvt_facet.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/detail/utf8_codecvt_facet.hpp @@ -79,25 +79,18 @@ // specialized on those types for this to work. #include -// for mbstate_t -#include -// for std::size_t -#include +#include // for mbstate_t +#include // for std::size_t #include #include +#if defined(BOOST_NO_STDC_NAMESPACE) 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 + using ::mbstate_t; + using ::size_t; +} +#endif #if !defined(__MSL_CPP__) && !defined(__LIBCOMO__) #define BOOST_CODECVT_DO_LENGTH_CONST const diff --git a/deal.II/contrib/boost/include/boost/detail/workaround.hpp b/deal.II/contrib/boost-1.41.0/include/boost/detail/workaround.hpp similarity index 79% rename from deal.II/contrib/boost/include/boost/detail/workaround.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/detail/workaround.hpp index 4933a531f9..b6b64125c6 100644 --- a/deal.II/contrib/boost/include/boost/detail/workaround.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/detail/workaround.hpp @@ -45,10 +45,15 @@ #else #define __BORLANDC___WORKAROUND_GUARD 0 #endif -#ifndef __MSC_VER -#define __MSC_VER_WORKAROUND_GUARD 1 +#ifndef __CODEGEARC__ +#define __CODEGEARC___WORKAROUND_GUARD 1 #else -#define __MSC_VER_WORKAROUND_GUARD 0 +#define __CODEGEARC___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 @@ -95,6 +100,11 @@ #else #define __MWERKS___WORKAROUND_GUARD 0 #endif +#ifndef __EDG__ +#define __EDG___WORKAROUND_GUARD 1 +#else +#define __EDG___WORKAROUND_GUARD 0 +#endif #ifndef __EDG_VERSION__ #define __EDG_VERSION___WORKAROUND_GUARD 1 #else @@ -105,6 +115,11 @@ #else #define __HP_aCC_WORKAROUND_GUARD 0 #endif +#ifndef __hpxstd98 +#define __hpxstd98_WORKAROUND_GUARD 1 +#else +#define __hpxstd98_WORKAROUND_GUARD 0 +#endif #ifndef _CRAYC #define _CRAYC_WORKAROUND_GUARD 1 #else @@ -120,12 +135,47 @@ #else #define MPW_CPLUS_WORKAROUND_GUARD 0 #endif +#ifndef __COMO__ +#define __COMO___WORKAROUND_GUARD 1 +#else +#define __COMO___WORKAROUND_GUARD 0 +#endif +#ifndef __COMO_VERSION__ +#define __COMO_VERSION___WORKAROUND_GUARD 1 +#else +#define __COMO_VERSION___WORKAROUND_GUARD 0 +#endif +#ifndef __INTEL_COMPILER +#define __INTEL_COMPILER_WORKAROUND_GUARD 1 +#else +#define __INTEL_COMPILER_WORKAROUND_GUARD 0 +#endif +#ifndef __ICL +#define __ICL_WORKAROUND_GUARD 1 +#else +#define __ICL_WORKAROUND_GUARD 0 +#endif +#ifndef _COMPILER_VERSION +#define _COMPILER_VERSION_WORKAROUND_GUARD 1 +#else +#define _COMPILER_VERSION_WORKAROUND_GUARD 0 +#endif #ifndef _RWSTD_VER #define _RWSTD_VER_WORKAROUND_GUARD 1 #else #define _RWSTD_VER_WORKAROUND_GUARD 0 #endif +#ifndef BOOST_RWSTD_VER +#define BOOST_RWSTD_VER_WORKAROUND_GUARD 1 +#else +#define BOOST_RWSTD_VER_WORKAROUND_GUARD 0 +#endif +#ifndef __GLIBCPP__ +#define __GLIBCPP___WORKAROUND_GUARD 1 +#else +#define __GLIBCPP___WORKAROUND_GUARD 0 +#endif #ifndef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC #define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 1 #else @@ -141,6 +191,16 @@ #else #define _STLPORT_VERSION_WORKAROUND_GUARD 0 #endif +#ifndef __LIBCOMO_VERSION__ +#define __LIBCOMO_VERSION___WORKAROUND_GUARD 1 +#else +#define __LIBCOMO_VERSION___WORKAROUND_GUARD 0 +#endif +#ifndef _CPPLIB_VER +#define _CPPLIB_VER_WORKAROUND_GUARD 1 +#else +#define _CPPLIB_VER_WORKAROUND_GUARD 0 +#endif #ifndef BOOST_INTEL_CXX_VERSION #define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 1 diff --git a/deal.II/contrib/boost/include/boost/dynamic_bitset.hpp b/deal.II/contrib/boost-1.41.0/include/boost/dynamic_bitset.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/dynamic_bitset.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/dynamic_bitset.hpp diff --git a/deal.II/contrib/boost/include/boost/dynamic_bitset_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/dynamic_bitset_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/dynamic_bitset_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/dynamic_bitset_fwd.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/dynamic_property_map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/dynamic_property_map.hpp new file mode 100644 index 0000000000..58a4ac90c8 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/dynamic_property_map.hpp @@ -0,0 +1,19 @@ +/*============================================================================= +Copyright (c) 2009 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) +=============================================================================*/ +// Redirect/warning header, adapted from the version in Spirit + +#include + +#if BOOST_VERSION >= 103800 +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +# pragma message ("Warning: This header is deprecated. Please use: boost/property_map/dynamic_property_map.hpp") +#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) +# warning "This header is deprecated. Please use: boost/property_map/dynamic_property_map.hpp" +#endif +#endif + +#include diff --git a/deal.II/contrib/boost-1.41.0/include/boost/enable_shared_from_this.hpp b/deal.II/contrib/boost-1.41.0/include/boost/enable_shared_from_this.hpp new file mode 100644 index 0000000000..b1bb63d9a2 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/enable_shared_from_this.hpp @@ -0,0 +1,18 @@ +#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 + +#endif // #ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED diff --git a/deal.II/contrib/boost/include/boost/exception.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception.hpp similarity index 52% rename from deal.II/contrib/boost/include/boost/exception.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception.hpp index c77f215b8f..ff315654b0 100644 --- a/deal.II/contrib/boost/include/boost/exception.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception.hpp @@ -6,12 +6,8 @@ #ifndef UUID_1D94A7C6054E11DB9804B622A1EF5492 #define UUID_1D94A7C6054E11DB9804B622A1EF5492 -#include -#include -#include -#include -#include -#include -#include +//The header has been deprecated. +//Please #include instead. +#include #endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/all.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/all.hpp new file mode 100644 index 0000000000..c47738b2c6 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/all.hpp @@ -0,0 +1,27 @@ +//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_316FDA946C0D11DEA9CBAE5255D89593 +#define UUID_316FDA946C0D11DEA9CBAE5255D89593 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef BOOST_NO_EXCEPTIONS +#include +#include +#endif + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/current_exception_cast.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/current_exception_cast.hpp new file mode 100644 index 0000000000..228b6ea10e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/current_exception_cast.hpp @@ -0,0 +1,34 @@ +//Copyright (c) 2006-2009 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_7E83C166200811DE885E826156D89593 +#define UUID_7E83C166200811DE885E826156D89593 + +namespace +boost + { + template + inline + E * + current_exception_cast() + { + try + { + throw; + } + catch( + E & e ) + { + return &e; + } + catch( + ...) + { + return 0; + } + } + } + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/attribute_noreturn.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/attribute_noreturn.hpp new file mode 100644 index 0000000000..1cb0763efd --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/attribute_noreturn.hpp @@ -0,0 +1,19 @@ +//Copyright (c) 2009 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_61531AB0680611DEADD5846855D89593 +#define UUID_61531AB0680611DEADD5846855D89593 + +#include + +#if defined(BOOST_MSVC) +#define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn) +#elif defined(__GNUC__) +#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn)) +#else +#define BOOST_ATTRIBUTE_NORETURN +#endif + +#endif diff --git a/deal.II/contrib/boost/include/boost/exception/detail/error_info_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/error_info_impl.hpp similarity index 86% rename from deal.II/contrib/boost/include/boost/exception/detail/error_info_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/detail/error_info_impl.hpp index 7a57b8bd6d..a25d066fd1 100644 --- a/deal.II/contrib/boost/include/boost/exception/detail/error_info_impl.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/error_info_impl.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) @@ -49,12 +49,18 @@ boost return value_; } + value_type & + value() + { + return value_; + } + private: char const * tag_typeid_name() const; std::string value_as_string() const; - value_type const value_; + value_type value_; }; } diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/exception_ptr_base.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/exception_ptr_base.hpp new file mode 100644 index 0000000000..ac68cab7c6 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/exception_ptr_base.hpp @@ -0,0 +1,33 @@ +//Copyright (c) 2006-2009 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_DC4208C6417811DEBF11E1EC55D89593 +#define UUID_DC4208C6417811DEBF11E1EC55D89593 + +namespace +boost + { + namespace + exception_detail + { + class + exception_ptr_base + { + public: + + virtual void _rethrow() const=0; + virtual bool _empty() const=0; + + protected: + + virtual + ~exception_ptr_base() throw() + { + } + }; + } + } + +#endif diff --git a/deal.II/contrib/boost/include/boost/exception/detail/is_output_streamable.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/is_output_streamable.hpp similarity index 93% rename from deal.II/contrib/boost/include/boost/exception/detail/is_output_streamable.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/detail/is_output_streamable.hpp index 57376bf3da..af59cb8d2f 100644 --- a/deal.II/contrib/boost/include/boost/exception/detail/is_output_streamable.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/is_output_streamable.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) diff --git a/deal.II/contrib/boost/include/boost/exception/detail/object_hex_dump.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/object_hex_dump.hpp similarity index 94% rename from deal.II/contrib/boost/include/boost/exception/detail/object_hex_dump.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/detail/object_hex_dump.hpp index a6221b6db5..f535944ea2 100644 --- a/deal.II/contrib/boost/include/boost/exception/detail/object_hex_dump.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/object_hex_dump.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) diff --git a/deal.II/contrib/boost/include/boost/exception/detail/type_info.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/type_info.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/exception/detail/type_info.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/detail/type_info.hpp index 97bf72615c..ac0960db68 100644 --- a/deal.II/contrib/boost/include/boost/exception/detail/type_info.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/detail/type_info.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/diagnostic_information.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/diagnostic_information.hpp new file mode 100644 index 0000000000..1ea9dc1bab --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/diagnostic_information.hpp @@ -0,0 +1,186 @@ +//Copyright (c) 2006-2009 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 +#include +#include +#include + +namespace +boost + { + namespace + exception_detail + { + template + struct + enable_boost_exception_overload + { + struct yes { char q[100]; }; + typedef char no; + static yes check(exception const *); + static no check(...); + enum e { value=sizeof(check((T*)0))==sizeof(yes) }; + }; + + template + struct + enable_std_exception_overload + { + struct yes { char q[100]; }; + typedef char no; + static yes check(std::exception const *); + static no check(...); + enum e { value = !enable_boost_exception_overload::value && sizeof(check((T*)0))==sizeof(yes) }; + }; + + inline + char const * + get_diagnostic_information( exception const & x, char const * header ) + { + if( error_info_container * c=x.data_.get() ) +#ifndef BOOST_NO_EXCEPTIONS + try + { +#endif + return c->diagnostic_information(header); +#ifndef BOOST_NO_EXCEPTIONS + } + catch(...) + { + } +#endif + return 0; + } + + inline + std::string + diagnostic_information_impl( boost::exception const * be, std::exception const * se, bool with_what ) + { + BOOST_ASSERT(be||se); +#ifndef BOOST_NO_RTTI + if( !se ) + se = dynamic_cast(be); + if( !be ) + be = dynamic_cast(se); +#endif + char const * wh=0; + if( with_what && se ) + { + wh=se->what(); + if( be && exception_detail::get_diagnostic_information(*be,0)==wh ) + return wh; + } + std::ostringstream tmp; + if( be ) + { + if( char const * const * f=get_error_info(*be) ) + { + tmp << *f; + if( int const * l=get_error_info(*be) ) + tmp << '(' << *l << "): "; + } + tmp << "Throw in function "; + if( char const * const * fn=get_error_info(*be) ) + tmp << *fn; + else + tmp << "(unknown)"; + tmp << '\n'; + } +#ifndef BOOST_NO_RTTI + tmp << std::string("Dynamic exception type: ") << + (be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n'; +#endif + if( with_what && se ) + tmp << "std::exception::what: " << wh << '\n'; + if( be ) + if( char const * s=exception_detail::get_diagnostic_information(*be,tmp.str().c_str()) ) + if( *s ) + return s; + return tmp.str(); + } + } + + template + inline + typename enable_if,std::string>::type + diagnostic_information( T const & e ) + { + return exception_detail::diagnostic_information_impl(&e,0,true); + } + + template + inline + typename enable_if,std::string>::type + diagnostic_information( T const & e ) + { + return exception_detail::diagnostic_information_impl(0,&e,true); + } + + inline + char const * + diagnostic_information_what( exception const & e ) throw() + { + char const * w=0; +#ifndef BOOST_NO_EXCEPTIONS + try + { +#endif + (void) exception_detail::diagnostic_information_impl(&e,0,false); + return exception_detail::get_diagnostic_information(e,0); +#ifndef BOOST_NO_EXCEPTIONS + } + catch( + ... ) + { + } +#endif + return w; + } + } + +#ifndef BOOST_NO_EXCEPTIONS +#include +namespace +boost + { + inline + std::string + current_exception_diagnostic_information() + { + boost::exception const * be=current_exception_cast(); + std::exception const * se=current_exception_cast(); + if( be || se ) + return exception_detail::diagnostic_information_impl(be,se,true); + else + return "No diagnostic information available."; + } + + inline + std::string + diagnostic_information( exception_detail::exception_ptr_base const & p ) + { + if( !p._empty() ) + try + { + p._rethrow(); + } + catch( + ... ) + { + return current_exception_diagnostic_information(); + } + return ""; + } + } +#endif + +#endif diff --git a/deal.II/contrib/boost/include/boost/exception/enable_current_exception.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/enable_current_exception.hpp similarity index 75% rename from deal.II/contrib/boost/include/boost/exception/enable_current_exception.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/enable_current_exception.hpp index 7e6403b83e..988105378c 100644 --- a/deal.II/contrib/boost/include/boost/exception/enable_current_exception.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/enable_current_exception.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) diff --git a/deal.II/contrib/boost/include/boost/exception/enable_error_info.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/enable_error_info.hpp similarity index 75% rename from deal.II/contrib/boost/include/boost/exception/enable_error_info.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/enable_error_info.hpp index 7e6403b83e..988105378c 100644 --- a/deal.II/contrib/boost/include/boost/exception/enable_error_info.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/enable_error_info.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_api_function.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_api_function.hpp new file mode 100644 index 0000000000..481c61314e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_api_function.hpp @@ -0,0 +1,22 @@ +//Copyright (c) 2006-2009 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_DDFBB4546C1211DEA4659E9055D89593 +#define UUID_DDFBB4546C1211DEA4659E9055D89593 + +#include "boost/exception/error_info.hpp" + +namespace +boost + { + //Usage hint: + //if( api_function(....)!=0 ) + // BOOST_THROW_EXCEPTION( + // failure() << + // errinfo_api_function("api_function") ); + typedef error_info errinfo_api_function; + } + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_at_line.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_at_line.hpp new file mode 100644 index 0000000000..cbd5ccefba --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_at_line.hpp @@ -0,0 +1,18 @@ +//Copyright (c) 2006-2009 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_E7255CE26C1211DE85800C9155D89593 +#define UUID_E7255CE26C1211DE85800C9155D89593 + +namespace +boost + { + template class error_info; + + //Use with parsing errors exceptions, for example in a XML file parser. + typedef error_info errinfo_at_line; + } + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_errno.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_errno.hpp new file mode 100644 index 0000000000..310ceb78d0 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_errno.hpp @@ -0,0 +1,35 @@ +//Copyright (c) 2006-2009 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_F0EE17BE6C1211DE87FF459155D89593 +#define UUID_F0EE17BE6C1211DE87FF459155D89593 + +#include "boost/exception/info.hpp" +#include +#include + +namespace +boost + { + typedef error_info errinfo_errno; + + //Usage hint: + //if( c_function(....)!=0 ) + // BOOST_THROW_EXCEPTION( + // failure() << + // errinfo_errno(errno) << + // errinfo_api_function("c_function") ); + inline + std::string + to_string( errinfo_errno const & e ) + { + std::ostringstream tmp; + int v=e.value(); + tmp << v << ", \"" << strerror(v) << "\""; + return tmp.str(); + } + } + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_file_handle.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_file_handle.hpp new file mode 100644 index 0000000000..8e6cff8fd8 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_file_handle.hpp @@ -0,0 +1,20 @@ +//Copyright (c) 2006-2009 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_F79E6EE26C1211DEB26E929155D89593 +#define UUID_F79E6EE26C1211DEB26E929155D89593 + +#include + +namespace +boost + { + template class weak_ptr; + template class error_info; + + typedef error_info > errinfo_file_handle; + } + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_file_name.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_file_name.hpp new file mode 100644 index 0000000000..d3cce4d356 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_file_name.hpp @@ -0,0 +1,26 @@ +//Copyright (c) 2006-2009 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_FEE5120A6C1211DE94E8BC9155D89593 +#define UUID_FEE5120A6C1211DE94E8BC9155D89593 + +#include + +namespace +boost + { + template class error_info; + + //Usage hint: + //FILE * f=fopen(name,mode); + //if( !f ) + // BOOST_THROW_EXCEPTION( + // file_open_error() << + // errinfo_file_name(name) << + // errinfo_file_open_mode(mode) ); + typedef error_info errinfo_file_name; + } + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_file_open_mode.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_file_open_mode.hpp new file mode 100644 index 0000000000..f4fba0d5cc --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_file_open_mode.hpp @@ -0,0 +1,26 @@ +//Copyright (c) 2006-2009 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_056F1F266C1311DE8E74299255D89593 +#define UUID_056F1F266C1311DE8E74299255D89593 + +#include + +namespace +boost + { + template class error_info; + + //Usage hint: + //FILE * f=fopen(name,mode); + //if( !f ) + // BOOST_THROW_EXCEPTION( + // file_open_error() << + // errinfo_file_name(name) << + // errinfo_file_open_mode(mode) ); + typedef error_info errinfo_file_open_mode; + } + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_nested_exception.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_nested_exception.hpp new file mode 100644 index 0000000000..de055e035f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_nested_exception.hpp @@ -0,0 +1,17 @@ +//Copyright (c) 2006-2009 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_45CC9A82B77511DEB330FC4956D89593 +#define UUID_45CC9A82B77511DEB330FC4956D89593 + +namespace +boost + { + template class error_info; + class exception_ptr; + typedef error_info errinfo_nested_exception; + } + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_type_info_name.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_type_info_name.hpp new file mode 100644 index 0000000000..0b060e2e11 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/errinfo_type_info_name.hpp @@ -0,0 +1,23 @@ +//Copyright (c) 2006-2009 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_0E11109E6C1311DEB7EA649255D89593 +#define UUID_0E11109E6C1311DEB7EA649255D89593 + +#include + +namespace +boost + { + template class error_info; + + //Usage hint: + //BOOST_THROW_EXCEPTION( + // bad_type() << + // errinfo_type_info_name(typeid(x).name()) ); + typedef error_info errinfo_type_info_name; + } + +#endif diff --git a/deal.II/contrib/boost/include/boost/exception/error_info.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/error_info.hpp similarity index 77% rename from deal.II/contrib/boost/include/boost/exception/error_info.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/error_info.hpp index d80bf399d8..2e6832a338 100644 --- a/deal.II/contrib/boost/include/boost/exception/error_info.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/error_info.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) diff --git a/deal.II/contrib/boost/include/boost/exception/exception.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/exception.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/exception/exception.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/exception.hpp index 53e6ed0c87..e7faf594c4 100644 --- a/deal.II/contrib/boost/include/boost/exception/exception.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/exception.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) @@ -80,13 +80,13 @@ boost template class error_info; - typedef error_info throw_function; - typedef error_info throw_file; - typedef error_info throw_line; + typedef error_info throw_function; + typedef error_info throw_file; + typedef error_info throw_line; template <> class - error_info + error_info { public: typedef char const * value_type; @@ -100,7 +100,7 @@ boost template <> class - error_info + error_info { public: typedef char const * value_type; @@ -114,7 +114,7 @@ boost template <> class - error_info + error_info { public: typedef int value_type; @@ -143,9 +143,9 @@ boost 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 char const * diagnostic_information( char const * ) 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; @@ -169,7 +169,7 @@ boost template <> struct get_info; - char const * get_diagnostic_information( exception const & ); + char const * get_diagnostic_information( exception const &, char const * ); } class @@ -231,7 +231,7 @@ boost return x; } - friend char const * exception_detail::get_diagnostic_information( exception const & ); + friend char const * exception_detail::get_diagnostic_information( exception const &, char const * ); template friend E const & operator<<( E const &, error_info const & ); diff --git a/deal.II/contrib/boost/include/boost/exception/get_error_info.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/get_error_info.hpp similarity index 50% rename from deal.II/contrib/boost/include/boost/exception/get_error_info.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/get_error_info.hpp index e45d3d6eb0..640a612f3d 100644 --- a/deal.II/contrib/boost/include/boost/exception/get_error_info.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/get_error_info.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) @@ -17,23 +17,25 @@ boost namespace exception_detail { + template struct - strwrap + get_info { - std::string str; - char const * ptr; - - explicit - strwrap( char const * s ): - str(s), - ptr(&str[0]) + static + typename ErrorInfo::value_type * + 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 * w = static_cast(eib.get()); + return &w->value(); + } + return 0; } - - private: - - strwrap( strwrap const & ); - strwrap & operator=( strwrap const & ); }; template <> @@ -41,16 +43,10 @@ boost get_info { static - shared_ptr + char const * * 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(); + return x.throw_function_ ? &x.throw_function_ : 0; } }; @@ -59,16 +55,10 @@ boost get_info { static - shared_ptr + char const * * 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(); + return x.throw_file_ ? &x.throw_file_ : 0; } }; @@ -77,56 +67,53 @@ boost get_info { static - shared_ptr + int * get( exception const & x ) { - if( x.throw_line_!=-1 ) - return boost::shared_ptr(new int(x.throw_line_)); - else - return shared_ptr(); + return x.throw_line_!=-1 ? &x.throw_line_ : 0; } }; - template + template struct - get_info + get_error_info_return_type { - 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(); - } + typedef R * type; + }; + + template + struct + get_error_info_return_type + { + typedef R const * type; }; } #ifdef BOOST_NO_RTTI template inline - shared_ptr + typename ErrorInfo::value_type const * get_error_info( boost::exception const & x ) { return exception_detail::get_info::get(x); } + template + inline + typename ErrorInfo::value_type * + get_error_info( boost::exception & x ) + { + return exception_detail::get_info::get(x); + } #else template inline - shared_ptr - get_error_info( E const & some_exception ) + typename exception_detail::get_error_info_return_type::type + get_error_info( E & some_exception ) { if( exception const * x = dynamic_cast(&some_exception) ) return exception_detail::get_info::get(*x); else - return shared_ptr(); + return 0; } #endif } diff --git a/deal.II/contrib/boost/include/boost/exception/info.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/info.hpp similarity index 77% rename from deal.II/contrib/boost/include/boost/exception/info.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/info.hpp index a0892c9c84..c1b76c02cf 100644 --- a/deal.II/contrib/boost/include/boost/exception/info.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/info.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) @@ -15,6 +15,14 @@ namespace boost { + template + inline + typename enable_if,std::string>::type + to_string( error_info const & x ) + { + return to_string(x.value()); + } + template inline error_info:: @@ -45,7 +53,7 @@ boost error_info:: value_as_string() const { - return to_string_stub(value_); + return to_string_stub(*this); } namespace @@ -67,44 +75,42 @@ boost } void - set( shared_ptr const & x, type_info_ const & typeid_ ) + set( shared_ptr const & x, type_info_ const & typeid_ ) { BOOST_ASSERT(x); info_[typeid_] = x; diagnostic_info_str_.clear(); } - shared_ptr + 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; + shared_ptr const & p = i->second; #ifndef BOOST_NO_RTTI BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p)==ti ); #endif return p; } - return shared_ptr(); + return shared_ptr(); } char const * - diagnostic_information() const + diagnostic_information( char const * header ) const { - if( diagnostic_info_str_.empty() ) + if( header ) { - std::string tmp; + BOOST_ASSERT(*header!=0); + std::ostringstream tmp; + tmp << header; 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'; + tmp << '[' << x->tag_typeid_name() << "] = " << x->value_as_string() << '\n'; } - diagnostic_info_str_.swap(tmp); + tmp.str().swap(diagnostic_info_str_); } return diagnostic_info_str_.c_str(); } @@ -113,7 +119,7 @@ boost friend class boost::exception; - typedef std::map< type_info_, shared_ptr > error_info_map; + typedef std::map< type_info_, shared_ptr > error_info_map; error_info_map info_; mutable std::string diagnostic_info_str_; mutable int count_; diff --git a/deal.II/contrib/boost/include/boost/exception/info_tuple.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/info_tuple.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/exception/info_tuple.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/info_tuple.hpp index 3c8197a7e3..38b2512626 100644 --- a/deal.II/contrib/boost/include/boost/exception/info_tuple.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/info_tuple.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) diff --git a/deal.II/contrib/boost/include/boost/exception/to_string.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/to_string.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/exception/to_string.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/to_string.hpp index e10cbfdebc..5d88efa467 100644 --- a/deal.II/contrib/boost/include/boost/exception/to_string.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/to_string.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) diff --git a/deal.II/contrib/boost/include/boost/exception/to_string_stub.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception/to_string_stub.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/exception/to_string_stub.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception/to_string_stub.hpp index 1cd08bbc8f..4b7028144f 100644 --- a/deal.II/contrib/boost/include/boost/exception/to_string_stub.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception/to_string_stub.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) diff --git a/deal.II/contrib/boost/include/boost/exception_ptr.hpp b/deal.II/contrib/boost-1.41.0/include/boost/exception_ptr.hpp similarity index 67% rename from deal.II/contrib/boost/include/boost/exception_ptr.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/exception_ptr.hpp index 196329d254..91dce257c0 100644 --- a/deal.II/contrib/boost/include/boost/exception_ptr.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/exception_ptr.hpp @@ -1,4 +1,4 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. +//Copyright (c) 2006-2009 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) @@ -6,21 +6,40 @@ #ifndef UUID_FA5836A2CADA11DC8CD47C8555D89593 #define UUID_FA5836A2CADA11DC8CD47C8555D89593 +#include +#ifdef BOOST_NO_EXCEPTIONS +#error This header requires exception handling to be enabled. +#endif #include +#include +#include #include #include #include #include +#include namespace boost { +#ifndef BOOST_NO_RTTI + typedef error_info original_exception_type; + + inline + std::string + to_string( original_exception_type const & x ) + { + return x.value()->name(); + } +#endif + class exception_ptr; exception_ptr current_exception(); void rethrow_exception( exception_ptr const & ); class - exception_ptr + exception_ptr: + public exception_detail::exception_ptr_base { typedef bool exception_ptr::*unspecified_bool_type; friend exception_ptr current_exception(); @@ -48,6 +67,22 @@ boost BOOST_ASSERT(c); } + void + _rethrow() const + { + BOOST_ASSERT(*this); + if( bad_alloc_ ) + throw enable_current_exception(std::bad_alloc()); + else + c_->rethrow(); + } + + bool + _empty() const + { + return !bad_alloc_ && !c_; + } + public: exception_ptr(): @@ -57,7 +92,7 @@ boost operator unspecified_bool_type() const { - return (bad_alloc_ || c_) ? &exception_ptr::bad_alloc_ : 0; + return _empty() ? 0 : &exception_ptr::bad_alloc_; } friend @@ -87,10 +122,17 @@ boost { } + explicit + unknown_exception( std::exception const & e ) + { + add_original_type(e); + } + explicit unknown_exception( boost::exception const & e ): boost::exception(e) { + add_original_type(e); } ~unknown_exception() throw() @@ -99,7 +141,7 @@ boost private: - exception_detail::clone_base const * + exception_detail::clone_base const * clone() const { return new unknown_exception(*this); @@ -110,6 +152,15 @@ boost { throw*this; } + + template + void + add_original_type( E const & e ) + { +#ifndef BOOST_NO_RTTI + (*this) << original_exception_type(&typeid(e)); +#endif + } }; namespace @@ -128,12 +179,14 @@ boost current_exception_std_exception_wrapper( T const & e1 ): T(e1) { + add_original_type(e1); } current_exception_std_exception_wrapper( T const & e1, boost::exception const & e2 ): T(e1), boost::exception(e2) { + add_original_type(e1); } ~current_exception_std_exception_wrapper() throw() @@ -153,6 +206,15 @@ boost { throw *this; } + + template + void + add_original_type( E const & e ) + { +#ifndef BOOST_NO_RTTI + (*this) << original_exception_type(&typeid(e)); +#endif + } }; #ifdef BOOST_NO_RTTI @@ -189,23 +251,23 @@ boost 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)); + return shared_ptr const>(new current_exception_std_exception_wrapper(e1,*e2)); else - return shared_ptr(new current_exception_std_exception_wrapper(e1)); + return shared_ptr const>(new current_exception_std_exception_wrapper(e1)); } inline shared_ptr current_exception_unknown_exception() { - return shared_ptr(new 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)); + return shared_ptr(new unknown_exception(e)); } inline @@ -215,7 +277,7 @@ boost if( boost::exception const * be = get_boost_exception(&e) ) return current_exception_unknown_boost_exception(*be); else - return current_exception_unknown_exception(); + return shared_ptr(new unknown_exception(e)); } inline @@ -232,11 +294,21 @@ boost return shared_ptr(e.clone()); } catch( + std::domain_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( std::invalid_argument & e ) { return exception_detail::current_exception_std_exception(e); } catch( + std::length_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( std::out_of_range & e ) { return exception_detail::current_exception_std_exception(e); @@ -247,6 +319,31 @@ boost return exception_detail::current_exception_std_exception(e); } catch( + std::range_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::overflow_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::underflow_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::ios_base::failure & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::runtime_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( std::bad_alloc & e ) { return exception_detail::current_exception_std_exception(e); @@ -338,11 +435,26 @@ boost 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(); + p._rethrow(); + } + + inline + std::string + to_string( exception_ptr const & p ) + { + std::string s='\n'+diagnostic_information(p); + std::string padding(" "); + std::string r; + bool f=false; + for( std::string::const_iterator i=s.begin(),e=s.end(); i!=e; ++i ) + { + if( f ) + r+=padding; + char c=*i; + r+=c; + f=(c=='\n'); + } + return r; } } diff --git a/deal.II/contrib/boost/include/boost/filesystem.hpp b/deal.II/contrib/boost-1.41.0/include/boost/filesystem.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/filesystem.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/filesystem.hpp diff --git a/deal.II/contrib/boost/include/boost/foreach.hpp b/deal.II/contrib/boost-1.41.0/include/boost/foreach.hpp similarity index 91% rename from deal.II/contrib/boost/include/boost/foreach.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/foreach.hpp index 86f8f9cb85..9a5b931bcb 100644 --- a/deal.II/contrib/boost/include/boost/foreach.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/foreach.hpp @@ -50,7 +50,7 @@ # 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(BOOST_INTEL_WIN, BOOST_TESTED_AT(1400)) \ || BOOST_WORKAROUND(__GNUC__, < 3) \ || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ <= 2)) \ || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ <= 3) && defined(__APPLE_CC__)) \ @@ -218,8 +218,8 @@ 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::not_ *not_(Bool1 *) { return 0; } template inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; } @@ -868,6 +868,17 @@ rderef(auto_any_t cur, type2type *) # define BOOST_FOREACH_SUPPRESS_WARNINGS() #endif +/////////////////////////////////////////////////////////////////////////////// +// Define a macro for giving hidden variables a unique name. Not strictly +// needed, but eliminates some warnings on some compilers. +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500)) +// With some versions of MSVC, use of __LINE__ to create unique identifiers +// can fail when the Edit-and-Continue debug flag is used. +# define BOOST_FOREACH_ID(x) x +#else +# define BOOST_FOREACH_ID(x) BOOST_PP_CAT(x, __LINE__) +#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))) @@ -912,11 +923,11 @@ rderef(auto_any_t cur, type2type *) // 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 + if (bool BOOST_FOREACH_ID(_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)) + (true ? boost::foreach_detail_::make_probe((COL), BOOST_FOREACH_ID(_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. @@ -928,7 +939,7 @@ rderef(auto_any_t cur, type2type *) , 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)) + , &BOOST_FOREACH_ID(_foreach_is_rvalue))) #elif !defined(BOOST_FOREACH_NO_RVALUE_DETECTION) /////////////////////////////////////////////////////////////////////////////// @@ -976,58 +987,58 @@ rderef(auto_any_t cur, type2type *) #define BOOST_FOREACH_BEGIN(COL) \ boost::foreach_detail_::begin( \ - _foreach_col \ + BOOST_FOREACH_ID(_foreach_col) \ , BOOST_FOREACH_TYPEOF(COL) \ , BOOST_FOREACH_SHOULD_COPY(COL)) #define BOOST_FOREACH_END(COL) \ boost::foreach_detail_::end( \ - _foreach_col \ + BOOST_FOREACH_ID(_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_ID(_foreach_cur) \ + , BOOST_FOREACH_ID(_foreach_end) \ , BOOST_FOREACH_TYPEOF(COL)) #define BOOST_FOREACH_NEXT(COL) \ boost::foreach_detail_::next( \ - _foreach_cur \ + BOOST_FOREACH_ID(_foreach_cur) \ , BOOST_FOREACH_TYPEOF(COL)) #define BOOST_FOREACH_DEREF(COL) \ boost::foreach_detail_::deref( \ - _foreach_cur \ + BOOST_FOREACH_ID(_foreach_cur) \ , BOOST_FOREACH_TYPEOF(COL)) #define BOOST_FOREACH_RBEGIN(COL) \ boost::foreach_detail_::rbegin( \ - _foreach_col \ + BOOST_FOREACH_ID(_foreach_col) \ , BOOST_FOREACH_TYPEOF(COL) \ , BOOST_FOREACH_SHOULD_COPY(COL)) #define BOOST_FOREACH_REND(COL) \ boost::foreach_detail_::rend( \ - _foreach_col \ + BOOST_FOREACH_ID(_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_ID(_foreach_cur) \ + , BOOST_FOREACH_ID(_foreach_end) \ , BOOST_FOREACH_TYPEOF(COL)) #define BOOST_FOREACH_RNEXT(COL) \ boost::foreach_detail_::rnext( \ - _foreach_cur \ + BOOST_FOREACH_ID(_foreach_cur) \ , BOOST_FOREACH_TYPEOF(COL)) #define BOOST_FOREACH_RDEREF(COL) \ boost::foreach_detail_::rderef( \ - _foreach_cur \ + BOOST_FOREACH_ID(_foreach_cur) \ , BOOST_FOREACH_TYPEOF(COL)) /////////////////////////////////////////////////////////////////////////////// @@ -1056,16 +1067,16 @@ rderef(auto_any_t cur, type2type *) // 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) +#define BOOST_FOREACH(VAR, COL) \ + BOOST_FOREACH_PREAMBLE() \ + if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_col) = BOOST_FOREACH_CONTAIN(COL)) {} else \ + if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_BEGIN(COL)) {} else \ + if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_end) = BOOST_FOREACH_END(COL)) {} else \ + for (bool BOOST_FOREACH_ID(_foreach_continue) = true; \ + BOOST_FOREACH_ID(_foreach_continue) && !BOOST_FOREACH_DONE(COL); \ + BOOST_FOREACH_ID(_foreach_continue) ? BOOST_FOREACH_NEXT(COL) : (void)0) \ + if (boost::foreach_detail_::set_false(BOOST_FOREACH_ID(_foreach_continue))) {} else \ + for (VAR = BOOST_FOREACH_DEREF(COL); !BOOST_FOREACH_ID(_foreach_continue); BOOST_FOREACH_ID(_foreach_continue) = true) /////////////////////////////////////////////////////////////////////////////// // BOOST_REVERSE_FOREACH @@ -1074,15 +1085,15 @@ rderef(auto_any_t cur, type2type *) // 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) +#define BOOST_REVERSE_FOREACH(VAR, COL) \ + BOOST_FOREACH_PREAMBLE() \ + if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_col) = BOOST_FOREACH_CONTAIN(COL)) {} else \ + if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_RBEGIN(COL)) {} else \ + if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_end) = BOOST_FOREACH_REND(COL)) {} else \ + for (bool BOOST_FOREACH_ID(_foreach_continue) = true; \ + BOOST_FOREACH_ID(_foreach_continue) && !BOOST_FOREACH_RDONE(COL); \ + BOOST_FOREACH_ID(_foreach_continue) ? BOOST_FOREACH_RNEXT(COL) : (void)0) \ + if (boost::foreach_detail_::set_false(BOOST_FOREACH_ID(_foreach_continue))) {} else \ + for (VAR = BOOST_FOREACH_RDEREF(COL); !BOOST_FOREACH_ID(_foreach_continue); BOOST_FOREACH_ID(_foreach_continue) = true) #endif diff --git a/deal.II/contrib/boost/include/boost/format.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format.hpp diff --git a/deal.II/contrib/boost/include/boost/format/alt_sstream.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/alt_sstream.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/alt_sstream.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/alt_sstream.hpp diff --git a/deal.II/contrib/boost/include/boost/format/alt_sstream_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/alt_sstream_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/alt_sstream_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/alt_sstream_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/format/detail/compat_workarounds.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/detail/compat_workarounds.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/detail/compat_workarounds.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/detail/compat_workarounds.hpp diff --git a/deal.II/contrib/boost/include/boost/format/detail/config_macros.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/detail/config_macros.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/detail/config_macros.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/detail/config_macros.hpp diff --git a/deal.II/contrib/boost/include/boost/format/detail/msvc_disambiguater.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/detail/msvc_disambiguater.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/detail/msvc_disambiguater.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/detail/msvc_disambiguater.hpp diff --git a/deal.II/contrib/boost/include/boost/format/detail/unset_macros.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/detail/unset_macros.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/detail/unset_macros.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/detail/unset_macros.hpp diff --git a/deal.II/contrib/boost/include/boost/format/detail/workarounds_gcc-2_95.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/detail/workarounds_gcc-2_95.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/detail/workarounds_gcc-2_95.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/detail/workarounds_gcc-2_95.hpp diff --git a/deal.II/contrib/boost/include/boost/format/detail/workarounds_stlport.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/detail/workarounds_stlport.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/detail/workarounds_stlport.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/detail/workarounds_stlport.hpp diff --git a/deal.II/contrib/boost/include/boost/format/exceptions.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/exceptions.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/exceptions.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/exceptions.hpp diff --git a/deal.II/contrib/boost/include/boost/format/feed_args.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/feed_args.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/feed_args.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/feed_args.hpp diff --git a/deal.II/contrib/boost/include/boost/format/format_class.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/format_class.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/format_class.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/format_class.hpp diff --git a/deal.II/contrib/boost/include/boost/format/format_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/format_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/format_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/format_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/format/format_implementation.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/format_implementation.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/format/format_implementation.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/format_implementation.hpp index 28300e579f..9dd93a5acf 100644 --- a/deal.II/contrib/boost/include/boost/format/format_implementation.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/format/format_implementation.hpp @@ -37,7 +37,7 @@ namespace boost { 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) + exceptions_(io::all_error_bits), loc_(loc) { if(s) parse( s ); } @@ -45,7 +45,7 @@ namespace boost { 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) + exceptions_(io::all_error_bits), loc_(loc) { parse(s); } diff --git a/deal.II/contrib/boost/include/boost/format/free_funcs.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/free_funcs.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/free_funcs.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/free_funcs.hpp diff --git a/deal.II/contrib/boost/include/boost/format/group.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/group.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/group.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/group.hpp diff --git a/deal.II/contrib/boost/include/boost/format/internals.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/internals.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/internals.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/internals.hpp diff --git a/deal.II/contrib/boost/include/boost/format/internals_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/internals_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/format/internals_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/internals_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/format/parsing.hpp b/deal.II/contrib/boost-1.41.0/include/boost/format/parsing.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/format/parsing.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/format/parsing.hpp index 7f1bfc883f..b14ca82c98 100644 --- a/deal.II/contrib/boost/include/boost/format/parsing.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/format/parsing.hpp @@ -48,6 +48,7 @@ namespace detail { #if ! defined( BOOST_NO_LOCALE_ISDIGIT ) return fac.is(std::ctype::digit, c); # else + (void) fac; // remove "unused parameter" warning using namespace std; return isdigit(c); #endif diff --git a/deal.II/contrib/boost/include/boost/function.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function.hpp diff --git a/deal.II/contrib/boost/include/boost/function/detail/function_iterate.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/detail/function_iterate.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/detail/function_iterate.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/detail/function_iterate.hpp diff --git a/deal.II/contrib/boost/include/boost/function/detail/gen_maybe_include.pl b/deal.II/contrib/boost-1.41.0/include/boost/function/detail/gen_maybe_include.pl similarity index 100% rename from deal.II/contrib/boost/include/boost/function/detail/gen_maybe_include.pl rename to deal.II/contrib/boost-1.41.0/include/boost/function/detail/gen_maybe_include.pl diff --git a/deal.II/contrib/boost/include/boost/function/detail/maybe_include.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/detail/maybe_include.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/detail/maybe_include.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/detail/maybe_include.hpp diff --git a/deal.II/contrib/boost/include/boost/function/detail/prologue.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/detail/prologue.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/detail/prologue.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/detail/prologue.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function0.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function1.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function10.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function10.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function10.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function10.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function2.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function2.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function2.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function2.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function3.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function3.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function3.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function3.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function4.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function4.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function4.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function4.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function5.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function5.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function5.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function5.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function6.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function6.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function6.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function6.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function7.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function7.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function7.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function7.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function8.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function8.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function8.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function8.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function9.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function9.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function9.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function9.hpp diff --git a/deal.II/contrib/boost/include/boost/function/function_base.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function_base.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/function/function_base.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function_base.hpp index 6612fb8415..c4663c35a8 100644 --- a/deal.II/contrib/boost/include/boost/function/function_base.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/function/function_base.hpp @@ -18,6 +18,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -42,7 +45,7 @@ #endif // Define BOOST_FUNCTION_STD_NS to the namespace that contains type_info. -#ifdef BOOST_NO_EXCEPTION_STD_NAMESPACE +#ifdef BOOST_NO_STD_TYPEINFO // Embedded VC++ does not have type_info in namespace std # define BOOST_FUNCTION_STD_NS #else @@ -259,6 +262,12 @@ namespace boost { A(a) { } + + functor_wrapper(const functor_wrapper& f) : + F(static_cast(f)), + A(static_cast(f)) + { + } }; /** @@ -625,7 +634,7 @@ public: if (!vtable) return typeid(void); detail::function::function_buffer type; - vtable->manager(functor, type, detail::function::get_functor_type_tag); + get_vtable()->manager(functor, type, detail::function::get_functor_type_tag); return *type.type.type; } @@ -638,7 +647,7 @@ public: 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, + get_vtable()->manager(functor, type_result, detail::function::check_functor_type_tag); return static_cast(type_result.obj_ptr); } @@ -656,7 +665,7 @@ public: 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, + get_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. @@ -702,6 +711,15 @@ public: #endif public: // should be protected, but GCC 2.95.3 will fail to allow access + detail::function::vtable_base* get_vtable() const { + return reinterpret_cast( + reinterpret_cast(vtable) & ~(std::size_t)0x01); + } + + bool has_trivial_copy_and_destroy() const { + return reinterpret_cast(vtable) & 0x01; + } + detail::function::vtable_base* vtable; mutable detail::function::function_buffer functor; }; @@ -877,4 +895,8 @@ namespace detail { #undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL #undef BOOST_FUNCTION_COMPARE_TYPE_ID +#if defined(BOOST_MSVC) +# pragma warning( pop ) +#endif + #endif // BOOST_FUNCTION_BASE_HEADER diff --git a/deal.II/contrib/boost/include/boost/function/function_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function_fwd.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/function/function_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function_fwd.hpp index d2f713a5dc..fb318c990a 100644 --- a/deal.II/contrib/boost/include/boost/function/function_fwd.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/function/function_fwd.hpp @@ -21,7 +21,7 @@ namespace boost { namespace python { namespace objects { #if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ || defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ - || !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) + || !(defined(BOOST_STRICT_CONFIG) || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) # define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX #endif diff --git a/deal.II/contrib/boost/include/boost/function/function_template.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function_template.hpp similarity index 93% rename from deal.II/contrib/boost/include/boost/function/function_template.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function_template.hpp index 584abe96ba..6a99109ab1 100644 --- a/deal.II/contrib/boost/include/boost/function/function_template.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/function/function_template.hpp @@ -11,6 +11,7 @@ // Note: this header is a header template and must NOT have multiple-inclusion // protection. #include +#include #if defined(BOOST_MSVC) # pragma warning( push ) @@ -624,14 +625,10 @@ namespace boost { 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; - } + 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; } template bool @@ -678,6 +675,11 @@ namespace boost { R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS> vtable_type; + vtable_type* get_vtable() const { + return reinterpret_cast( + reinterpret_cast(vtable) & ~(std::size_t)0x01); + } + struct clear_type {}; public: @@ -757,7 +759,7 @@ namespace boost { if (this->empty()) boost::throw_exception(bad_function_call()); - return static_cast(vtable)->invoker + return get_vtable()->invoker (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); } #else @@ -781,24 +783,26 @@ namespace boost { operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { this->clear(); - try { + BOOST_TRY { this->assign_to(f); - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } + BOOST_CATCH_END return *this; } template void assign(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a) { this->clear(); - try { + BOOST_TRY{ this->assign_to_a(f,a); - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } + BOOST_CATCH_END } #ifndef BOOST_NO_SFINAE @@ -823,12 +827,13 @@ namespace boost { return *this; this->clear(); - try { + BOOST_TRY { this->assign_to_own(f); - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } + BOOST_CATCH_END return *this; } @@ -847,7 +852,8 @@ namespace boost { void clear() { if (vtable) { - reinterpret_cast(vtable)->clear(this->functor); + if (!this->has_trivial_copy_and_destroy()) + get_vtable()->clear(this->functor); vtable = 0; } } @@ -876,8 +882,11 @@ namespace boost { { if (!f.empty()) { this->vtable = f.vtable; - f.vtable->manager(f.functor, this->functor, - boost::detail::function::clone_functor_tag); + if (this->has_trivial_copy_and_destroy()) + this->functor = f.functor; + else + get_vtable()->base.manager(f.functor, this->functor, + boost::detail::function::clone_functor_tag); } } @@ -903,8 +912,15 @@ namespace boost { 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; + if (stored_vtable.assign_to(f, functor)) { + std::size_t value = reinterpret_cast(&stored_vtable.base); + if (boost::has_trivial_copy_constructor::value && + boost::has_trivial_destructor::value && + detail::function::function_allows_small_object_optimization::value) + value |= (std::size_t)0x01; + vtable = reinterpret_cast(value); + } else + vtable = 0; } template @@ -930,8 +946,15 @@ namespace boost { 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; + if (stored_vtable.assign_to_a(f, functor, a)) { + std::size_t value = reinterpret_cast(&stored_vtable.base); + if (boost::has_trivial_copy_constructor::value && + boost::has_trivial_destructor::value && + detail::function::function_allows_small_object_optimization::value) + value |= (std::size_t)0x01; + vtable = reinterpret_cast(value); + } else + vtable = 0; } // Moves the value from the specified argument to *this. If the argument @@ -942,23 +965,23 @@ namespace boost { if (&f == this) return; -#if !defined(BOOST_NO_EXCEPTIONS) - try { -#endif + BOOST_TRY { 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) + if (this->has_trivial_copy_and_destroy()) + this->functor = f.functor; + else + get_vtable()->base.manager(f.functor, this->functor, + boost::detail::function::move_functor_tag); + f.vtable = 0; } else { clear(); } - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } -#endif + BOOST_CATCH_END } }; @@ -979,13 +1002,14 @@ namespace boost { template typename BOOST_FUNCTION_FUNCTION< R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>::result_type - BOOST_FUNCTION_FUNCTION + inline + BOOST_FUNCTION_FUNCTION ::operator()(BOOST_FUNCTION_PARMS) const { if (this->empty()) boost::throw_exception(bad_function_call()); - return reinterpret_cast(vtable)->invoker + return get_vtable()->invoker (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); } #endif diff --git a/deal.II/contrib/boost/include/boost/function/function_typeof.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function/function_typeof.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function/function_typeof.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function/function_typeof.hpp diff --git a/deal.II/contrib/boost/include/boost/function/gen_function_N.pl b/deal.II/contrib/boost-1.41.0/include/boost/function/gen_function_N.pl similarity index 100% rename from deal.II/contrib/boost/include/boost/function/gen_function_N.pl rename to deal.II/contrib/boost-1.41.0/include/boost/function/gen_function_N.pl diff --git a/deal.II/contrib/boost/include/boost/function_equal.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_equal.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_equal.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_equal.hpp diff --git a/deal.II/contrib/boost/include/boost/function_output_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_output_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_output_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_output_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/components.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/components.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/components.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/components.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/config/cc_names.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/config/cc_names.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/config/cc_names.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/config/cc_names.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/config/compiler.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/config/compiler.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/config/compiler.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/config/compiler.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/config/config.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/config/config.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/config/config.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/config/config.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/class_transform.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/class_transform.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/class_transform.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/class_transform.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity10_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity10_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity10_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity10_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity10_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity10_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity10_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity10_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity20_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity20_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity20_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity20_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity20_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity20_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity20_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity20_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity30_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity30_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity30_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity30_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity30_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity30_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity30_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity30_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity40_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity40_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity40_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity40_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity40_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity40_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity40_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity40_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity50_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity50_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity50_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity50_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity50_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity50_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/arity50_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/arity50_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/master.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/master.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/classifier_impl/master.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/classifier_impl/master.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_as_mpl_sequence.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_as_mpl_sequence.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_as_mpl_sequence.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_as_mpl_sequence.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity10_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity10_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity10_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity10_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity10_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity10_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity10_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity10_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity20_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity20_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity20_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity20_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity20_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity20_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity20_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity20_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity30_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity30_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity30_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity30_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity30_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity30_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity30_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity30_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity40_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity40_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity40_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity40_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity40_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity40_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity40_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity40_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity50_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity50_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity50_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity50_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity50_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity50_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_impl/arity50_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/arity50_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/components_impl/master.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/master.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/components_impl/master.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/components_impl/master.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/cv_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/cv_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/cv_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/cv_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/encoding/aliases_def.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/encoding/aliases_def.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/encoding/aliases_def.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/encoding/aliases_def.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/encoding/aliases_undef.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/encoding/aliases_undef.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/encoding/aliases_undef.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/encoding/aliases_undef.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/encoding/def.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/encoding/def.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/encoding/def.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/encoding/def.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/encoding/undef.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/encoding/undef.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/encoding/undef.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/encoding/undef.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/pp_arity_loop.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_arity_loop.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/pp_arity_loop.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_arity_loop.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/pp_cc_loop/master.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_cc_loop/master.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/pp_cc_loop/master.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_cc_loop/master.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/pp_cc_loop/preprocessed.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_cc_loop/preprocessed.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/pp_cc_loop/preprocessed.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_cc_loop/preprocessed.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/pp_loop.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_loop.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/pp_loop.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_loop.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/pp_retag_default_cc/master.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_retag_default_cc/master.hpp similarity index 94% rename from deal.II/contrib/boost/include/boost/function_types/detail/pp_retag_default_cc/master.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_retag_default_cc/master.hpp index f97d385ed7..865efce519 100644 --- a/deal.II/contrib/boost/include/boost/function_types/detail/pp_retag_default_cc/master.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_retag_default_cc/master.hpp @@ -30,8 +30,8 @@ namespace detail # 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) + (::boost::function_types::detail::bits::value & BOOST_FT_default_cc) + | (::boost::function_types::detail::bits::value & BOOST_PP_SLOT(1)) )); }; diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp index c21a4fd2bd..72666d0f27 100644 --- a/deal.II/contrib/boost/include/boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp @@ -15,8 +15,8 @@ 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 +(::boost::function_types::detail::bits ::value & 0x00008000) +| (::boost::function_types::detail::bits ::value & 802) )); }; template struct default_cc_tag; diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/pp_tags/cc_tag.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_tags/cc_tag.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/pp_tags/cc_tag.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_tags/cc_tag.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/pp_tags/master.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_tags/master.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/function_types/detail/pp_tags/master.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_tags/master.hpp index 783b93cdf7..9cce212fcd 100644 --- a/deal.II/contrib/boost/include/boost/function_types/detail/pp_tags/master.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_tags/master.hpp @@ -82,7 +82,7 @@ namespace detail { ); BOOST_STATIC_CONSTANT(bits_t, combined_bits = - LHS_bits & ~RHS_mask | RHS_bits + (LHS_bits & ~RHS_mask) | RHS_bits ); BOOST_STATIC_CONSTANT(bits_t, combined_mask = diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/pp_tags/preprocessed.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_tags/preprocessed.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/function_types/detail/pp_tags/preprocessed.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_tags/preprocessed.hpp index 811d62a74d..823c3cc1cd 100644 --- a/deal.II/contrib/boost/include/boost/function_types/detail/pp_tags/preprocessed.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_tags/preprocessed.hpp @@ -53,7 +53,7 @@ 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 +(LHS_bits & ~RHS_mask) | RHS_bits ); BOOST_STATIC_CONSTANT(bits_t, combined_mask = LHS_mask | RHS_mask diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/pp_variate_loop/master.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_variate_loop/master.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/pp_variate_loop/master.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_variate_loop/master.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/pp_variate_loop/preprocessed.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_variate_loop/preprocessed.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/pp_variate_loop/preprocessed.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/pp_variate_loop/preprocessed.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/retag_default_cc.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/retag_default_cc.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/retag_default_cc.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/retag_default_cc.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity10_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity10_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity10_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity10_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity10_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity10_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity10_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity10_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity20_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity20_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity20_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity20_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity20_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity20_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity20_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity20_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity30_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity30_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity30_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity30_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity30_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity30_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity30_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity30_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity40_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity40_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity40_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity40_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity40_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity40_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity40_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity40_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity50_0.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity50_0.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity50_0.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity50_0.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity50_1.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity50_1.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/arity50_1.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/arity50_1.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/master.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/master.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/synthesize_impl/master.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/synthesize_impl/master.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/detail/to_sequence.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/to_sequence.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/detail/to_sequence.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/detail/to_sequence.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/function_arity.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/function_arity.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/function_arity.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/function_arity.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/function_pointer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/function_pointer.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/function_pointer.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/function_pointer.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/function_reference.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/function_reference.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/function_reference.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/function_reference.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/function_type.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/function_type.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/function_type.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/function_type.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/is_callable_builtin.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/is_callable_builtin.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/is_callable_builtin.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/is_callable_builtin.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/is_function.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/is_function.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/is_function.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/is_function.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/is_function_pointer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/is_function_pointer.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/is_function_pointer.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/is_function_pointer.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/is_function_reference.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/is_function_reference.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/is_function_reference.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/is_function_reference.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/is_member_function_pointer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/is_member_function_pointer.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/is_member_function_pointer.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/is_member_function_pointer.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/is_member_object_pointer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/is_member_object_pointer.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/is_member_object_pointer.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/is_member_object_pointer.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/is_member_pointer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/is_member_pointer.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/is_member_pointer.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/is_member_pointer.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/is_nonmember_callable_builtin.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/is_nonmember_callable_builtin.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/is_nonmember_callable_builtin.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/is_nonmember_callable_builtin.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/member_function_pointer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/member_function_pointer.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/member_function_pointer.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/member_function_pointer.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/member_object_pointer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/member_object_pointer.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/member_object_pointer.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/member_object_pointer.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/parameter_types.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/parameter_types.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/parameter_types.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/parameter_types.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/property_tags.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/property_tags.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/property_tags.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/property_tags.hpp diff --git a/deal.II/contrib/boost/include/boost/function_types/result_type.hpp b/deal.II/contrib/boost-1.41.0/include/boost/function_types/result_type.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/function_types/result_type.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/function_types/result_type.hpp diff --git a/deal.II/contrib/boost/include/boost/functional.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/functional.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/functional.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/functional/detail/container_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional/detail/container_fwd.hpp new file mode 100644 index 0000000000..9a69d155b2 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/functional/detail/container_fwd.hpp @@ -0,0 +1,19 @@ + +// 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) + +// Forwarding header for container_fwd.hpp's new location. +// This header is deprecated, I'll be adding a warning in a future release, +// then converting it to an error and finally removing this header completely. + +#if !defined(BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP) +#define BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost/functional/hash.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash.hpp similarity index 55% rename from deal.II/contrib/boost/include/boost/functional/hash.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/functional/hash.hpp index 46b611b3f5..44983f19b2 100644 --- a/deal.II/contrib/boost/include/boost/functional/hash.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash.hpp @@ -1,11 +1,7 @@ -// Copyright 2005-2008 Daniel James. +// Copyright 2005-2009 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-1.41.0/include/boost/functional/hash/detail/float_functions.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/float_functions.hpp new file mode 100644 index 0000000000..01cac09722 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/float_functions.hpp @@ -0,0 +1,246 @@ + +// Copyright 2005-2009 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_HASH_DETAIL_FLOAT_FUNCTIONS_HPP) +#define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP + +#include +#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. +// +// The following tries to automatically detect which are available. + +namespace boost { + namespace hash_detail { + + // Returned by dummy versions of the float functions. + + struct not_found { + // Implicitly convertible to float and long double in order to avoid + // a compile error when the dummy float functions are used. + + inline operator float() const { return 0; } + inline operator long double() const { return 0; } + }; + + // A type for detecting the return type of functions. + + template struct is; + template <> struct is { char x[10]; }; + template <> struct is { char x[20]; }; + template <> struct is { char x[30]; }; + template <> struct is { char x[40]; }; + + // Used to convert the return type of a function to a type for sizeof. + + template is float_type(T); + + // call_ldexp + // + // This will get specialized for float and long double + + template struct call_ldexp + { + typedef double float_type; + + inline double operator()(double a, int b) const + { + using namespace std; + return ldexp(a, b); + } + }; + + // call_frexp + // + // This will get specialized for float and long double + + template struct call_frexp + { + typedef double float_type; + + inline double operator()(double a, int* b) const + { + using namespace std; + return frexp(a, b); + } + }; + } +} + +// A namespace for dummy functions to detect when the actual function we want +// isn't available. ldexpl, ldexpf etc. might be added tby the macros below. +// +// AFAICT these have to be outside of the boost namespace, as if they're in +// the boost namespace they'll always be preferable to any other function +// (since the arguments are built in types, ADL can't be used). + +namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS { + template boost::hash_detail::not_found ldexp(Float, int); + template boost::hash_detail::not_found frexp(Float, int*); +} + +// Macros for generating specializations of call_ldexp and call_frexp. +// +// check_cpp and check_c99 check if the C++ or C99 functions are available. +// +// Then the call_* functions select an appropriate implementation. +// +// I used c99_func in a few places just to get a unique name. +// +// Important: when using 'using namespace' at namespace level, include as +// little as possible in that namespace, as Visual C++ has an odd bug which +// can cause the namespace to be imported at the global level. This seems to +// happen mainly when there's a template in the same namesapce. + +#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2) \ +namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS { \ + template \ + boost::hash_detail::not_found c99_func(Float, type2); \ +} \ + \ +namespace boost { \ + namespace hash_detail { \ + namespace c99_func##_detect { \ + using namespace std; \ + using namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS; \ + \ + struct check { \ + static type1 x; \ + static type2 y; \ + BOOST_STATIC_CONSTANT(bool, cpp = \ + sizeof(float_type(cpp_func(x,y))) \ + == sizeof(is)); \ + BOOST_STATIC_CONSTANT(bool, c99 = \ + sizeof(float_type(c99_func(x,y))) \ + == sizeof(is)); \ + }; \ + } \ + \ + template \ + struct call_c99_##c99_func : \ + boost::hash_detail::call_##cpp_func {}; \ + \ + template <> \ + struct call_c99_##c99_func { \ + typedef type1 float_type; \ + \ + template \ + inline type1 operator()(type1 a, T b) const \ + { \ + using namespace std; \ + return c99_func(a, b); \ + } \ + }; \ + \ + template \ + struct call_cpp_##c99_func : \ + call_c99_##c99_func< \ + ::boost::hash_detail::c99_func##_detect::check::c99 \ + > {}; \ + \ + template <> \ + struct call_cpp_##c99_func { \ + typedef type1 float_type; \ + \ + template \ + inline type1 operator()(type1 a, T b) const \ + { \ + using namespace std; \ + return cpp_func(a, b); \ + } \ + }; \ + \ + template <> \ + struct call_##cpp_func : \ + call_cpp_##c99_func< \ + ::boost::hash_detail::c99_func##_detect::check::cpp \ + > {}; \ + } \ +} + +#define BOOST_HASH_CALL_FLOAT_MACRO(cpp_func, c99_func, type1, type2) \ +namespace boost { \ + namespace hash_detail { \ + \ + template <> \ + struct call_##cpp_func { \ + typedef type1 float_type; \ + inline type1 operator()(type1 x, type2 y) const { \ + return c99_func(x, y); \ + } \ + }; \ + } \ +} + +#if defined(ldexpf) +BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpf, float, int) +#else +BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpf, float, int) +#endif + +#if defined(ldexpl) +BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpl, long double, int) +#else +BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpl, long double, int) +#endif + +#if defined(frexpf) +BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpf, float, int*) +#else +BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpf, float, int*) +#endif + +#if defined(frexpl) +BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpl, long double, int*) +#else +BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpl, long double, int*) +#endif + +#undef BOOST_HASH_CALL_FLOAT_MACRO +#undef BOOST_HASH_CALL_FLOAT_FUNC + + +namespace boost +{ + namespace hash_detail + { + template + struct select_hash_type_impl { + typedef double type; + }; + + template <> + struct select_hash_type_impl { + typedef float type; + }; + + template <> + struct select_hash_type_impl { + typedef long double type; + }; + + + // select_hash_type + // + // If there is support for a particular floating point type, use that + // otherwise use double (there's always support for double). + + template + struct select_hash_type : select_hash_type_impl< + BOOST_DEDUCED_TYPENAME call_ldexp::float_type, + BOOST_DEDUCED_TYPENAME call_frexp::float_type + > {}; + } +} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/hash_float.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/hash_float.hpp new file mode 100644 index 0000000000..ea1bc25f48 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/hash_float.hpp @@ -0,0 +1,101 @@ + +// Copyright 2005-2009 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_HASH_DETAIL_HASH_FLOAT_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include + +// Include hash implementation for the current platform. + +// Cygwn +#if defined(__CYGWIN__) +# if defined(__i386__) || defined(_M_IX86) +# include +# else +# include +# endif +#else +# include +#endif + +// Can we use fpclassify? + +// STLport +#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +#define BOOST_HASH_USE_FPCLASSIFY 0 + +// 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 1 +# else +# define BOOST_HASH_USE_FPCLASSIFY 0 +# endif + +// Everything else +#else +# define BOOST_HASH_USE_FPCLASSIFY 0 +#endif + +#if BOOST_HASH_USE_FPCLASSIFY + +#include + +namespace boost +{ + namespace hash_detail + { + template + inline std::size_t float_hash_value(T v) + { + 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 // !BOOST_HASH_USE_FPCLASSIFY + +namespace boost +{ + namespace hash_detail + { + template + inline std::size_t float_hash_value(T v) + { + return v == 0 ? 0 : float_hash_impl(v); + } + } +} + +#endif // BOOST_HASH_USE_FPCLASSIFY + +#undef BOOST_HASH_USE_FPCLASSIFY + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/hash_float_generic.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/hash_float_generic.hpp new file mode 100644 index 0000000000..f9acee9cd1 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/hash_float_generic.hpp @@ -0,0 +1,93 @@ + +// Copyright 2005-2009 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) + +// A general purpose hash function for non-zero floating point values. + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER + +#include +#include +#include + +#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 + +namespace boost +{ + namespace hash_detail + { + inline void hash_float_combine(std::size_t& seed, std::size_t value) + { + seed ^= value + (seed<<6) + (seed>>2); + } + + template + inline std::size_t float_hash_impl2(T v) + { + boost::hash_detail::call_frexp frexp; + boost::hash_detail::call_ldexp ldexp; + + int exp = 0; + + v = frexp(v, &exp); + + // A postive value is easier to hash, so combine the + // sign with the exponent and use the absolute value. + 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 = 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 = 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; + } + + template + inline std::size_t float_hash_impl(T v) + { + typedef BOOST_DEDUCED_TYPENAME select_hash_type::type type; + return float_hash_impl2(static_cast(v)); + } + } +} + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/hash_float_x86.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/hash_float_x86.hpp new file mode 100644 index 0000000000..b39bb0d081 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/hash_float_x86.hpp @@ -0,0 +1,56 @@ + +// Copyright 2005-2009 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) + +// A non-portable hash function form non-zero floats on x86. +// +// Even if you're on an x86 platform, this might not work if their floating +// point isn't set up as this expects. So this should only be used if it's +// absolutely certain that it will work. + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER + +#include + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +namespace boost +{ + namespace hash_detail + { + inline void hash_float_combine(std::size_t& seed, std::size_t value) + { + seed ^= value + (seed<<6) + (seed>>2); + } + + 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; + } + } +} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/limits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/limits.hpp new file mode 100644 index 0000000000..f5b520ea9d --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/detail/limits.hpp @@ -0,0 +1,61 @@ + +// Copyright 2005-2009 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) +// +// On some platforms std::limits gives incorrect values for long double. +// This tries to work around them. + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +// On OpenBSD, numeric_limits is not reliable for long doubles, but +// the macros defined in are and support long double when STLport +// doesn't. + +#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE) +#include +#endif + +namespace boost +{ + namespace hash_detail + { + template + struct limits : std::numeric_limits {}; + +#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE) + 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); +#if defined(_STLP_NO_LONG_DOUBLE) + BOOST_STATIC_CONSTANT(int, radix = FLT_RADIX); +#endif + }; +#endif // __OpenBSD__ + } +} + +#endif diff --git a/deal.II/contrib/boost/include/boost/functional/hash/extensions.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/extensions.hpp similarity index 59% rename from deal.II/contrib/boost/include/boost/functional/hash/extensions.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/functional/hash/extensions.hpp index b9d868e7a0..3c587a3bf5 100644 --- a/deal.II/contrib/boost/include/boost/functional/hash/extensions.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/extensions.hpp @@ -1,5 +1,5 @@ -// Copyright 2005-2008 Daniel James. +// Copyright 2005-2009 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) @@ -7,15 +7,114 @@ // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf // issue 6.18. +// This implements the extensions to the standard. +// It's undocumented, so you shouldn't use it.... + #if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) #define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP +#include +#include + #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) +#include +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +#include +#endif + namespace boost { + 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&); + + 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; + } + + // + // call_hash_impl + // + + // On compilers without function template ordering, this deals with arrays. #if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) namespace hash_detail @@ -61,6 +160,11 @@ namespace boost } #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + // + // boost::hash + // + + #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template struct hash @@ -94,7 +198,7 @@ namespace boost // On compilers without partial specialization, boost::hash // has already been declared to deal with pointers, so just - // need to supply the non-pointer version. + // need to supply the non-pointer version of hash_impl. namespace hash_detail { @@ -126,8 +230,8 @@ namespace boost #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. + // Visual C++ 6.5 has problems with nested member functions and + // applying const to const types in templates. So we get this: template struct hash_impl_msvc diff --git a/deal.II/contrib/boost/include/boost/functional/hash/hash.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/hash.hpp similarity index 78% rename from deal.II/contrib/boost/include/boost/functional/hash/hash.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/functional/hash/hash.hpp index 09ca5671e2..6784f3ef6b 100644 --- a/deal.II/contrib/boost/include/boost/functional/hash/hash.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/hash.hpp @@ -1,5 +1,5 @@ -// Copyright 2005-2008 Daniel James. +// Copyright 2005-2009 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) @@ -10,22 +10,20 @@ #if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP) #define BOOST_FUNCTIONAL_HASH_HASH_HPP -#include +#include #include -#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 +#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 namespace boost @@ -58,10 +56,10 @@ namespace boost #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) template< class T, unsigned N > - std::size_t hash_value(const T (&array)[N]); + std::size_t hash_value(const T (&x)[N]); template< class T, unsigned N > - std::size_t hash_value(T (&array)[N]); + std::size_t hash_value(T (&x)[N]); #endif std::size_t hash_value(float v); @@ -71,26 +69,6 @@ namespace boost 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 @@ -281,15 +259,15 @@ namespace boost #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) template< class T, unsigned N > - inline std::size_t hash_value(const T (&array)[N]) + inline std::size_t hash_value(const T (&x)[N]) { - return hash_range(array, array + N); + return hash_range(x, x + N); } template< class T, unsigned N > - inline std::size_t hash_value(T (&array)[N]) + inline std::size_t hash_value(T (&x)[N]) { - return hash_range(array, array + N); + return hash_range(x, x + N); } #endif @@ -314,69 +292,21 @@ namespace boost 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 // + + // Define the specializations required by the standard. The general purpose + // boost::hash is defined later in extensions.hpp if BOOST_HASH_NO_EXTENSIONS + // is not defined. + + // BOOST_HASH_SPECIALIZE - define a specialization for a type which is + // passed by copy. + // + // BOOST_HASH_SPECIALIZE_REF - define a specialization for a type which is + // passed by copy. + // + // These are undefined later. #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) #define BOOST_HASH_SPECIALIZE(type) \ @@ -461,10 +391,18 @@ namespace boost BOOST_HASH_SPECIALIZE_REF(std::wstring) #endif +#if defined(BOOST_HAS_LONG_LONG) + BOOST_HASH_SPECIALIZE(boost::long_long_type) + BOOST_HASH_SPECIALIZE(boost::ulong_long_type) +#endif + #undef BOOST_HASH_SPECIALIZE #undef BOOST_HASH_SPECIALIZE_REF +// Specializing boost::hash for pointers. + #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + template struct hash : public std::unary_function @@ -481,7 +419,15 @@ namespace boost #endif } }; + #else + + // For compilers without partial specialization, we define a + // boost::hash for all remaining types. But hash_impl is only defined + // for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS + // is defined there will still be a compile error for types not supported + // in the standard. + namespace hash_detail { template @@ -514,9 +460,12 @@ namespace boost ::BOOST_NESTED_TEMPLATE inner { }; + #endif } +#undef BOOST_HASH_CHAR_TRAITS + #endif // BOOST_FUNCTIONAL_HASH_HASH_HPP // Include this outside of the include guards in case the file is included diff --git a/deal.II/contrib/boost/include/boost/functional/hash_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/hash_fwd.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/functional/hash_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/functional/hash/hash_fwd.hpp index 8b7d8e5a41..1d51b07f2d 100644 --- a/deal.II/contrib/boost/include/boost/functional/hash_fwd.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash/hash_fwd.hpp @@ -1,5 +1,5 @@ -// Copyright 2005-2008 Daniel James. +// Copyright 2005-2009 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) diff --git a/deal.II/contrib/boost-1.41.0/include/boost/functional/hash_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash_fwd.hpp new file mode 100644 index 0000000000..b640988618 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/functional/hash_fwd.hpp @@ -0,0 +1,7 @@ + +// Copyright 2005-2009 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) + +#include + diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/array.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/array.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/array/array_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/array_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/array/array_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/array_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/category_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/category_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/category_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/category_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/is_sequence_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/is_sequence_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/is_sequence_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/is_sequence_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/is_view_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/is_view_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/is_view_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/is_view_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/size_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/size_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/size_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/size_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/value_at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/array/detail/value_at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/detail/value_at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/array/tag_of.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/tag_of.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/array/tag_of.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/array/tag_of.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp similarity index 81% rename from deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp index fca135e55a..cf3183b105 100644 --- a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp @@ -14,6 +14,9 @@ #include #include #include +#include +#include +#include #include namespace boost { namespace fusion @@ -91,6 +94,39 @@ namespace boost { namespace fusion return type(iter.cons.get_tail()); } }; + + template + struct distance; + + // detail + template + struct lazy_next_distance + { + typedef + typename mpl::plus< + mpl::int_<1>, + typename distance< + typename next::type, + I2 + >::type + >::type type; + }; + + template + struct distance + { + typedef typename mpl::eval_if< + boost::is_same, + mpl::int_<0>, + lazy_next_distance + >::type type; + + static type + call(I1 const&, I2 const&) + { + return type(); + } + }; }; template diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/category_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/category_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/category_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/category_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/is_sequence_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/is_sequence_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/is_sequence_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/is_sequence_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/is_view_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/is_view_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/is_view_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/is_view_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/size_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/size_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/size_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/size_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/value_at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/detail/value_at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/detail/value_at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/tag_of.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/tag_of.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/boost_tuple/tag_of.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/boost_tuple/tag_of.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class.hpp new file mode 100644 index 0000000000..be973831ee --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_CLASS_OCTOBER_4_2009_839PM) +#define BOOST_FUSION_CLASS_OCTOBER_4_2009_839PM + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/adapt_assoc_class.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/adapt_assoc_class.hpp new file mode 100644 index 0000000000..11f40ade5d --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/adapt_assoc_class.hpp @@ -0,0 +1,94 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2007 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_ADAPT_ASSOC_CLASS_OCTOBER_4_2009_840PM) +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_OCTOBER_4_2009_840PM + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace extension { + template + struct class_assoc_member; +}}} + + +#define BOOST_FUSION_ADAPT_ASSOC_CLASS(name, bseq) \ + BOOST_FUSION_ADAPT_ASSOC_CLASS_I( \ + name, BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_X bseq, 0)) \ + /***/ + +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_X(x, y, z) ((x, y, z)) BOOST_FUSION_ADAPT_ASSOC_CLASS_Y +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_Y(x, y, z) ((x, y, z)) BOOST_FUSION_ADAPT_ASSOC_CLASS_X +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_X0 +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_Y0 + +// BOOST_FUSION_ADAPT_ASSOC_CLASS_I generates the overarching structure and uses +// SEQ_FOR_EACH_I to generate the "linear" substructures. +// Thanks to Paul Mensonides for the PP macro help + +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_I(name, seq) \ + namespace boost { namespace fusion { namespace traits \ + { \ + template <> \ + struct tag_of \ + { \ + typedef class_tag type; \ + }; \ + }}} \ + namespace boost { namespace fusion { namespace extension \ + { \ + template <> \ + struct class_size : mpl::int_ {}; \ + BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_ADAPT_ASSOC_CLASS_C, name, seq) \ + }}} \ + /***/ + +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_C(r, name, i, xy) \ + template <> \ + struct class_member \ + { \ + typedef BOOST_PP_TUPLE_ELEM(3, 0, xy) type; \ + static type& call(name& class_) \ + { \ + return class_.BOOST_PP_TUPLE_ELEM(3, 1, xy); \ + }; \ + }; \ + template<> \ + struct class_assoc_member \ + { \ + typedef BOOST_PP_TUPLE_ELEM(3, 0, xy) type; \ + static type& call(name& class_) \ + { \ + return class_.BOOST_PP_TUPLE_ELEM(3, 1, xy); \ + }; \ + }; + /***/ + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/adapt_class.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/adapt_class.hpp new file mode 100644 index 0000000000..c4e5c29fd2 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/adapt_class.hpp @@ -0,0 +1,104 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_ADAPT_CLASS_OCTOBER_4_2009_840PM) +#define BOOST_FUSION_ADAPT_CLASS_OCTOBER_4_2009_840PM + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BOOST_FUSION_ADAPT_CLASS(name, bseq) \ + BOOST_FUSION_ADAPT_CLASS_I( \ + name, BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_X bseq, 0)) \ + /***/ + +#define BOOST_FUSION_ADAPT_CLASS_X(w, x, y, z) ((w, x, y, z)) BOOST_FUSION_ADAPT_CLASS_Y +#define BOOST_FUSION_ADAPT_CLASS_Y(w, x, y, z) ((w, x, y, z)) BOOST_FUSION_ADAPT_CLASS_X +#define BOOST_FUSION_ADAPT_CLASS_X0 +#define BOOST_FUSION_ADAPT_CLASS_Y0 + +// BOOST_FUSION_ADAPT_CLASS_I generates the overarching structure and uses +// SEQ_FOR_EACH_I to generate the "linear" substructures. +// Thanks to Paul Mensonides for the PP macro help + +#define BOOST_FUSION_ADAPT_CLASS_I(name, seq) \ + namespace boost { namespace fusion { namespace traits \ + { \ + template <> \ + struct tag_of \ + { \ + typedef class_tag type; \ + }; \ + }}} \ + namespace boost { namespace fusion { namespace extension \ + { \ + template <> \ + struct class_size : mpl::int_ {}; \ + BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_ADAPT_CLASS_C, name, seq) \ + }}} \ + /***/ + +#define BOOST_FUSION_ADAPT_CLASS_C(r, name, i, xy) \ + template <> \ + struct class_member \ + { \ + typedef BOOST_PP_TUPLE_ELEM(4, 0, xy) type; \ + typedef BOOST_PP_TUPLE_ELEM(4, 1, xy) get_type; \ + struct proxy \ + { \ + typedef BOOST_PP_TUPLE_ELEM(4, 0, xy) type; \ + typedef BOOST_PP_TUPLE_ELEM(4, 1, xy) get_type; \ + typedef \ + add_reference::type>::type \ + cref_type; \ + \ + proxy(name& obj) : obj(obj) {} \ + name& obj; \ + \ + proxy& operator=(cref_type val) \ + { \ + BOOST_PP_TUPLE_ELEM(4, 3, xy); \ + return *this; \ + } \ + \ + operator get_type() \ + { \ + return BOOST_PP_TUPLE_ELEM(4, 2, xy); \ + } \ + }; \ + \ + static get_type call(name const& obj) \ + { \ + return BOOST_PP_TUPLE_ELEM(4, 2, xy); \ + }; \ + \ + static proxy call(name& obj) \ + { \ + return proxy(obj); \ + }; \ + }; \ + /***/ + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/class_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/class_iterator.hpp new file mode 100644 index 0000000000..639ee92723 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/class_iterator.hpp @@ -0,0 +1,105 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(FUSION_CLASS_ITERATOR_OCTOBER_4_2009_839M) +#define FUSION_CLASS_ITERATOR_OCTOBER_4_2009_839M + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct random_access_traversal_tag; + + template + struct class_iterator + : iterator_facade, random_access_traversal_tag> + { + BOOST_MPL_ASSERT_RELATION(N_, >=, 0); + BOOST_MPL_ASSERT_RELATION(N_, <=, extension::class_size::value); + + typedef mpl::int_ index; + typedef Class class_type; + + class_iterator(Class& class_) + : class_(class_) {} + Class& class_; + + template + struct value_of + : extension::class_member + { + }; + + template + struct deref + { + typedef typename + mpl::if_< + is_const + , typename extension::class_member::get_type + , typename extension::class_member::proxy + >::type + type; + + static type + call(Iterator const& iter) + { + return extension::class_member:: + call(iter.class_); + } + }; + + template + struct advance + { + typedef typename Iterator::index index; + typedef typename Iterator::class_type class_type; + typedef class_iterator type; + + static type + call(Iterator const& iter) + { + return type(iter.class_); + } + }; + + template + struct next : advance > {}; + + template + struct prior : advance > {}; + + template + struct distance : mpl::minus + { + typedef typename + mpl::minus< + typename I2::index, typename I1::index + >::type + type; + + static type + call(I1 const&, I2 const&) + { + return type(); + } + }; + }; +}} + +#endif + + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/at_impl.hpp new file mode 100644 index 0000000000..12b5171fc6 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/at_impl.hpp @@ -0,0 +1,70 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_AT_IMPL_OCTOBER_4_2009_920PM) +#define BOOST_FUSION_AT_IMPL_OCTOBER_4_2009_920PM + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct class_tag; + + namespace extension + { + template + struct at_impl; + + template + struct class_member; + + template + struct class_size; + + template <> + struct at_impl + { + template + struct apply + { + static int const n_value = N::value; + BOOST_MPL_ASSERT_RELATION( + n_value, <=, extension::class_size::value); + + typedef typename + extension::class_member + element; + + typedef typename + mpl::if_< + is_const + , typename class_member::get_type + , typename class_member::proxy + >::type + type; + + static type + call(Sequence& seq) + { + return extension:: + class_member::call(seq); + } + + //~ static typename class_member::get_type + //~ call(Sequence const& seq) + //~ { + //~ return extension:: + //~ class_member::call(seq); + //~ } + }; + }; + } +}} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/at_key_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/at_key_impl.hpp new file mode 100644 index 0000000000..9df985bf85 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/at_key_impl.hpp @@ -0,0 +1,54 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2007 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_AT_KEY_IMPL_OCTOBER_4_2009_920PM) +#define BOOST_FUSION_AT_KEY_IMPL_OCTOBER_4_2009_920PM + +#include + +namespace boost { namespace fusion +{ + struct class_tag; + + namespace extension + { + template + struct at_key_impl; + + template + struct class_assoc_member; + + template <> + struct at_key_impl + { + template + struct apply + { + typedef typename + extension::class_assoc_member + element; + + typedef typename + mpl::eval_if< + is_const + , detail::cref_result + , detail::ref_result + >::type + type; + + static type + call(Sequence& seq) + { + return extension:: + class_assoc_member::call(seq); + } + }; + }; + } +}} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/begin_impl.hpp new file mode 100644 index 0000000000..4fadac4e1b --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/begin_impl.hpp @@ -0,0 +1,40 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_BEGIN_IMPL_OCTOBER_4_2009_920PM) +#define BOOST_FUSION_BEGIN_IMPL_OCTOBER_4_2009_920PM + +#include + +namespace boost { namespace fusion +{ + struct class_tag; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef class_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/category_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/category_of_impl.hpp new file mode 100644 index 0000000000..821cf38bcd --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/class/detail/category_of_impl.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_OCTOBER_4_2009_919PM) +#define BOOST_FUSION_CATEGORY_OF_IMPL_OCTOBER_4_2009_919PM + +#include + +namespace boost { namespace fusion +{ + struct class_tag; + struct random_access_traversal_tag; + + namespace extension + { + template + struct category_of_impl; + + template<> + struct category_of_impl + { + template + struct apply + { + typedef random_access_traversal_tag type; + }; + }; + } +}} + +#endif diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/category_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/category_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/category_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/category_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/empty_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/empty_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/empty_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/empty_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/has_key_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/has_key_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/has_key_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/has_key_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/is_sequence_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/is_sequence_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/is_sequence_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/is_sequence_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/is_view_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/is_view_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/is_view_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/is_view_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/size_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/size_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/size_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/size_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/value_at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl/detail/value_at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/detail/value_at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/mpl/mpl_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/mpl_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/mpl/mpl_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/mpl/mpl_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/std_pair.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/std_pair.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/category_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/category_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/category_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/category_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/is_sequence_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/is_sequence_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/is_sequence_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/is_sequence_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/is_view_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/is_view_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/is_view_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/is_view_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/size_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/size_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/size_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/size_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/value_at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/detail/value_at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/detail/value_at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/std_pair_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/std_pair_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/std_pair_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/std_pair_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/tag_of.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/tag_of.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/std_pair/tag_of.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/std_pair/tag_of.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/adapt_assoc_struct.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/adapt_assoc_struct.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/adapt_assoc_struct.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/adapt_assoc_struct.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/adapt_struct.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/adapt_struct.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/adapt_struct.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/adapt_struct.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/at_key_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/at_key_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/at_key_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/at_key_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/category_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/category_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/category_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/category_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/has_key_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/has_key_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/has_key_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/has_key_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/is_sequence_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/is_sequence_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/is_sequence_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/is_sequence_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/is_view_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/is_view_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/is_view_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/is_view_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/size_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/size_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/size_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/size_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/value_at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/value_at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/value_at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/value_at_key_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/value_at_key_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/detail/value_at_key_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/detail/value_at_key_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/extension.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/extension.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/extension.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/extension.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/struct_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/struct_iterator.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/fusion/adapted/struct/struct_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/struct_iterator.hpp index f2eb7ea907..fe26aa33ce 100644 --- a/deal.II/contrib/boost/include/boost/fusion/adapted/struct/struct_iterator.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/adapted/struct/struct_iterator.hpp @@ -95,6 +95,10 @@ namespace boost { namespace fusion return type(); } }; + + private: + // silence MSVC warning C4512: assignment operator could not be generated + struct_iterator& operator= (struct_iterator const&); }; }} diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/iteration.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/iteration.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/accumulate.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/accumulate.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/accumulate.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/accumulate.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/detail/fold.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/detail/fold.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/detail/fold.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/detail/fold.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/detail/for_each.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/detail/for_each.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/detail/for_each.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/detail/for_each.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/fold.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/fold.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/fold.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/fold.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/for_each.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/for_each.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/iteration/for_each.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/iteration/for_each.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/all.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/all.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/all.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/all.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/any.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/any.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/any.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/any.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/count.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/count.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/count.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/count.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/count_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/count_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/count_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/count_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/all.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/all.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/all.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/all.hpp index 979cfb1182..51fd393fe7 100644 --- a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/all.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/all.hpp @@ -108,7 +108,7 @@ namespace boost { namespace fusion { namespace detail template static bool call(It const& it, F f) { - return false; + return true; } }; diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/any.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/any.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/any.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/any.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/assoc_find.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/assoc_find.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/assoc_find.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/assoc_find.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/count.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/count.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/count.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/count.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/count_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/count_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/count_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/count_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/find_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/find_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/detail/find_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/detail/find_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/ext_/find_if_s.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/ext_/find_if_s.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/ext_/find_if_s.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/ext_/find_if_s.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/find.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/find.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/find.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/find.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/find_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/find_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/find_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/find_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/query/none.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/none.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/query/none.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/query/none.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation.hpp index 0757b5ee65..9221cd45c6 100644 --- a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -24,5 +25,6 @@ #include #include #include +#include #endif diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/clear.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/clear.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/clear.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/clear.hpp index 7532823265..c9f849cb90 100644 --- a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/clear.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/clear.hpp @@ -16,7 +16,7 @@ namespace boost { namespace fusion template struct clear { - typedef vector0 type; + typedef vector0<> type; }; } @@ -24,7 +24,7 @@ namespace boost { namespace fusion inline typename result_of::clear::type clear(Sequence const& seq) { - return vector0(); + return vector0<>(); } }} diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/detail/replace.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/detail/replace.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/detail/replace.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/detail/replace.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/detail/replace_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/detail/replace_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/detail/replace_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/detail/replace_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/erase.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/erase.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/erase.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/erase.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/erase_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/erase_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/erase_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/erase_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/filter.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/filter.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/filter.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/filter.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/filter_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/filter_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/filter_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/filter_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/insert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/insert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/insert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/insert.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/insert_range.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/insert_range.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/insert_range.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/insert_range.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/join.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/join.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/join.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/join.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/pop_back.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/pop_back.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/pop_back.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/pop_back.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/pop_front.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/pop_front.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/pop_front.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/pop_front.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/push_back.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/push_back.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/push_back.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/push_back.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/push_front.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/push_front.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/push_front.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/push_front.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/remove.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/remove.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/remove.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/remove.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/remove_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/remove_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/remove_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/remove_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/replace.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/replace.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/replace.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/replace.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/replace_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/replace_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/replace_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/replace_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/reverse.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/reverse.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/reverse.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/reverse.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/transform.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/transform.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/transform.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/transform.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/zip.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/zip.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/algorithm/transformation/zip.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/algorithm/transformation/zip.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/back_extended_deque.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/back_extended_deque.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/back_extended_deque.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/back_extended_deque.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/convert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/convert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/convert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/convert.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/deque.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/deque.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/deque.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/deque.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/deque_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/deque_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/deque_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/deque_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/deque_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/deque_iterator.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/deque_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/deque_iterator.hpp index 90c68918a6..c6e46d54a5 100644 --- a/deal.II/contrib/boost/include/boost/fusion/container/deque/deque_iterator.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/deque_iterator.hpp @@ -12,6 +12,7 @@ #include #include #include +#include namespace boost { namespace fusion { diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/detail/as_deque.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/as_deque.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/detail/as_deque.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/as_deque.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/detail/at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/detail/convert_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/convert_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/detail/convert_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/convert_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/deque_forward_ctor.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/detail/deque_initial_size.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/deque_initial_size.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/detail/deque_initial_size.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/deque_initial_size.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/detail/deque_keyed_values.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/deque_keyed_values.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/detail/deque_keyed_values.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/deque_keyed_values.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/deque_keyed_values_call.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/detail/keyed_element.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/keyed_element.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/detail/keyed_element.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/keyed_element.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/value_at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/detail/value_at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/detail/value_at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/front_extended_deque.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/front_extended_deque.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/front_extended_deque.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/front_extended_deque.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/deque/limits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/limits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/deque/limits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/deque/limits.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/ext_/tree.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/ext_/tree.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/ext_/tree.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/ext_/tree.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/cons_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/cons_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/cons_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/cons_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/deque_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/deque_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/deque_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/deque_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/ignore.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/ignore.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/ignore.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/ignore.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/list_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/list_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/list_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/list_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/make_cons.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_cons.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/make_cons.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_cons.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/make_deque.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_deque.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/make_deque.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_deque.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/make_list.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_list.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/make_list.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_list.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/make_map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_map.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/make_map.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_map.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/make_set.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_set.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/make_set.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_set.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/make_vector.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_vector.hpp similarity index 86% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/make_vector.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_vector.hpp index 3f9b27f21a..868ad0ca7a 100644 --- a/deal.II/contrib/boost/include/boost/fusion/container/generation/make_vector.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/make_vector.hpp @@ -1,7 +1,7 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + Distributed under the 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_PP_IS_ITERATING @@ -19,7 +19,7 @@ namespace boost { namespace fusion { struct void_; - + namespace result_of { template < @@ -28,18 +28,18 @@ namespace boost { namespace fusion , typename Extra = void_ > struct make_vector; - + template <> struct make_vector<> { - typedef vector<> type; + typedef vector0<> type; }; } - - inline vector<> + + inline vector0<> make_vector() { - return vector<>(); + return vector0<>(); } #define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \ @@ -74,15 +74,15 @@ namespace boost { namespace fusion struct make_vector #endif { - typedef vector type; + typedef BOOST_PP_CAT(vector, N) type; }; } template - inline vector + inline BOOST_PP_CAT(vector, N) make_vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _)) { - return vector( + return BOOST_PP_CAT(vector, N)( BOOST_PP_ENUM_PARAMS(N, _)); } diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/map_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/map_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/map_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/map_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/pair_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/pair_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/pair_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/pair_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/generation/vector_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/vector_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/generation/vector_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/generation/vector_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/cons.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/cons.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/cons.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/cons.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/cons_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/cons_iterator.hpp similarity index 94% rename from deal.II/contrib/boost/include/boost/fusion/container/list/cons_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/cons_iterator.hpp index 7ef034e30f..9d67a64919 100644 --- a/deal.II/contrib/boost/include/boost/fusion/container/list/cons_iterator.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/cons_iterator.hpp @@ -34,11 +34,15 @@ namespace boost { namespace fusion typedef cons_iterator_identity< typename add_const::type> identity; - + explicit cons_iterator(cons_type& cons) : cons(cons) {} cons_type& cons; + + private: + // silence MSVC warning C4512: assignment operator could not be generated + cons_iterator& operator= (cons_iterator const&); }; struct nil_iterator : iterator_base diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/convert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/convert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/convert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/convert.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/build_cons.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/build_cons.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/build_cons.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/build_cons.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/convert_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/convert_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/convert_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/convert_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/deref_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/deref_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/deref_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/deref_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/empty_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/empty_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/empty_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/empty_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/equal_to_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/equal_to_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/equal_to_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/equal_to_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/list_forward_ctor.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/list_forward_ctor.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/list_forward_ctor.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/list_forward_ctor.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/list_to_cons.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/list_to_cons.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/list_to_cons.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/list_to_cons.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/list_to_cons_call.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/list_to_cons_call.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/list_to_cons_call.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/list_to_cons_call.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/next_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/next_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/next_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/next_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/value_at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/value_at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/value_at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/detail/value_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/value_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/detail/value_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/detail/value_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/limits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/limits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/limits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/limits.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/list.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/list.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/list.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/list.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/list/list_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/list_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/list/list_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/list/list_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/convert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/convert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/convert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/convert.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/detail/as_map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/as_map.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/detail/as_map.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/as_map.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/detail/at_key_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/at_key_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/detail/at_key_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/at_key_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/detail/convert_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/convert_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/detail/convert_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/convert_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/detail/lookup_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/lookup_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/detail/lookup_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/lookup_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/detail/map_forward_ctor.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/map_forward_ctor.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/detail/map_forward_ctor.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/map_forward_ctor.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/detail/map_lookup.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/map_lookup.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/detail/map_lookup.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/map_lookup.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/detail/value_at_key_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/value_at_key_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/detail/value_at_key_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/detail/value_at_key_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/limits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/limits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/limits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/limits.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/map.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/map.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/map.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/map/map_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/map_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/map/map_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/map/map_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/convert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/convert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/convert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/convert.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/detail/as_set.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/as_set.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/detail/as_set.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/as_set.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/detail/at_key_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/at_key_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/detail/at_key_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/at_key_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/detail/convert_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/convert_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/detail/convert_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/convert_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/detail/lookup_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/lookup_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/detail/lookup_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/lookup_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/detail/set_forward_ctor.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/set_forward_ctor.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/detail/set_forward_ctor.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/set_forward_ctor.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/detail/set_lookup.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/set_lookup.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/detail/set_lookup.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/set_lookup.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/detail/value_at_key_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/value_at_key_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/detail/value_at_key_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/detail/value_at_key_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/limits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/limits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/limits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/limits.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/set.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/set.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/set.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/set.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/set/set_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/set_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/set/set_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/set/set_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/convert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/convert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/convert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/convert.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/advance_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/advance_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/advance_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/advance_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/as_vector.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/as_vector.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/as_vector.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/as_vector.hpp index fa8dadcfef..a70fd4aea5 100644 --- a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/as_vector.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/as_vector.hpp @@ -31,14 +31,14 @@ namespace boost { namespace fusion { namespace detail template struct apply { - typedef vector<> type; + typedef vector0<> type; }; template static typename apply::type call(Iterator) { - return vector<>(); + return vector0<>(); } }; @@ -82,7 +82,7 @@ namespace boost { namespace fusion { namespace detail { BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _) BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _) - typedef vector type; + typedef BOOST_PP_CAT(vector, N) type; }; template diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/at_impl.hpp similarity index 69% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/at_impl.hpp index 1a00f428cd..1366ec9f40 100644 --- a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/at_impl.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/at_impl.hpp @@ -28,13 +28,7 @@ namespace boost { namespace fusion struct apply { typedef mpl::at element; - typedef typename - mpl::eval_if< - is_const - , detail::cref_result - , detail::ref_result - >::type - type; + typedef typename detail::ref_result::type type; static type call(Sequence& v) @@ -42,6 +36,19 @@ namespace boost { namespace fusion return v.at_impl(N()); } }; + + template + struct apply + { + typedef mpl::at element; + typedef typename detail::cref_result::type type; + + static type + call(Sequence const& v) + { + return v.at_impl(N()); + } + }; }; } }} diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/convert_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/convert_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/convert_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/convert_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/deref_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/deref_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/deref_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/deref_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/distance_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/distance_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/distance_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/distance_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/equal_to_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/equal_to_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/equal_to_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/equal_to_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/next_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/next_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/next_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/next_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/prior_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/prior_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/prior_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/prior_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/value_at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/value_at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/value_at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/value_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/value_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/value_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/value_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/vector_forward_ctor.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/vector_n.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/vector_n.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/vector_n.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/vector_n.hpp index 01981ab369..ea314ac28e 100644 --- a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/vector_n.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/vector_n.hpp @@ -9,7 +9,7 @@ #if !defined(FUSION_MACRO_05042005) #define FUSION_MACRO_05042005 -#define FUSION_MEMBER_DEFAULT_INIT(z, n, _) m##n(T##n()) +#define FUSION_MEMBER_DEFAULT_INIT(z, n, _) m##n() #define FUSION_MEMBER_INIT(z, n, _) m##n(_##n) #define FUSION_COPY_INIT(z, n, _) m##n(other.m##n) #define FUSION_MEMBER_DECL(z, n, _) T##n m##n; @@ -105,7 +105,7 @@ BOOST_PP_CAT(vector, N)( Sequence const& seq #if (N == 1) - , typename disable_if >::type* dummy = 0 + , typename disable_if >::type* /*dummy*/ = 0 #endif ) : base_type(base_type::init_from_sequence(seq)) {} @@ -133,14 +133,14 @@ template typename add_reference::type>::type - at_impl(I i) + at_impl(I) { return this->at_impl(mpl::int_()); } template typename add_reference::type>::type>::type - at_impl(I i) const + at_impl(I) const { return this->at_impl(mpl::int_()); } diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/vector_n_chooser.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/vector_n_chooser.hpp similarity index 62% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/detail/vector_n_chooser.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/vector_n_chooser.hpp index 29248907de..f4b85d89c4 100644 --- a/deal.II/contrib/boost/include/boost/fusion/container/vector/detail/vector_n_chooser.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/detail/vector_n_chooser.hpp @@ -25,11 +25,12 @@ #include #endif -#include -#include -#include #include +#include +#include +#include #include +#include namespace boost { namespace fusion { @@ -38,40 +39,23 @@ namespace boost { namespace fusion namespace boost { namespace fusion { namespace detail { - template - struct get_vector_n; + template + struct vector_n_chooser + { + typedef BOOST_PP_CAT(vector, FUSION_MAX_VECTOR_SIZE) type; + }; template <> - struct get_vector_n<0> + struct vector_n_chooser { - template - struct call - { - typedef vector0 type; - }; + typedef vector0<> type; }; #define BOOST_PP_FILENAME_1 \ -#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#define BOOST_PP_ITERATION_LIMITS (1, BOOST_PP_DEC(FUSION_MAX_VECTOR_SIZE)) #include BOOST_PP_ITERATE() - template - struct vector_n_chooser - { - typedef - mpl::BOOST_PP_CAT(vector, FUSION_MAX_VECTOR_SIZE) - - input; - - typedef typename mpl::begin::type begin; - typedef typename mpl::find::type end; - typedef typename mpl::distance::type size; - - typedef typename get_vector_n::template - call::type - type; - }; }}} #endif @@ -85,14 +69,12 @@ namespace boost { namespace fusion { namespace detail #define N BOOST_PP_ITERATION() - template <> - struct get_vector_n + template + struct vector_n_chooser< + BOOST_PP_ENUM_PARAMS(N, T) + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(FUSION_MAX_VECTOR_SIZE, N), void_ BOOST_PP_INTERCEPT)> { - template - struct call - { - typedef BOOST_PP_CAT(vector, N) type; - }; + typedef BOOST_PP_CAT(vector, N) type; }; #undef N diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/limits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/limits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/limits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/limits.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/vector.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/vector.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector.hpp index aef3134cac..5b9a560843 100644 --- a/deal.II/contrib/boost/include/boost/fusion/container/vector/vector.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector.hpp @@ -56,7 +56,7 @@ namespace boost { namespace fusion template vector(Sequence const& rhs) -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1400) +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1500) : vec(ctor_helper(rhs, is_base_of())) {} #else : vec(rhs) {} @@ -129,7 +129,7 @@ namespace boost { namespace fusion private: -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1400) +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1500) static vector_n const& ctor_helper(vector const& rhs, mpl::true_) { diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/vector10.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector10.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/vector10.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector10.hpp index 28531b6f1d..929815ab3c 100644 --- a/deal.II/contrib/boost/include/boost/fusion/container/vector/vector10.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector10.hpp @@ -39,7 +39,8 @@ namespace boost { namespace fusion struct fusion_sequence_tag; struct random_access_traversal_tag; - struct vector0 : sequence_base + template + struct vector0 : sequence_base > { typedef mpl::vector0<> types; typedef vector_tag fusion_tag; diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/vector20.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector20.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/vector20.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector20.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/vector30.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector30.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/vector30.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector30.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/vector40.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector40.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/vector40.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector40.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/vector50.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector50.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/vector50.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector50.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/vector_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/vector_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/container/vector/vector_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector_iterator.hpp similarity index 89% rename from deal.II/contrib/boost/include/boost/fusion/container/vector/vector_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector_iterator.hpp index 9feeb52097..d7ba8c8833 100644 --- a/deal.II/contrib/boost/include/boost/fusion/container/vector/vector_iterator.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/container/vector/vector_iterator.hpp @@ -7,6 +7,11 @@ #if !defined(FUSION_VECTOR_ITERATOR_05042005_0635) #define FUSION_VECTOR_ITERATOR_05042005_0635 +#if defined (BOOST_MSVC) +# pragma warning(push) +# pragma warning (disable: 4512) // assignment operator could not be generated. +#endif + #include #include #include @@ -42,5 +47,9 @@ namespace boost { namespace fusion }; }} +#if defined (BOOST_MSVC) +# pragma warning(pop) +#endif + #endif diff --git a/deal.II/contrib/boost/include/boost/fusion/functional.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter.hpp similarity index 79% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter.hpp index 734dac3972..1a1f9819f0 100644 --- a/deal.II/contrib/boost/include/boost/fusion/functional/adapter.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter.hpp @@ -11,8 +11,6 @@ #include #include #include -#include -#include -#include +#include #include #endif diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/detail/access.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/detail/access.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/detail/access.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/detail/access.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/detail/pow2_explode.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/detail/pow2_explode.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/detail/pow2_explode.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/detail/pow2_explode.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/detail/pt_def.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/detail/pt_def.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/detail/pt_def.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/detail/pt_def.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/detail/pt_undef.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/detail/pt_undef.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/detail/pt_undef.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/detail/pt_undef.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/fused.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/fused.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/fused.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/fused.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/fused_function_object.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/fused_function_object.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/fused_function_object.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/fused_function_object.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/fused_procedure.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/fused_procedure.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/fused_procedure.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/fused_procedure.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/limits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/limits.hpp similarity index 55% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/limits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/limits.hpp index cf6701c499..783bc63275 100644 --- a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/limits.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/limits.hpp @@ -11,29 +11,16 @@ # include -# if !defined(BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY) -# define BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY 6 +# if !defined(BOOST_FUSION_UNFUSED_MAX_ARITY) +# define BOOST_FUSION_UNFUSED_MAX_ARITY 6 # elif BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE # error "BOOST_FUSION_UNFUSED_GENERIC_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" # endif -# if !defined(BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY) -# define BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY 6 -# elif BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE -# error "BOOST_FUSION_UNFUSED_RVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" -# endif -# if !defined(BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY) -# define BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY 6 -# elif BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE -# error "BOOST_FUSION_UNFUSED_LVALUE_ARGS_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" -# endif # if !defined(BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY) # define BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY 6 # elif BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE # error "BOOST_FUSION_UNFUSED_TYPED_MAX_ARITY > FUSION_MAX_VECTOR_SIZE" # endif -# if !defined(BOOST_FUSION_CONSTRUCTOR_MAX_ARITY) -# define BOOST_FUSION_CONSTRUCTOR_MAX_ARITY 6 -# endif #endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/unfused.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/unfused.hpp new file mode 100755 index 0000000000..48baf75635 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/unfused.hpp @@ -0,0 +1,151 @@ +/*============================================================================= + Copyright (c) 2006-2007 Tobias Schwinger + + 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). +==============================================================================*/ + +#if !defined(BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_HPP_INCLUDED) +#if !defined(BOOST_PP_IS_ITERATING) + +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +namespace boost { namespace fusion +{ + template + class unfused; + + //----- ---- --- -- - - - - + + template + class unfused + : public unfused + { + typedef typename detail::qf_c::type function_c; + typedef typename detail::qf::type function; + typedef typename detail::call_param::type func_const_fwd_t; + public: + + using unfused::operator(); + + inline explicit unfused(func_const_fwd_t f = function()) + : unfused(f) + { } + + typedef typename boost::result_of< + function_c(fusion::vector0<> &) >::type call_const_0_result; + + inline call_const_0_result operator()() const + { + fusion::vector0<> arg; + return this->fnc_transformed(arg); + } + + typedef typename boost::result_of< + function(fusion::vector0<> &) >::type call_0_result; + + inline call_0_result operator()() + { + fusion::vector0<> arg; + return this->fnc_transformed(arg); + } + }; + + template class unfused + { + protected: + Function fnc_transformed; + typedef typename detail::qf_c::type function_c; + typedef typename detail::qf::type function; + typedef typename detail::call_param::type func_const_fwd_t; + public: + + inline explicit unfused(func_const_fwd_t f = function()) + : fnc_transformed(f) + { } + + template + struct result; + + #define BOOST_PP_FILENAME_1 \ + + #define BOOST_PP_ITERATION_LIMITS \ + (1,BOOST_FUSION_UNFUSED_MAX_ARITY) + #include BOOST_PP_ITERATE() + }; +}} + +namespace boost +{ + template + struct result_of< boost::fusion::unfused const () > + { + typedef typename boost::fusion::unfused::call_const_0_result type; + }; + template + struct result_of< boost::fusion::unfused() > + { + typedef typename boost::fusion::unfused::call_0_result type; + }; +} + +#define BOOST_FUSION_FUNCTIONAL_ADAPTER_UNFUSED_HPP_INCLUDED +#else // defined(BOOST_PP_IS_ITERATING) +//////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +//////////////////////////////////////////////////////////////////////////////// +#define N BOOST_PP_ITERATION() + + template + struct result< Self const (BOOST_PP_ENUM_PARAMS(N,T)) > + : boost::result_of< function_c( + BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N, + typename detail::mref::type BOOST_PP_INTERCEPT) > & )> + { }; + + template + struct result< Self(BOOST_PP_ENUM_PARAMS(N,T)) > + : boost::result_of< function( + BOOST_PP_CAT(fusion::vector,N)< BOOST_PP_ENUM_BINARY_PARAMS(N, + typename detail::mref::type BOOST_PP_INTERCEPT) > & )> + { }; + + template + inline typename boost::result_of & )>::type + operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const + { + BOOST_PP_CAT(fusion::vector,N)< + BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) > + arg(BOOST_PP_ENUM_PARAMS(N,a)); + return this->fnc_transformed(arg); + } + + template + inline typename boost::result_of & )>::type + operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) + { + BOOST_PP_CAT(fusion::vector,N)< + BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT) > + arg(BOOST_PP_ENUM_PARAMS(N,a)); + return this->fnc_transformed(arg); + } +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) +#endif + diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/unfused_generic.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/unfused_generic.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/unfused_generic.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/unfused_generic.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/unfused_lvalue_args.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/unfused_rvalue_args.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/adapter/unfused_typed.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/unfused_typed.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/adapter/unfused_typed.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/adapter/unfused_typed.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/generation.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation.hpp similarity index 76% rename from deal.II/contrib/boost/include/boost/fusion/functional/generation.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation.hpp index 3dabd3eea5..3d812b9f7e 100644 --- a/deal.II/contrib/boost/include/boost/fusion/functional/generation.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation.hpp @@ -12,8 +12,6 @@ #include #include #include -#include -#include -#include +#include #endif diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/generation/detail/gen_make_adapter.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/detail/gen_make_adapter.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/generation/detail/gen_make_adapter.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/detail/gen_make_adapter.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/generation/make_fused.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_fused.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/generation/make_fused.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_fused.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/generation/make_fused_function_object.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_fused_function_object.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/generation/make_fused_function_object.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_fused_function_object.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/generation/make_fused_procedure.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_fused_procedure.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/generation/make_fused_procedure.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_fused_procedure.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_unfused.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_unfused.hpp new file mode 100644 index 0000000000..79eadbd5aa --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_unfused.hpp @@ -0,0 +1,18 @@ +/*============================================================================= + Copyright (c) 2007 Tobias Schwinger + + 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). +==============================================================================*/ + +#if !defined(BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_UNFUSED_HPP_INCLUDED) +#define BOOST_FUSION_FUNCTIONAL_GENERATION_MAKE_UNFUSED_HPP_INCLUDED + +#include + +#define BOOST_FUSION_CLASS_TPL_NAME unfused +#include + +#endif + diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/generation/make_unfused_generic.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_unfused_generic.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/generation/make_unfused_generic.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_unfused_generic.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/generation/make_unfused_lvalue_args.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_unfused_lvalue_args.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/generation/make_unfused_lvalue_args.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_unfused_lvalue_args.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/generation/make_unfused_rvalue_args.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_unfused_rvalue_args.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/generation/make_unfused_rvalue_args.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/generation/make_unfused_rvalue_args.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/invocation.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/invocation.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/invocation/detail/that_ptr.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation/detail/that_ptr.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/invocation/detail/that_ptr.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation/detail/that_ptr.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/invocation/invoke.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation/invoke.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/invocation/invoke.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation/invoke.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/invocation/invoke_function_object.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation/invoke_function_object.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/invocation/invoke_function_object.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation/invoke_function_object.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/invocation/invoke_procedure.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation/invoke_procedure.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/invocation/invoke_procedure.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation/invoke_procedure.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/functional/invocation/limits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation/limits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/functional/invocation/limits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/functional/invocation/limits.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/accumulate.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/accumulate.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/accumulate.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/accumulate.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/adapt_struct.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/adapt_struct.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/adapt_struct.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/adapt_struct.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/adapted.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/adapted.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/adapted.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/adapted.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/adapter.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/adapter.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/adapter.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/adapter.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/advance.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/advance.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/advance.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/advance.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/algorithm.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/algorithm.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/algorithm.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/algorithm.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/all.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/all.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/all.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/all.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/any.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/any.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/any.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/any.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/array.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/array.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/array.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/array.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/as_deque.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/as_deque.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/as_deque.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/as_deque.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/as_list.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/as_list.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/as_list.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/as_list.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/as_map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/as_map.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/as_map.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/as_map.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/as_set.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/as_set.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/as_set.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/as_set.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/as_vector.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/as_vector.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/as_vector.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/as_vector.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/at.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/at.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/at.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/at.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/at_c.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/at_c.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/at_c.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/at_c.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/at_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/at_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/at_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/at_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/back.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/back.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/back.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/back.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/begin.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/begin.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/begin.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/begin.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/boost_tuple.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/boost_tuple.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/boost_tuple.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/boost_tuple.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/category_of.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/category_of.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/category_of.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/category_of.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/clear.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/clear.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/clear.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/clear.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/comparison.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/comparison.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/comparison.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/comparison.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/cons.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/cons.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/cons.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/cons.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/cons_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/cons_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/cons_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/cons_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/container.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/container.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/container.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/container.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/convert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/convert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/convert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/convert.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/count.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/count.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/count.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/count.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/count_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/count_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/count_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/count_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/deduce.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deduce.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/deduce.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deduce.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/deduce_sequence.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deduce_sequence.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/deduce_sequence.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deduce_sequence.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/deque.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deque.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/deque.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deque.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/deque_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deque_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/deque_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deque_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/deque_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deque_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/deque_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deque_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/deref.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deref.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/deref.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/deref.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/distance.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/distance.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/distance.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/distance.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/empty.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/empty.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/empty.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/empty.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/end.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/end.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/end.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/end.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/equal_to.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/equal_to.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/equal_to.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/equal_to.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/erase.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/erase.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/erase.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/erase.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/erase_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/erase_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/erase_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/erase_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/filter.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/filter.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/filter.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/filter.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/filter_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/filter_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/filter_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/filter_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/filter_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/filter_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/filter_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/filter_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/find.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/find.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/find.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/find.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/find_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/find_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/find_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/find_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/fold.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/fold.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/fold.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/fold.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/for_each.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/for_each.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/for_each.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/for_each.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/front.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/front.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/front.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/front.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/functional.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/functional.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/functional.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/functional.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/fused.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/fused.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/fused.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/fused.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/fused_function_object.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/fused_function_object.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/fused_function_object.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/fused_function_object.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/fused_procedure.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/fused_procedure.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/fused_procedure.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/fused_procedure.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/generation.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/generation.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/generation.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/generation.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/greater.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/greater.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/greater.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/greater.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/greater_equal.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/greater_equal.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/greater_equal.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/greater_equal.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/has_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/has_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/has_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/has_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/ignore.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/ignore.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/ignore.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/ignore.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/in.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/in.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/in.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/in.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/insert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/insert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/insert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/insert.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/insert_range.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/insert_range.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/insert_range.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/insert_range.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/intrinsic.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/intrinsic.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/intrinsic.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/intrinsic.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/invocation.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/invocation.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/invocation.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/invocation.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/invoke.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/invoke.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/invoke.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/invoke.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/invoke_function_object.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/invoke_function_object.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/invoke_function_object.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/invoke_function_object.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/invoke_procedure.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/invoke_procedure.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/invoke_procedure.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/invoke_procedure.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/io.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/io.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/io.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/io.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/is_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/is_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/is_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/is_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/is_sequence.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/is_sequence.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/is_sequence.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/is_sequence.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/is_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/is_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/is_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/is_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/iteration.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/iteration.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/iteration.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/iteration.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/iterator_base.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/iterator_base.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/iterator_base.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/iterator_base.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/iterator_facade.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/iterator_facade.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/iterator_facade.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/iterator_facade.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/iterator_range.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/iterator_range.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/iterator_range.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/iterator_range.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/join.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/join.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/join.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/join.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/joint_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/joint_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/joint_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/joint_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/less.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/less.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/less.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/less.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/less_equal.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/less_equal.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/less_equal.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/less_equal.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/list.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/list.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/list.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/list.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/list_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/list_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/list_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/list_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/list_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/list_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/list_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/list_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_cons.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_cons.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_cons.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_cons.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_deque.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_deque.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_deque.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_deque.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_fused.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_fused.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_fused.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_fused.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_fused_function_object.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_fused_function_object.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_fused_function_object.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_fused_function_object.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_fused_procedure.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_fused_procedure.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_fused_procedure.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_fused_procedure.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_list.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_list.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_list.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_list.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_map.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_map.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_map.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_set.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_set.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_set.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_set.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_tuple.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_tuple.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_tuple.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_tuple.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_unfused_generic.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_unfused_generic.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_unfused_generic.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_unfused_generic.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_unfused_lvalue_args.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_unfused_lvalue_args.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_unfused_lvalue_args.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_unfused_lvalue_args.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_unfused_rvalue_args.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_unfused_rvalue_args.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_unfused_rvalue_args.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_unfused_rvalue_args.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/make_vector.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_vector.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/make_vector.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/make_vector.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/map.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/map.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/map.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/map_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/map_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/map_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/map_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/map_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/map_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/map_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/map_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/mpl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/mpl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/mpl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/mpl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/next.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/next.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/next.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/next.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/none.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/none.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/none.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/none.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/not_equal_to.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/not_equal_to.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/not_equal_to.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/not_equal_to.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/nview.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/nview.hpp new file mode 100644 index 0000000000..215329d02b --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/nview.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Copyright (c) 2001-2007 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(FUSION_INCLUDE_NVIEW) +#define FUSION_INCLUDE_NVIEW + +#include + +#endif diff --git a/deal.II/contrib/boost/include/boost/fusion/include/out.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/out.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/out.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/out.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/pair.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/pair.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/pair.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/pair.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/pair_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/pair_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/pair_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/pair_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/pop_back.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/pop_back.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/pop_back.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/pop_back.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/pop_front.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/pop_front.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/pop_front.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/pop_front.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/prior.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/prior.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/prior.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/prior.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/push_back.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/push_back.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/push_back.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/push_back.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/push_front.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/push_front.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/push_front.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/push_front.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/query.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/query.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/query.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/query.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/remove.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/remove.hpp similarity index 73% rename from deal.II/contrib/boost/include/boost/fusion/include/remove.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/remove.hpp index 7f0b4657da..9f11d69617 100644 --- a/deal.II/contrib/boost/include/boost/fusion/include/remove.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/remove.hpp @@ -4,9 +4,9 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#if !defined(FUSION_INCLUDE_REMOVE_IF) -#define FUSION_INCLUDE_REMOVE_IF +#if !defined(FUSION_INCLUDE_REMOVE) +#define FUSION_INCLUDE_REMOVE -#include +#include #endif diff --git a/deal.II/contrib/boost/include/boost/fusion/include/remove_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/remove_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/remove_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/remove_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/repetetive_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/repetetive_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/repetetive_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/repetetive_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/replace.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/replace.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/replace.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/replace.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/replace_if.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/replace_if.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/replace_if.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/replace_if.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/reverse.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/reverse.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/reverse.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/reverse.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/reverse_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/reverse_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/reverse_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/reverse_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/sequence.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/sequence.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/sequence.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/sequence.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/sequence_base.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/sequence_base.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/sequence_base.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/sequence_base.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/sequence_facade.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/sequence_facade.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/sequence_facade.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/sequence_facade.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/set.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/set.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/set.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/set.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/set_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/set_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/set_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/set_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/single_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/single_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/single_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/single_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/size.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/size.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/size.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/size.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/std_pair.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/std_pair.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/std_pair.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/std_pair.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/struct.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/struct.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/struct.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/struct.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/support.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/support.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/support.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/support.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/swap.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/swap.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/swap.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/swap.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/tag_of.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/tag_of.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/tag_of.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/tag_of.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/tag_of_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/tag_of_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/tag_of_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/tag_of_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/transform.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/transform.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/transform.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/transform.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/transform_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/transform_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/transform_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/transform_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/transformation.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/transformation.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/transformation.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/transformation.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/tuple.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/tuple.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/tuple.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/tuple.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/tuple_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/tuple_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/tuple_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/tuple_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/tuple_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/tuple_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/tuple_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/tuple_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/unfused_generic.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/unfused_generic.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/unfused_generic.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/unfused_generic.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/unfused_lvalue_args.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/unfused_lvalue_args.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/unfused_lvalue_args.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/unfused_lvalue_args.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/unfused_rvalue_args.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/unfused_rvalue_args.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/unfused_rvalue_args.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/unfused_rvalue_args.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/unfused_typed.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/unfused_typed.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/unfused_typed.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/unfused_typed.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/unused.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/unused.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/unused.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/unused.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/value_at.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/value_at.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/value_at.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/value_at.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/value_at_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/value_at_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/value_at_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/value_at_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/value_of.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/value_of.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/value_of.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/value_of.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/vector.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/vector.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/vector10.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector10.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/vector10.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector10.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/vector20.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector20.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/vector20.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector20.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/vector30.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector30.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/vector30.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector30.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/vector40.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector40.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/vector40.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector40.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/vector50.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector50.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/vector50.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector50.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/vector_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/vector_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/vector_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/vector_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/vector_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/void.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/void.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/void.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/void.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/zip.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/zip.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/zip.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/zip.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/include/zip_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/include/zip_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/include/zip_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/include/zip_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/advance.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/advance.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/advance.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/advance.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/deref.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/deref.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/deref.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/deref.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/detail/adapt_deref_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/detail/adapt_deref_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/detail/adapt_deref_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/detail/adapt_deref_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/detail/adapt_value_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/detail/adapt_value_traits.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/detail/adapt_value_traits.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/detail/adapt_value_traits.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/detail/advance.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/detail/advance.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/detail/advance.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/detail/advance.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/detail/distance.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/detail/distance.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/detail/distance.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/detail/distance.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/distance.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/distance.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/distance.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/distance.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/equal_to.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/equal_to.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/equal_to.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/equal_to.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/iterator_facade.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/iterator_facade.hpp similarity index 86% rename from deal.II/contrib/boost/include/boost/fusion/iterator/iterator_facade.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/iterator_facade.hpp index f1720bdba4..3e0a926f2b 100644 --- a/deal.II/contrib/boost/include/boost/fusion/iterator/iterator_facade.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/iterator_facade.hpp @@ -1,7 +1,7 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_ITERATOR_FACADE_09252006_1011) @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -44,6 +45,13 @@ namespace boost { namespace fusion { BOOST_MPL_ASSERT_NOT((traits::is_random_access)); }; + + // default implementation + template + struct distance : + distance_detail::linear_distance + { + }; }; }} diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/mpl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/mpl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/mpl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/mpl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/mpl/convert_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/mpl/convert_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/mpl/convert_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/mpl/convert_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/mpl/fusion_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/mpl/fusion_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/mpl/fusion_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/mpl/fusion_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/next.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/next.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/next.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/next.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/prior.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/prior.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/prior.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/prior.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/iterator/value_of.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/value_of.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/iterator/value_of.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/iterator/value_of.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/at.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/at.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/at.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/at.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/back.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/back.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/back.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/back.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/begin.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/begin.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/begin.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/begin.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/clear.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/clear.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/clear.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/clear.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/detail/clear.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/detail/clear.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/detail/clear.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/detail/clear.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/empty.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/empty.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/empty.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/empty.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/end.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/end.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/end.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/end.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/erase.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/erase.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/erase.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/erase.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/erase_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/erase_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/erase_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/erase_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/front.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/front.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/front.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/front.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/has_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/has_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/has_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/has_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/insert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/insert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/insert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/insert.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/insert_range.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/insert_range.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/insert_range.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/insert_range.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/pop_back.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/pop_back.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/pop_back.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/pop_back.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/pop_front.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/pop_front.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/pop_front.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/pop_front.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/push_back.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/push_back.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/push_back.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/push_back.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/push_front.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/push_front.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/push_front.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/push_front.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/mpl/size.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/size.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/mpl/size.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/mpl/size.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/enable_comparison.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/enable_comparison.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/enable_comparison.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/enable_comparison.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/equal_to.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/equal_to.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/equal_to.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/equal_to.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/greater.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/greater.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/greater.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/greater.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/less.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/less.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/less.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/less.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/less_equal.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/less_equal.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/less_equal.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/less_equal.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/equal_to.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/equal_to.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/equal_to.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/equal_to.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/greater.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/greater.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/greater.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/greater.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/greater_equal.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/greater_equal.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/greater_equal.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/greater_equal.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/less.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/less.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/less.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/less.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/less_equal.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/less_equal.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/less_equal.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/less_equal.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/comparison/not_equal_to.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/not_equal_to.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/comparison/not_equal_to.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/comparison/not_equal_to.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/convert.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/convert.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/convert.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/convert.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/at.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/at.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/at.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/at.hpp index 4524ace5dc..bcb67990e9 100644 --- a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/at.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/at.hpp @@ -91,14 +91,14 @@ namespace boost { namespace fusion >::type at_c(Sequence& seq) { - return at >(seq); + return fusion::at >(seq); } template inline typename result_of::at_c::type at_c(Sequence const& seq) { - return at >(seq); + return fusion::at >(seq); } }} diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/at_c.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/at_c.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/at_c.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/at_c.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/at_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/at_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/at_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/at_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/back.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/back.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/back.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/back.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/begin.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/begin.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/begin.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/begin.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/empty.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/empty.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/empty.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/empty.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/end.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/end.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/end.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/end.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/ext_/segments.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/ext_/segments.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/ext_/segments.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/ext_/segments.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/ext_/size_s.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/front.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/front.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/front.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/front.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/has_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/has_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/has_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/has_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/size.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/size.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/size.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/size.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/swap.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/swap.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/swap.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/swap.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/value_at.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/value_at.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/value_at.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/value_at.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/value_at_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/value_at_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/intrinsic/value_at_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/intrinsic/value_at_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/io.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/io.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/io/detail/in.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/detail/in.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/fusion/sequence/io/detail/in.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/detail/in.hpp index cd77251430..b0620284ed 100644 --- a/deal.II/contrib/boost/include/boost/fusion/sequence/io/detail/in.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/detail/in.hpp @@ -35,7 +35,7 @@ namespace boost { namespace fusion { namespace detail template static void - read(IS& is, char const* delim, mpl::true_) + read(IS&, char const*, mpl::true_) { } }; @@ -44,7 +44,7 @@ namespace boost { namespace fusion { namespace detail { template static void - call(IS& is, First const&, Last const&, mpl::true_) + call(IS&, First const&, Last const&, mpl::true_) { } diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/io/detail/manip.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/detail/manip.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/fusion/sequence/io/detail/manip.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/detail/manip.hpp index dd9a52659b..988f8bc2bc 100644 --- a/deal.II/contrib/boost/include/boost/fusion/sequence/io/detail/manip.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/detail/manip.hpp @@ -146,6 +146,10 @@ namespace boost { namespace fusion } Stream& stream; + + private: + // silence MSVC warning C4512: assignment operator could not be generated + string_ios_manip& operator= (string_ios_manip const&); }; } // detail diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/io/detail/out.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/detail/out.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/fusion/sequence/io/detail/out.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/detail/out.hpp index c8ab2085d0..6d0c28a7ce 100644 --- a/deal.II/contrib/boost/include/boost/fusion/sequence/io/detail/out.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/detail/out.hpp @@ -35,7 +35,7 @@ namespace boost { namespace fusion { namespace detail template static void - print(OS& os, char const* delim, mpl::true_) + print(OS&, char const*, mpl::true_) { } }; @@ -44,7 +44,7 @@ namespace boost { namespace fusion { namespace detail { template static void - call(OS& os, First const&, Last const&, mpl::true_) + call(OS&, First const&, Last const&, mpl::true_) { } diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/io/in.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/in.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/io/in.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/in.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/io/out.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/out.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/io/out.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/io/out.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/sequence/sequence_facade.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/sequence_facade.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/sequence/sequence_facade.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/sequence/sequence_facade.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/category_of.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/category_of.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/category_of.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/category_of.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/deduce.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/deduce.hpp similarity index 90% rename from deal.II/contrib/boost/include/boost/fusion/support/deduce.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/deduce.hpp index 37710ec1f2..3a7231bdf1 100644 --- a/deal.II/contrib/boost/include/boost/fusion/support/deduce.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/deduce.hpp @@ -87,6 +87,18 @@ namespace boost { namespace fusion { namespace traits // Keep references on arrays, even if const + template + struct deduce + { + typedef T(&type)[N]; + }; + + template + struct deduce + { + typedef volatile T(&type)[N]; + }; + template struct deduce { diff --git a/deal.II/contrib/boost/include/boost/fusion/support/deduce_sequence.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/deduce_sequence.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/deduce_sequence.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/deduce_sequence.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/detail/access.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/access.hpp similarity index 70% rename from deal.II/contrib/boost/include/boost/fusion/support/detail/access.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/access.hpp index 0508e50f13..af7374ccc7 100644 --- a/deal.II/contrib/boost/include/boost/fusion/support/detail/access.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/access.hpp @@ -7,12 +7,8 @@ #if !defined(FUSION_ACCESS_04182005_0737) #define FUSION_ACCESS_04182005_0737 -#include -#include #include #include -#include -#include namespace boost { namespace fusion { namespace detail { @@ -33,22 +29,35 @@ namespace boost { namespace fusion { namespace detail }; template - struct non_ref_parameter + struct call_param { - typedef typename boost::remove_cv::type const& type; + typedef T const& type; }; template - struct call_param + struct call_param { - typedef typename - mpl::eval_if< - is_reference - , mpl::identity - , non_ref_parameter - >::type - type; + typedef T& type; }; + + template + struct call_param + { + typedef T const& type; + }; + + template + struct call_param + { + typedef T const& type; + }; + + template + struct call_param + { + typedef T const& type; + }; + }}} #endif diff --git a/deal.II/contrib/boost/include/boost/fusion/support/detail/as_fusion_element.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/as_fusion_element.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/detail/as_fusion_element.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/as_fusion_element.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/detail/category_of.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/category_of.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/detail/category_of.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/category_of.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/detail/is_mpl_sequence.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/is_mpl_sequence.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/detail/is_mpl_sequence.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/is_mpl_sequence.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/detail/is_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/is_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/detail/is_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/is_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/detail/mpl_iterator_category.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/mpl_iterator_category.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/detail/mpl_iterator_category.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/mpl_iterator_category.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/detail/unknown_key.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/unknown_key.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/detail/unknown_key.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/detail/unknown_key.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/ext_/is_segmented.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/ext_/is_segmented.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/ext_/is_segmented.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/ext_/is_segmented.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/is_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/is_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/is_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/is_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/is_sequence.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/is_sequence.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/is_sequence.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/is_sequence.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/is_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/is_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/is_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/is_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/iterator_base.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/iterator_base.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/iterator_base.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/iterator_base.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/pair.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/pair.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/pair.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/pair.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/sequence_base.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/sequence_base.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/sequence_base.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/sequence_base.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/tag_of.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/tag_of.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/fusion/support/tag_of.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/tag_of.hpp index 282da4112a..a8e2ed07a0 100644 --- a/deal.II/contrib/boost/include/boost/fusion/support/tag_of.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/tag_of.hpp @@ -85,11 +85,11 @@ namespace boost { namespace fusion { template struct tag_of - : mpl::if_< detail::is_mpl_sequence, + : mpl::if_< fusion::detail::is_mpl_sequence, mpl::identity, mpl::identity >::type { - BOOST_MPL_ASSERT_NOT((detail::is_specialized)); + BOOST_MPL_ASSERT_NOT((fusion::detail::is_specialized)); }; template diff --git a/deal.II/contrib/boost/include/boost/fusion/support/tag_of_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/tag_of_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/tag_of_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/tag_of_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/support/unused.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/unused.hpp similarity index 75% rename from deal.II/contrib/boost/include/boost/fusion/support/unused.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/unused.hpp index dc2014ec0c..c62b738a34 100644 --- a/deal.II/contrib/boost/include/boost/fusion/support/unused.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/unused.hpp @@ -1,7 +1,7 @@ /*============================================================================= Copyright (c) 2001-2006 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(BOOST_FUSION_SUPPORT_UNUSED_20070305_1038) @@ -13,7 +13,10 @@ # pragma warning(disable: 4522) // multiple assignment operators specified warning #endif -namespace boost { namespace fusion { +#define BOOST_FUSION_UNUSED_HAS_IO + +namespace boost { namespace fusion +{ struct unused_type { unused_type() @@ -53,6 +56,26 @@ namespace boost { namespace fusion { }; unused_type const unused = unused_type(); + + namespace detail + { + struct unused_only + { + unused_only(unused_type const&) {} + }; + } + + template + inline Out& operator<<(Out& out, detail::unused_only const&) + { + return out; + } + + template + inline In& operator>>(In& in, unused_type&) + { + return in; + } }} #if defined(BOOST_MSVC) diff --git a/deal.II/contrib/boost/include/boost/fusion/support/void.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/support/void.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/support/void.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/support/void.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/tuple.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/tuple.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/tuple/detail/tuple_expand.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple/detail/tuple_expand.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/tuple/detail/tuple_expand.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple/detail/tuple_expand.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/tuple/make_tuple.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple/make_tuple.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/tuple/make_tuple.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple/make_tuple.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/tuple/tuple.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple/tuple.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/tuple/tuple.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple/tuple.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/tuple/tuple_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple/tuple_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/tuple/tuple_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple/tuple_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/tuple/tuple_tie.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple/tuple_tie.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/tuple/tuple_tie.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/tuple/tuple_tie.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/detail/strictest_traversal.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/detail/strictest_traversal.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/detail/strictest_traversal.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/detail/strictest_traversal.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/ext_/multiple_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/ext_/multiple_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/ext_/multiple_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/ext_/multiple_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/ext_/segmented_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/ext_/segmented_iterator.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/fusion/view/ext_/segmented_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/ext_/segmented_iterator.hpp index 0a192bdce7..b28182a4cf 100644 --- a/deal.II/contrib/boost/include/boost/fusion/view/ext_/segmented_iterator.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/ext_/segmented_iterator.hpp @@ -327,8 +327,8 @@ namespace boost { namespace fusion typedef typename Cons::car_type car_type; typedef typename Cons::cdr_type cdr_type; - explicit segmented_iterator(Cons const &cons) - : cons_(cons) + explicit segmented_iterator(Cons const &c) + : cons_(c) {} cons_type const &cons() const { return this->cons_; }; diff --git a/deal.II/contrib/boost/include/boost/fusion/view/ext_/segmented_iterator_range.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/ext_/segmented_iterator_range.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/ext_/segmented_iterator_range.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/ext_/segmented_iterator_range.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/filter_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/filter_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/deref_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/deref_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/deref_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/deref_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/equal_to_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/equal_to_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/equal_to_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/equal_to_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/next_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/next_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/next_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/next_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/size_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/size_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/size_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/size_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/value_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/value_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/filter_view/detail/value_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/detail/value_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/filter_view/filter_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/filter_view.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/fusion/view/filter_view/filter_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/filter_view.hpp index a34747e6eb..c3e63fdb73 100644 --- a/deal.II/contrib/boost/include/boost/fusion/view/filter_view/filter_view.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/filter_view.hpp @@ -43,6 +43,10 @@ namespace boost { namespace fusion first_type first() const { return fusion::begin(seq); } last_type last() const { return fusion::end(seq); } typename mpl::if_, Sequence, Sequence&>::type seq; + + private: + // silence MSVC warning C4512: assignment operator could not be generated + filter_view& operator= (filter_view const&); }; }} diff --git a/deal.II/contrib/boost/include/boost/fusion/view/filter_view/filter_view_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/filter_view_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/filter_view/filter_view_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/filter_view/filter_view_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/iterator_range.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/iterator_range.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/iterator_range/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range/detail/at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/iterator_range/detail/at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range/detail/at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/iterator_range/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/iterator_range/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/iterator_range/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/iterator_range/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/iterator_range/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range/detail/value_at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/iterator_range/detail/value_at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range/detail/value_at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/iterator_range/iterator_range.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range/iterator_range.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/iterator_range/iterator_range.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/iterator_range/iterator_range.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/joint_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/joint_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/joint_view/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/joint_view/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/joint_view/detail/deref_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/detail/deref_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/joint_view/detail/deref_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/detail/deref_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/joint_view/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/joint_view/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/joint_view/detail/next_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/detail/next_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/joint_view/detail/next_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/detail/next_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/joint_view/detail/value_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/detail/value_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/joint_view/detail/value_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/detail/value_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/joint_view/joint_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/joint_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/joint_view/joint_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/joint_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/joint_view/joint_view_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/joint_view_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/joint_view/joint_view_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/joint_view/joint_view_iterator.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview.hpp new file mode 100644 index 0000000000..92e2f26a57 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview.hpp @@ -0,0 +1,15 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2006 Dan Marsden + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(FUSION_NVIEW_SEP_23_2009_1107PM) +#define FUSION_NVIEW_SEP_23_2009_1107PM + +#include +#include + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/advance_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/advance_impl.hpp new file mode 100644 index 0000000000..391bebd8b0 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/advance_impl.hpp @@ -0,0 +1,49 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_NVIEW_ADVANCE_IMPL_SEP_24_2009_0212PM) +#define BOOST_FUSION_NVIEW_ADVANCE_IMPL_SEP_24_2009_0212PM + +#include +#include + +namespace boost { namespace fusion +{ + struct nview_iterator_tag; + + template + struct nview_iterator; + + namespace extension + { + template + struct advance_impl; + + template<> + struct advance_impl + { + template + struct apply + { + typedef typename Iterator::first_type::iterator_type iterator_type; + typedef typename Iterator::sequence_type sequence_type; + + typedef nview_iterator::type> type; + + static type + call(Iterator const& i) + { + return type(i.seq); + } + }; + }; + } + +}} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/at_impl.hpp new file mode 100644 index 0000000000..f1f41642ab --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/at_impl.hpp @@ -0,0 +1,45 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_NVIEW_AT_IMPL_SEP_24_2009_0225PM) +#define BOOST_FUSION_NVIEW_AT_IMPL_SEP_24_2009_0225PM + +#include + +namespace boost { namespace fusion +{ + struct nview_tag; + + namespace extension + { + template + struct at_impl; + + template<> + struct at_impl + { + template + struct apply + { + typedef typename Sequence::sequence_type sequence_type; + typedef typename Sequence::index_type index_type; + + typedef typename result_of::at::type index; + typedef typename result_of::at::type type; + + static type + call(Sequence& seq) + { + return fusion::at(seq.seq); + } + }; + }; + } + +}} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/begin_impl.hpp new file mode 100644 index 0000000000..8ba59fc5d8 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/begin_impl.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_NVIEW_BEGIN_IMPL_SEP_23_2009_1036PM) +#define BOOST_FUSION_NVIEW_BEGIN_IMPL_SEP_23_2009_1036PM + +#include +#include + +namespace boost { namespace fusion +{ + struct nview_tag; + + template + struct nview_iterator; + + namespace extension + { + template + struct begin_impl; + + template<> + struct begin_impl + { + template + struct apply + { + typedef typename Sequence::index_type index_type; + + typedef nview_iterator::type> type; + + static type call(Sequence& s) + { + return type(s); + } + }; + }; + } + +}} + +#endif + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/deref_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/deref_impl.hpp new file mode 100644 index 0000000000..075f0b0f18 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/deref_impl.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM) +#define BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM + +#include +#include + +namespace boost { namespace fusion +{ + struct nview_iterator_tag; + + namespace extension + { + template + struct deref_impl; + + template<> + struct deref_impl + { + template + struct apply + { + typedef typename Iterator::first_type first_type; + typedef typename Iterator::sequence_type sequence_type; + + typedef typename result_of::deref::type index; + typedef typename result_of::at< + typename sequence_type::sequence_type, index>::type type; + + static type call(Iterator const& i) + { + return at(i.seq.seq); + } + }; + }; + + } + +}} + +#endif + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/distance_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/distance_impl.hpp new file mode 100644 index 0000000000..9bc860c598 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/distance_impl.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_NVIEW_DISTANCE_IMPL_SEP_23_2009_0328PM) +#define BOOST_FUSION_NVIEW_DISTANCE_IMPL_SEP_23_2009_0328PM + +#include + +namespace boost { namespace fusion +{ + struct nview_iterator_tag; + + namespace extension + { + template + struct distance_impl; + + template<> + struct distance_impl + { + template + struct apply + : result_of::distance + { + typedef typename result_of::distance< + typename First::first_type, typename Last::first_type + >::type type; + + static type + call(First const& first, Last const& last) + { + return type(); + } + }; + }; + } + +}} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/end_impl.hpp new file mode 100644 index 0000000000..7897748b7d --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/end_impl.hpp @@ -0,0 +1,50 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_NVIEW_END_IMPL_SEP_24_2009_0140PM) +#define BOOST_FUSION_NVIEW_END_IMPL_SEP_24_2009_0140PM + +#include +#include + +namespace boost { namespace fusion +{ + struct nview_tag; + + template + struct nview_iterator; + + namespace extension + { + template + struct end_impl; + + // Unary Version + template <> + struct end_impl + { + template + struct apply + { + typedef typename Sequence::index_type index_type; + + typedef nview_iterator::type> type; + + static type call(Sequence& s) + { + return type(s); + } + }; + }; + } + +}} + +#endif + + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/equal_to_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/equal_to_impl.hpp new file mode 100644 index 0000000000..517204b078 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/equal_to_impl.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_NVIEW_ITERATOR_SEP_24_2009_0329PM) +#define BOOST_FUSION_NVIEW_ITERATOR_SEP_24_2009_0329PM + +#include + +namespace boost { namespace fusion +{ + struct nview_iterator_tag; + + namespace extension + { + template + struct equal_to_impl; + + template<> + struct equal_to_impl + { + template + struct apply + : result_of::equal_to + {}; + }; + } +}} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/next_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/next_impl.hpp new file mode 100644 index 0000000000..01cccf2b84 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/next_impl.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_NVIEW_NEXT_IMPL_SEP_24_2009_0116PM) +#define BOOST_FUSION_NVIEW_NEXT_IMPL_SEP_24_2009_0116PM + +#include + +namespace boost { namespace fusion +{ + struct nview_iterator_tag; + + template + struct nview_iterator; + + namespace extension + { + template + struct next_impl; + + template <> + struct next_impl + { + template + struct apply + { + typedef typename Iterator::first_type::iterator_type first_type; + typedef typename Iterator::sequence_type sequence_type; + + typedef nview_iterator::type> type; + + static type + call(Iterator const& i) + { + return type(i.seq); + } + }; + }; + } + +}} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/nview_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/nview_impl.hpp new file mode 100644 index 0000000000..03aa49f4cf --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/nview_impl.hpp @@ -0,0 +1,77 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#ifndef BOOST_PP_IS_ITERATING + +#if !defined(BOOST_FUSION_NVIEW_IMPL_SEP_23_2009_1017PM) +#define BOOST_FUSION_NVIEW_IMPL_SEP_23_2009_1017PM + +#include +#include +#include +#include +#include +#include +#include + +#define BOOST_PP_ITERATION_PARAMS_1 \ + (3, (1, FUSION_MAX_VECTOR_SIZE, \ + "boost/fusion/view/nview/detail/nview_impl.hpp")) \ + /**/ + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace fusion { namespace result_of +{ + template + struct as_nview + { + typedef mpl::vector_c< + int, BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, I) + > index_type; + typedef nview type; + }; +}}} + +#include BOOST_PP_ITERATE() + +#endif + +/////////////////////////////////////////////////////////////////////////////// +// Preprocessor vertical repetition code +/////////////////////////////////////////////////////////////////////////////// +#else // defined(BOOST_PP_IS_ITERATING) + +#define N BOOST_PP_ITERATION() + +#if N < FUSION_MAX_VECTOR_SIZE +namespace boost { namespace fusion { namespace result_of +{ + template + struct as_nview + { + typedef mpl::vector_c index_type; + typedef nview type; + }; +}}} +#endif + +namespace boost { namespace fusion +{ + template + inline nview > + as_nview(Sequence& s) + { + typedef mpl::vector_c index_type; + return nview(s); + } + +}} + +#undef N + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/prior_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/prior_impl.hpp new file mode 100644 index 0000000000..079a9ca6c9 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/prior_impl.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_NVIEW_PRIOR_IMPL_SEP_24_2009_0142PM) +#define BOOST_FUSION_NVIEW_PRIOR_IMPL_SEP_24_2009_0142PM + +#include + +namespace boost { namespace fusion +{ + struct nview_iterator_tag; + + template + struct nview_iterator; + + namespace extension + { + template + struct prior_impl; + + template <> + struct prior_impl + { + template + struct apply + { + typedef typename Iterator::first_type::iterator_type first_type; + typedef typename Iterator::sequence_type sequence_type; + + typedef nview_iterator::type> type; + + static type + call(Iterator const& i) + { + return type(i.seq); + } + }; + }; + } + +}} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/size_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/size_impl.hpp new file mode 100644 index 0000000000..0c83402662 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/size_impl.hpp @@ -0,0 +1,38 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(FUSION_NVIEW_SIZE_IMPL_OCT_06_2009_0525PM) +#define FUSION_NVIEW_SIZE_IMPL_OCT_06_2009_0525PM + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct nview_tag; + + namespace extension + { + template + struct size_impl; + + template <> + struct size_impl + { + template + struct apply + : result_of::distance< + typename result_of::begin::type + , typename result_of::end::type> + {}; + }; + } +}} + +#endif + + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/value_at_impl.hpp new file mode 100644 index 0000000000..145bb629bb --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/value_at_impl.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_NVIEW_VALUE_AT_IMPL_SEP_24_2009_0234PM) +#define BOOST_FUSION_NVIEW_VALUE_AT_IMPL_SEP_24_2009_0234PM + +#include + +namespace boost { namespace fusion +{ + struct nview_tag; + + namespace extension + { + template + struct value_at_impl; + + template<> + struct value_at_impl + { + template + struct apply + { + typedef typename Sequence::sequence_type sequence_type; + typedef typename Sequence::index_type index_type; + + typedef typename result_of::at::type index; + typedef typename result_of::at::type type; + }; + }; + } + +}} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/value_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/value_of_impl.hpp new file mode 100644 index 0000000000..5b0a85ba9a --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/detail/value_of_impl.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_VALUE_OF_PRIOR_IMPL_SEP_24_2009_0158PM) +#define BOOST_FUSION_VALUE_OF_PRIOR_IMPL_SEP_24_2009_0158PM + +#include +#include + +namespace boost { namespace fusion +{ + struct nview_iterator_tag; + + template + struct nview_iterator; + + namespace extension + { + template + struct value_of_impl; + + template <> + struct value_of_impl + { + template + struct apply + { + typedef typename Iterator::first_type first_type; + typedef typename Iterator::sequence_type sequence_type; + + typedef typename result_of::deref::type index; + typedef typename result_of::at< + typename sequence_type::sequence_type, index>::type type; + }; + }; + } + +}} + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/nview.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/nview.hpp new file mode 100644 index 0000000000..fe8d35cf2b --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/nview.hpp @@ -0,0 +1,100 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#if !defined(BOOST_FUSION_NVIEW_SEP_23_2009_0948PM) +#define BOOST_FUSION_NVIEW_SEP_23_2009_0948PM + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace detail + { + struct addref + { + template + struct result; + + template + struct result : add_reference {}; + + template + typename boost::result_of::type + operator()(T& x) const + { + return x; + } + }; + + struct addconstref + { + template + struct result; + + template + struct result + : add_reference::type> + {}; + + template + typename boost::result_of::type + operator()(T& x) const + { + return x; + } + }; + } + + struct nview_tag; + struct random_access_traversal_tag; + struct fusion_sequence_tag; + + template + struct nview + : sequence_base > + { + typedef nview_tag fusion_tag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef random_access_traversal_tag category; + + typedef mpl::true_ is_view; + typedef Indicies index_type; + typedef typename mpl::size::type size; + + typedef typename mpl::if_< + is_const, detail::addconstref, detail::addref + >::type transform_type; + typedef transform_view transform_view_type; + typedef typename result_of::as_vector::type + sequence_type; + + explicit nview(Sequence& val) + : seq(sequence_type(transform_view_type(val, transform_type()))) + {} + + sequence_type seq; + }; + +}} + +// define the nview() generator functions +#include + +#endif + + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/nview_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/nview_iterator.hpp new file mode 100644 index 0000000000..4fc06a8535 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/nview/nview_iterator.hpp @@ -0,0 +1,58 @@ +/*============================================================================= + Copyright (c) 2009 Hartmut Kaiser + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_NVIEW_ITERATOR_SEP_23_2009_0948PM) +#define BOOST_FUSION_NVIEW_ITERATOR_SEP_23_2009_0948PM + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct nview_iterator_tag; + struct random_access_traversal_tag; + + template + struct nview_iterator + : iterator_base > + { + typedef nview_iterator_tag fusion_tag; + typedef random_access_traversal_tag category; + + typedef Sequence sequence_type; + typedef mpl_iterator first_type; + + explicit nview_iterator(Sequence& seq) + : seq(seq) {} + + Sequence& seq; + + private: + // silence MSVC warning C4512: assignment operator could not be generated + nview_iterator& operator= (nview_iterator const&); + }; + +}} + +#endif + + diff --git a/deal.II/contrib/boost/include/boost/fusion/view/repetitive_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/repetitive_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/detail/deref_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/detail/deref_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/detail/deref_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/detail/deref_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/detail/next_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/detail/next_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/detail/next_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/detail/next_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/detail/value_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/detail/value_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/detail/value_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/detail/value_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/repetitive_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/repetitive_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/repetitive_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/repetitive_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/repetitive_view_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/repetitive_view_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/repetitive_view_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/repetitive_view_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/repetitive_view/repetitive_view_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/reverse_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/reverse_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/advance_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/advance_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/advance_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/advance_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/deref_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/deref_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/deref_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/deref_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/distance_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/distance_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/distance_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/distance_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/next_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/next_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/next_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/next_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/prior_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/prior_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/prior_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/prior_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/value_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/value_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/reverse_view/detail/value_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/detail/value_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/reverse_view/reverse_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/reverse_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/reverse_view/reverse_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/reverse_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/reverse_view/reverse_view_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/single_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/single_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/single_view/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/single_view/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/single_view/detail/deref_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/detail/deref_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/single_view/detail/deref_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/detail/deref_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/single_view/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/single_view/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/single_view/detail/next_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/detail/next_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/single_view/detail/next_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/detail/next_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/single_view/detail/value_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/detail/value_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/single_view/detail/value_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/detail/value_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/single_view/single_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/single_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/single_view/single_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/single_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/single_view/single_view_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/single_view_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/single_view/single_view_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/single_view/single_view_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/advance_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/advance_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/advance_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/advance_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/apply_transform_result.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/apply_transform_result.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/apply_transform_result.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/apply_transform_result.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/deref_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/deref_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/deref_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/deref_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/distance_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/distance_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/distance_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/distance_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/equal_to_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/equal_to_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/equal_to_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/equal_to_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/next_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/next_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/next_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/next_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/prior_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/prior_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/prior_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/prior_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/value_at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/value_at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/value_at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/value_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/value_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/detail/value_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/detail/value_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/transform_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/transform_view.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/transform_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/transform_view.hpp index fcf876a0a1..78b6560e76 100644 --- a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/transform_view.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/transform_view.hpp @@ -99,6 +99,10 @@ namespace boost { namespace fusion last_type last() const { return fusion::end(seq); } typename mpl::if_, Sequence, Sequence&>::type seq; transform_type f; + + private: + // silence MSVC warning C4512: assignment operator could not be generated + transform_view& operator= (transform_view const&); }; }} diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/transform_view_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/transform_view_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/transform_view_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/transform_view_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/transform_view_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/transform_view_iterator.hpp similarity index 88% rename from deal.II/contrib/boost/include/boost/fusion/view/transform_view/transform_view_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/transform_view_iterator.hpp index bb4b6afdb4..fde67323c8 100644 --- a/deal.II/contrib/boost/include/boost/fusion/view/transform_view/transform_view_iterator.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/transform_view/transform_view_iterator.hpp @@ -39,6 +39,10 @@ namespace boost { namespace fusion first_type first; transform_type f; + + private: + // silence MSVC warning C4512: assignment operator could not be generated + transform_view_iterator& operator= (transform_view_iterator const&); }; // Binary Version @@ -62,6 +66,10 @@ namespace boost { namespace fusion first1_type first1; first2_type first2; transform_type f; + + private: + // silence MSVC warning C4512: assignment operator could not be generated + transform_view_iterator2& operator= (transform_view_iterator2 const&); }; }} diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/advance_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/advance_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/advance_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/advance_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/begin_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/begin_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/begin_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/begin_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/deref_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/deref_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/deref_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/deref_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/distance_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/distance_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/distance_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/distance_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/end_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/end_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/end_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/end_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/equal_to_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/equal_to_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/equal_to_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/equal_to_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/next_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/next_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/next_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/next_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/prior_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/prior_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/prior_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/prior_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/size_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/size_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/size_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/size_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/value_at_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/value_at_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/value_at_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/value_at_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/value_of_impl.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/value_of_impl.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/detail/value_of_impl.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/detail/value_of_impl.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/zip_view.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/zip_view.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/zip_view.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/zip_view.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/zip_view_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/zip_view_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/zip_view_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/zip_view_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp b/deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp diff --git a/deal.II/contrib/boost/include/boost/generator_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/generator_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/generator_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/generator_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/get_pointer.hpp b/deal.II/contrib/boost-1.41.0/include/boost/get_pointer.hpp similarity index 69% rename from deal.II/contrib/boost/include/boost/get_pointer.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/get_pointer.hpp index 17d11b8fef..a0cd5c0b19 100644 --- a/deal.II/contrib/boost/include/boost/get_pointer.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/get_pointer.hpp @@ -5,7 +5,11 @@ #ifndef GET_POINTER_DWA20021219_HPP # define GET_POINTER_DWA20021219_HPP -# 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 namespace boost { diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/accounting.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/accounting.hpp new file mode 100644 index 0000000000..6643e75290 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/accounting.hpp @@ -0,0 +1,36 @@ +// Copyright 2005 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_ACCOUNTING_HPP +#define BOOST_GRAPH_ACCOUNTING_HPP + +#include +#include +#include +#include +#include + +namespace boost { namespace graph { namespace accounting { + +typedef double time_type; + +inline time_type get_time() +{ + return MPI_Wtime(); +} + +inline std::string print_time(time_type t) +{ + std::ostringstream out; + out << std::setiosflags(std::ios::fixed) << std::setprecision(2) << t; + return out.str(); +} + +} } } // end namespace boost::graph::accounting + +#endif // BOOST_GRAPH_ACCOUNTING_HPP diff --git a/deal.II/contrib/boost/include/boost/graph/adj_list_serialize.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/adj_list_serialize.hpp similarity index 88% rename from deal.II/contrib/boost/include/boost/graph/adj_list_serialize.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/adj_list_serialize.hpp index de6ce5c367..af0c0d8976 100644 --- a/deal.II/contrib/boost/include/boost/graph/adj_list_serialize.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/adj_list_serialize.hpp @@ -10,6 +10,7 @@ #define ADJ_LIST_SERIALIZE_HPP #include +#include #include #include #include @@ -49,18 +50,16 @@ inline void save( // 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) ); + BGL_FORALL_VERTICES_T(v, graph, Graph) { + indices[v] = num++; + ar << serialization::make_nvp("vertex_property", get(vertex_all_t(), graph, v) ); } // 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) ); + BGL_FORALL_EDGES_T(e, graph, Graph) { + ar << serialization::make_nvp("u" , indices[source(e,graph)]); + ar << serialization::make_nvp("v" , indices[target(e,graph)]); + ar << serialization::make_nvp("edge_property", get(edge_all_t(), graph, e) ); } } diff --git a/deal.II/contrib/boost/include/boost/graph/adjacency_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/adjacency_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/adjacency_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/adjacency_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/graph/adjacency_list.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/adjacency_list.hpp similarity index 83% rename from deal.II/contrib/boost/include/boost/graph/adjacency_list.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/adjacency_list.hpp index a60916a250..6ba8f435c0 100644 --- a/deal.II/contrib/boost/include/boost/graph/adjacency_list.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/adjacency_list.hpp @@ -17,6 +17,9 @@ #include #include +// TODO: Deprecating this requires some cooperation from Boost.Config. It's not +// a good idea to just refuse the inclusion because it could break otherwise +// functioning code. #if !defined BOOST_NO_HASH # ifdef BOOST_HASH_SET_HEADER # include BOOST_HASH_SET_HEADER @@ -34,8 +37,9 @@ #endif #include +#include #include -#include +#include #include #include #include @@ -44,6 +48,7 @@ #include #include #include +#include namespace boost { @@ -59,17 +64,20 @@ namespace boost { #if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #if !defined BOOST_NO_SLIST - struct slistS {}; + struct slistS {}; #endif struct vecS { }; struct listS { }; struct setS { }; - struct multisetS { }; struct mapS { }; + struct multisetS { }; + struct multimapS { }; #if !defined BOOST_NO_HASH - struct hash_mapS { }; struct hash_setS { }; + struct hash_mapS { }; + struct hash_multisetS { }; + struct hash_multimapS { }; #endif template @@ -105,16 +113,31 @@ namespace boost { typedef std::multiset type; }; + template + struct container_gen { + typedef std::multiset type; + }; + #if !defined BOOST_NO_HASH template - struct container_gen { + struct container_gen { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set type; }; template - struct container_gen { + struct container_gen { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set type; }; + + template + struct container_gen { + typedef BOOST_STD_EXTENSION_NAMESPACE::hash_multiset type; + }; + + template + struct container_gen { + typedef BOOST_STD_EXTENSION_NAMESPACE::hash_multiset type; + }; #endif #else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION @@ -131,37 +154,51 @@ namespace boost { struct bind_ { typedef std::vector type; }; }; - struct listS { + struct listS { template struct bind_ { typedef std::list type; }; }; - struct setS { + struct setS { + template + struct bind_ { typedef std::set > type; }; + }; + + + struct mapS { template struct bind_ { typedef std::set > type; }; }; - struct multisetS { + struct multisetS { + template + struct bind_ { typedef std::multiset > type; }; + }; + + struct multimapS { template struct bind_ { typedef std::multiset > type; }; }; #if !defined BOOST_NO_HASH - struct hash_setS { + struct hash_setS { template struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set > type; }; }; -#endif - struct mapS { + struct hash_mapS { template - struct bind_ { typedef std::set > type; }; + struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set > type; }; }; -#if !defined BOOST_NO_HASH - struct hash_mapS { + struct hash_multisetS { template - struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set > type; }; + struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_multiset > type; }; + }; + + struct hash_multimapS { + template + struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_multiset > type; }; }; #endif @@ -198,54 +235,54 @@ namespace boost { struct parallel_edge_traits { }; template <> - struct parallel_edge_traits { + struct parallel_edge_traits { typedef allow_parallel_edge_tag type; }; template <> - struct parallel_edge_traits { + struct parallel_edge_traits { typedef allow_parallel_edge_tag type; }; #if !defined BOOST_NO_SLIST template <> - struct parallel_edge_traits { + struct parallel_edge_traits { typedef allow_parallel_edge_tag type; }; #endif template <> - struct parallel_edge_traits { + struct parallel_edge_traits { typedef disallow_parallel_edge_tag type; }; template <> - struct parallel_edge_traits { + 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; + typedef disallow_parallel_edge_tag type; }; #endif // mapS is obsolete, replaced with setS template <> - struct parallel_edge_traits { + 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; + typedef disallow_parallel_edge_tag type; }; #endif namespace detail { - template struct is_random_access { + template struct is_random_access { enum { value = false}; typedef mpl::false_ type; }; template <> - struct is_random_access { - enum { value = true }; + struct is_random_access { + enum { value = true }; typedef mpl::true_ type; }; @@ -281,21 +318,20 @@ namespace boost { typedef typename parallel_edge_traits::type edge_parallel_category; + typedef std::size_t vertices_size_type; typedef void* vertex_ptr; typedef typename mpl::if_::type vertex_descriptor; + vertices_size_type, vertex_ptr>::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_, - VertexListS, OutEdgeListS, DirectedS, + VertexListS, OutEdgeListS, DirectedS, #if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) typename detail::retag_property_list::type, @@ -333,8 +369,16 @@ namespace boost { #else VertexProperty, EdgeProperty, #endif - GraphProperty, EdgeListS>::type + GraphProperty, EdgeListS>::type, + // Support for named vertices + public graph::maybe_named_graph< + adjacency_list, + typename adjacency_list_traits::vertex_descriptor, + VertexProperty> { + public: // TODO Remove me #if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) typedef typename detail::retag_property_list::retagged @@ -371,7 +415,7 @@ namespace boost { private: typedef adjacency_list self; typedef typename detail::adj_list_gen< - self, VertexListS, OutEdgeListS, DirectedS, + self, VertexListS, OutEdgeListS, DirectedS, vertex_property_type, edge_property_type, GraphProperty, EdgeListS >::type Base; @@ -389,7 +433,7 @@ namespace boost { typedef GraphProperty graph_property_type; - inline adjacency_list(const GraphProperty& p = GraphProperty()) + inline adjacency_list(const GraphProperty& p = GraphProperty()) : m_property(p) { } inline adjacency_list(const adjacency_list& x) @@ -405,7 +449,7 @@ namespace boost { } // Required by Mutable Graph - inline adjacency_list(vertices_size_type num_vertices, + inline adjacency_list(vertices_size_type num_vertices, const GraphProperty& p = GraphProperty()) : Base(num_vertices), m_property(p) { } @@ -434,6 +478,12 @@ namespace boost { *this = tmp; } + void clear() + { + this->clearing_graph(); + Base::clear(); + } + #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES // Directly access a vertex or edge bundle vertex_bundled& operator[](vertex_descriptor v) @@ -515,12 +565,12 @@ namespace boost { get(T Bundle::* p, adjacency_list& g) { - typedef typename property_map, T Bundle::*>::type result_type; return result_type(&g, p); } - + template inline @@ -529,7 +579,7 @@ namespace boost { get(T Bundle::* p, adjacency_list const & g) { - typedef typename property_map, T Bundle::*>::const_type result_type; return result_type(&g, p); @@ -557,6 +607,24 @@ namespace boost { #endif +// Mutability Traits +#define ADJLIST_PARAMS \ + typename OEL, typename VL, typename D, typename VP, typename EP, \ + typename GP, typename EL +#define ADJLIST adjacency_list +template +struct graph_mutability_traits { + typedef mutable_property_graph_tag category; +}; + +// Can't remove vertices from adjacency lists with VL==vecS +template +struct graph_mutability_traits< adjacency_list > { + typedef add_only_property_graph_tag category; +}; +#undef ADJLIST_PARAMS +#undef ADJLIST + } // namespace boost diff --git a/deal.II/contrib/boost/include/boost/graph/adjacency_list_io.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/adjacency_list_io.hpp similarity index 89% rename from deal.II/contrib/boost/include/boost/graph/adjacency_list_io.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/adjacency_list_io.hpp index fb762fe016..326d490d04 100644 --- a/deal.II/contrib/boost/include/boost/graph/adjacency_list_io.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/adjacency_list_io.hpp @@ -1,6 +1,6 @@ //======================================================================= // Copyright 2001 Universite Joseph Fourier, Grenoble. -// Author: François Faure +// Author: Francois Faure // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -12,6 +12,7 @@ #include #include #include +#include #include // Method read to parse an adjacency list from an input stream. Examples: @@ -211,13 +212,13 @@ struct PropertyPrinter PropertyPrinter( const Graph& g ):graph(&g){} - template - PropertyPrinter& operator () ( std::ostream& out, Iterator it ) + template + PropertyPrinter& operator () ( std::ostream& out, const Val& v ) { typename property_map::type ps = get(Tag(), *graph); - out << ps[ *it ] <<" "; + out << ps[ v ] <<" "; PropertyPrinter print(*graph); - print(out, it); + print(out, v); return (*this); } private: @@ -229,10 +230,10 @@ struct PropertyPrinter { PropertyPrinter( const Graph& g ):graph(&g){} - template - PropertyPrinter& operator () ( std::ostream& out, Iterator it ) + template + PropertyPrinter& operator () ( std::ostream& out, const Val& v ) { - out << (*graph)[ *it ] <<" "; + out << (*graph)[ v ] <<" "; return (*this); } private: @@ -244,13 +245,13 @@ struct PropertyPrinter > { PropertyPrinter( const Graph& g ):graph(&g){} - template - PropertyPrinter& operator () ( std::ostream& out, Iterator it ) + template + PropertyPrinter& operator () ( std::ostream& out, const Val& v ) { typename property_map::type ps = get(Tag(), *graph); - out << ps[ *it ] <<" "; + out << ps[ v ] <<" "; PropertyPrinter print(*graph); - print(out, it); + print(out, v); return (*this); } private: @@ -263,8 +264,8 @@ struct PropertyPrinter { PropertyPrinter( const Graph& ){} - template - PropertyPrinter& operator () ( std::ostream&, Iterator it ){ return *this; } + template + PropertyPrinter& operator () ( std::ostream&, const Val& ){ return *this; } }; // property printer @@ -287,18 +288,16 @@ struct EdgePrinter // 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++; + BGL_FORALL_VERTICES_T(v, graph, Graph) { + indices[v] = 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); + BGL_FORALL_EDGES_T(e, graph, Graph) { + out << indices[source(e,graph)] << " " << indices[target(e,graph)] << " "; + print_Edge(out,e); out << std::endl; } out << std::endl; @@ -322,9 +321,8 @@ struct GraphPrinter: public EdgePrinter { PropertyPrinter printNode(this->graph); out << "v"<::vertex_iterator vi; - for (vi = vertices(this->graph).first; vi != vertices(this->graph).second; ++vi){ - printNode(out,vi); + BGL_FORALL_VERTICES_T(v, this->graph, Graph) { + printNode(out,v); out << std::endl; } diff --git a/deal.II/contrib/boost/include/boost/graph/adjacency_matrix.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/adjacency_matrix.hpp similarity index 89% rename from deal.II/contrib/boost/include/boost/graph/adjacency_matrix.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/adjacency_matrix.hpp index 9770e51af7..cf02a1d644 100644 --- a/deal.II/contrib/boost/include/boost/graph/adjacency_matrix.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/adjacency_matrix.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -31,7 +32,7 @@ #include namespace boost { - + namespace detail { template @@ -40,7 +41,7 @@ namespace boost { typedef edge_desc_impl Base; public: matrix_edge_desc_impl() { } - matrix_edge_desc_impl(bool exists, Vertex s, Vertex d, + 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; } @@ -53,13 +54,15 @@ namespace boost { bool operator()(const Edge& e) const { return e.exists(); } }; + // Note to self... The int for get_edge_exists and set_edge exist helps + // make these calls unambiguous. template bool get_edge_exists(const std::pair& stored_edge, int) { return stored_edge.first; } template void set_edge_exists( - std::pair& stored_edge, + std::pair& stored_edge, bool flag, int ) { @@ -91,7 +94,7 @@ namespace boost { template inline void - set_property(std::pair& stored_edge, + set_property(std::pair& stored_edge, const EdgeProperty& ep, int) { stored_edge.second = ep; } @@ -107,7 +110,7 @@ namespace boost { template inline void set_property(EdgeProxy, const EdgeProperty&, ...) {} - + //======================================================================= // Directed Out Edge Iterator @@ -133,9 +136,9 @@ namespace boost { , EdgeDescriptor , std::ptrdiff_t > super_t; - + dir_adj_matrix_out_edge_iter() { } - + dir_adj_matrix_out_edge_iter( const MatrixIter& i , const VertexDescriptor& src @@ -148,11 +151,11 @@ namespace boost { ++this->base_reference(); ++m_targ; } - + inline EdgeDescriptor - dereference() const + dereference() const { - return EdgeDescriptor(get_edge_exists(*this->base(), 0), m_src, m_targ, + return EdgeDescriptor(get_edge_exists(*this->base(), 0), m_src, m_targ, &get_property(*this->base())); } VertexDescriptor m_src, m_targ; @@ -184,9 +187,9 @@ namespace boost { , EdgeDescriptor , std::ptrdiff_t > super_t; - + dir_adj_matrix_in_edge_iter() { } - + dir_adj_matrix_in_edge_iter( const MatrixIter& i , const MatrixIter& last @@ -204,11 +207,11 @@ namespace boost { this->base_reference() = m_last; } } - + inline EdgeDescriptor - dereference() const + dereference() const { - return EdgeDescriptor(get_edge_exists(*this->base(), 0), m_src, m_targ, + return EdgeDescriptor(get_edge_exists(*this->base(), 0), m_src, m_targ, &get_property(*this->base())); } MatrixIter m_last; @@ -223,7 +226,7 @@ namespace boost { typename VertexDescriptor, typename MatrixIter , typename VerticesSizeType, typename EdgeDescriptor > - struct undir_adj_matrix_out_edge_iter + struct undir_adj_matrix_out_edge_iter : iterator_adaptor< undir_adj_matrix_out_edge_iter , MatrixIter @@ -241,9 +244,9 @@ namespace boost { , EdgeDescriptor , std::ptrdiff_t > super_t; - + undir_adj_matrix_out_edge_iter() { } - + undir_adj_matrix_out_edge_iter( const MatrixIter& i , const VertexDescriptor& src @@ -269,16 +272,16 @@ namespace boost { } ++m_targ; } - + inline EdgeDescriptor - dereference() const + 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; }; @@ -290,7 +293,7 @@ namespace boost { typename VertexDescriptor, typename MatrixIter , typename VerticesSizeType, typename EdgeDescriptor > - struct undir_adj_matrix_in_edge_iter + struct undir_adj_matrix_in_edge_iter : iterator_adaptor< undir_adj_matrix_in_edge_iter , MatrixIter @@ -308,9 +311,9 @@ namespace boost { , EdgeDescriptor , std::ptrdiff_t > super_t; - + undir_adj_matrix_in_edge_iter() { } - + undir_adj_matrix_in_edge_iter( const MatrixIter& i , const VertexDescriptor& src @@ -336,16 +339,16 @@ namespace boost { } ++m_targ; } - + inline EdgeDescriptor - dereference() const + 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; }; @@ -353,7 +356,7 @@ namespace boost { //======================================================================= // Edge Iterator - template struct adj_matrix_edge_iter : iterator_adaptor< @@ -373,17 +376,17 @@ namespace boost { , EdgeDescriptor , std::ptrdiff_t > super_t; - + adj_matrix_edge_iter() { } - - adj_matrix_edge_iter(const MatrixIter& i, const MatrixIter& start, const VerticesSizeType& n) + + 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; @@ -397,7 +400,7 @@ namespace boost { ++m_targ; } } - + void increment_dispatch(MatrixIter& i, undirectedS) { ++i; @@ -413,14 +416,14 @@ namespace boost { } inline EdgeDescriptor - dereference() const + 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; }; @@ -444,9 +447,9 @@ namespace boost { 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 Traits; - + public: #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // The bidirectionalS tag is not allowed with the adjacency_matrix @@ -487,14 +490,14 @@ namespace boost { 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), @@ -509,6 +512,7 @@ namespace boost { typedef no_vertex_bundle vertex_bundled; typedef no_edge_bundle edge_bundled; #endif + typedef GraphProperty graph_property_type; public: // should be private typedef typename mpl::if_::type, @@ -534,7 +538,7 @@ namespace boost { { return (std::numeric_limits::max)(); } - + //private: if friends worked, these would be private typedef detail::dir_adj_matrix_out_edge_iter< @@ -560,11 +564,11 @@ namespace boost { 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 @@ -596,13 +600,52 @@ namespace boost { typedef adjacency_matrix_class_tag graph_tag; // Constructor required by MutableGraph - adjacency_matrix(vertices_size_type n_vertices) - : m_matrix(Directed::is_directed ? + adjacency_matrix(vertices_size_type n_vertices, + const GraphProperty& p = GraphProperty()) + : 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), + m_property(p) { } + + template + adjacency_matrix(EdgeIterator first, + EdgeIterator last, + vertices_size_type n_vertices, + const GraphProperty& p = GraphProperty()) + : 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) { } + m_num_edges(0), + m_property(p) + { + for (; first != last; ++first) { + add_edge(first->first, first->second, *this); + } + } + + template + adjacency_matrix(EdgeIterator first, + EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type n_vertices, + const GraphProperty& p = GraphProperty()) + : 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), + m_property(p) + { + for (; first != last; ++first, ++ep_iter) { + add_edge(first->first, first->second, *ep_iter, *this); + } + } #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES // Directly access a vertex or edge bundle @@ -618,7 +661,7 @@ namespace boost { 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 @@ -646,10 +689,11 @@ namespace boost { VertexList m_vertex_set; std::vector m_vertex_properties; size_type m_num_edges; + GraphProperty m_property; }; - + //========================================================================= - // Functions required by the AdjacencyMatrix concept + // Functions required by the AdjacencyMatrix concept template std::pair::edge_descriptor, @@ -665,7 +709,7 @@ namespace boost { } //========================================================================= - // Functions required by the IncidenceGraph concept + // Functions required by the IncidenceGraph concept // O(1) template @@ -685,7 +729,7 @@ namespace boost { , 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), + return std::make_pair(out_edge_iterator(pred, first, last), out_edge_iterator(pred, last, last)); } @@ -707,15 +751,15 @@ namespace boost { 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), + return std::make_pair(out_edge_iterator(pred, first, last), out_edge_iterator(pred, last, last)); } - + // O(N) - template + template typename adjacency_matrix::degree_size_type out_degree(typename adjacency_matrix::vertex_descriptor u, const adjacency_matrix& g) @@ -729,7 +773,7 @@ namespace boost { // O(1) template + typename Dir, typename Vertex> typename adjacency_matrix::vertex_descriptor source(const detail::matrix_edge_desc_impl& e, const adjacency_matrix&) @@ -739,7 +783,7 @@ namespace boost { // O(1) template + typename Dir, typename Vertex> typename adjacency_matrix::vertex_descriptor target(const detail::matrix_edge_desc_impl& e, const adjacency_matrix&) @@ -748,7 +792,7 @@ namespace boost { } //========================================================================= - // Functions required by the BidirectionalGraph concept + // Functions required by the BidirectionalGraph concept // O(1) template @@ -767,7 +811,7 @@ namespace boost { , 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), + return std::make_pair(in_edge_iterator(pred, first, last), in_edge_iterator(pred, last, last)); } @@ -789,15 +833,15 @@ namespace boost { 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), + return std::make_pair(in_edge_iterator(pred, first, last), in_edge_iterator(pred, last, last)); } - + // O(N) - template + template typename adjacency_matrix::degree_size_type in_degree(typename adjacency_matrix::vertex_descriptor u, const adjacency_matrix& g) @@ -810,7 +854,7 @@ namespace boost { } //========================================================================= - // Functions required by the AdjacencyGraph concept + // Functions required by the AdjacencyGraph concept template std::pair::adjacency_iterator, @@ -830,7 +874,7 @@ namespace boost { } //========================================================================= - // Functions required by the VertexListGraph concept + // Functions required by the VertexListGraph concept template std::pair::vertex_iterator, @@ -846,10 +890,10 @@ namespace boost { num_vertices(const adjacency_matrix& g) { return g.m_vertex_set.size(); } - + //========================================================================= - // Functions required by the EdgeListGraph concept - + // Functions required by the EdgeListGraph concept + template std::pair::edge_iterator, typename adjacency_matrix::edge_iterator> @@ -857,11 +901,11 @@ namespace boost { { typedef adjacency_matrix Graph; Graph& g = const_cast(g_); - + typename Graph::unfiltered_edge_iter - first(g.m_matrix.begin(), g.m_matrix.begin(), + first(g.m_matrix.begin(), g.m_matrix.begin(), g.m_vertex_set.size()), - last(g.m_matrix.end(), g.m_matrix.begin(), + 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; @@ -876,9 +920,9 @@ namespace boost { { return g.m_num_edges; } - + //========================================================================= - // Functions required by the MutableGraph concept + // Functions required by the MutableGraph concept // O(1) template @@ -888,14 +932,14 @@ namespace boost { const EP& ep, adjacency_matrix& g) { - typedef typename adjacency_matrix::edge_descriptor + 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))), + (edge_descriptor(true, u, v, &detail::get_property(g.get_edge(u,v))), true); } else return std::make_pair @@ -913,15 +957,18 @@ namespace boost { return add_edge(u, v, ep, g); } - // O(1) + // 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); + // Don'remove the edge unless it already exists. + if(detail::get_edge_exists(g.get_edge(u,v), 0)) { + --(g.m_num_edges); + detail::set_edge_exists(g.get_edge(u,v), false, 0); + } } // O(1) @@ -933,7 +980,7 @@ namespace boost { remove_edge(source(e, g), target(e, g), g); } - + template inline typename adjacency_matrix::vertex_descriptor add_vertex(adjacency_matrix& g) { @@ -966,7 +1013,7 @@ namespace boost { (typename adjacency_matrix::vertex_descriptor u, adjacency_matrix& g) { - typename adjacency_matrix::vertex_iterator + typename adjacency_matrix::vertex_iterator vi, vi_end; for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) remove_edge(u, *vi, g); @@ -987,12 +1034,43 @@ namespace boost { remove_edge(u, *vi, g); } + //========================================================================= + // Functions required by the PropertyGraph concept + + // O(1) + template + inline void + set_property(adjacency_matrix& g, Tag, const Value& value) + { + get_property_value(g.m_property, Tag()) = value; + } + + template + inline + typename graph_property, Tag>::type& + get_property(adjacency_matrix& g, Tag) + { + return get_property_value(g.m_property, Tag()); + } + + template + inline + const + typename graph_property, Tag>::type& + get_property(const adjacency_matrix& g, Tag) + { + return get_property_value(g.m_property, Tag()); + } + //========================================================================= // Vertex Property Map - - template - class adj_matrix_vertex_property_map + + template + class adj_matrix_vertex_property_map : public put_get_helper > { @@ -1031,10 +1109,10 @@ namespace boost { 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; }; }; @@ -1079,14 +1157,14 @@ namespace boost { struct vertex_property_selector { typedef detail::adj_matrix_vertex_property_selector type; }; - + //========================================================================= // Edge Property Map - template - class adj_matrix_edge_property_map + template + class adj_matrix_edge_property_map : public put_get_helper > { @@ -1121,56 +1199,56 @@ namespace boost { namespace detail { - template - typename boost::property_map, + typename boost::property_map, Property>::type get_dispatch(adjacency_matrix& g, Property, vertex_property_tag) { typedef adjacency_matrix Graph; - typedef typename boost::property_map, + typedef typename boost::property_map, Property>::type PA; return PA(&g); } - template - typename boost::property_map, + typename boost::property_map, Property>::type get_dispatch(adjacency_matrix&, Property, edge_property_tag) { - typedef typename boost::property_map, + typedef typename boost::property_map, Property>::type PA; return PA(); } - template - typename boost::property_map, + 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, + typedef typename boost::property_map, Property>::const_type PA; return PA(&g); } - template - typename boost::property_map, + typename boost::property_map, Property>::const_type get_dispatch(const adjacency_matrix&, Property, edge_property_tag) { - typedef typename boost::property_map, + typedef typename boost::property_map, Property>::const_type PA; return PA(); } } // namespace detail - template inline typename property_map, Property>::type @@ -1180,7 +1258,7 @@ namespace boost { return detail::get_dispatch(g, p, Kind()); } - template inline typename property_map, Property>::const_type @@ -1190,7 +1268,7 @@ namespace boost { return detail::get_dispatch(g, p, Kind()); } - template inline typename property_traits< @@ -1202,7 +1280,7 @@ namespace boost { return get(get(p, g), key); } - template inline void put(Property p, adjacency_matrix& g, @@ -1213,11 +1291,11 @@ namespace boost { Map pmap = get(p, g); put(pmap, key, value); } - + //========================================================================= // Other Functions - template + template typename adjacency_matrix::vertex_descriptor vertex(typename adjacency_matrix::vertices_size_type n, const adjacency_matrix& g) @@ -1252,7 +1330,7 @@ namespace boost { result_type; return result_type(&g, p); } - + template inline T @@ -1273,6 +1351,17 @@ namespace boost { #endif +#define ADJMAT_PARAMS \ + typename D, typename VP, typename EP, typename GP, typename A +#define ADJMAT adjacency_matrix +template +struct graph_mutability_traits { + typedef mutable_edge_property_graph_tag category; +}; +#undef ADJMAT_PARAMS +#undef ADJMAT + + } // namespace boost #endif // BOOST_ADJACENCY_MATRIX_HPP diff --git a/deal.II/contrib/boost/include/boost/graph/astar_search.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/astar_search.hpp similarity index 84% rename from deal.II/contrib/boost/include/boost/graph/astar_search.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/astar_search.hpp index e1b95c4aaa..25342e82e6 100644 --- a/deal.II/contrib/boost/include/boost/graph/astar_search.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/astar_search.hpp @@ -15,18 +15,20 @@ #include +#include #include #include -#include #include -#include #include #include +#include +#include +#include namespace boost { - + template struct AStarHeuristicConcept { void constraints() @@ -37,8 +39,8 @@ namespace boost { Heuristic h; typename graph_traits::vertex_descriptor u; }; - - + + template class astar_heuristic : public std::unary_function< typename graph_traits::vertex_descriptor, CostType> @@ -48,9 +50,9 @@ namespace boost { astar_heuristic() {} CostType operator()(Vertex u) { return static_cast(0); } }; - - + + template struct AStarVisitorConcept { void constraints() @@ -70,22 +72,22 @@ namespace boost { 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()); + invoke_visitors(this->m_vis, e, g, on_edge_not_relaxed()); } private: template @@ -99,10 +101,10 @@ namespace boost { 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, @@ -124,8 +126,8 @@ namespace boost { : 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); @@ -143,16 +145,16 @@ namespace boost { m_vis.finish_vertex(u, g); } template - void examine_edge(Edge e, Graph& g) { + 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, @@ -166,24 +168,14 @@ namespace boost { } 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))) { + if(m_decreased) { put(m_cost, target(e, g), m_combine(get(m_distance, target(e, g)), m_h(target(e, g)))); @@ -192,17 +184,14 @@ namespace boost { } 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))) { + if(m_decreased) { m_vis.edge_relaxed(e, g); put(m_cost, target(e, g), m_combine(get(m_distance, target(e, g)), @@ -213,9 +202,9 @@ namespace boost { } else m_vis.edge_not_relaxed(e, g); } - - - + + + AStarHeuristic m_h; UniformCostVisitor m_vis; UpdatableQueue& m_Q; @@ -228,13 +217,13 @@ namespace boost { BinaryPredicate m_compare; bool m_decreased; C m_zero; - + }; - + } // namespace detail - - + + template IndirectCmp; - IndirectCmp icmp(cost, compare); - typedef typename graph_traits::vertex_descriptor Vertex; - typedef mutable_queue, - IndirectCmp, VertexIndexMap> + typedef boost::vector_property_map IndexInHeapMap; + IndexInHeapMap index_in_heap; + typedef d_ary_heap_indirect MutableQueue; - MutableQueue Q(num_vertices(g), icmp, index_map); - + MutableQueue Q(cost, index_in_heap, compare); + 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 ::value_type ColorValue; typedef color_traits Color; typename graph_traits::vertex_iterator ui, ui_end; @@ -305,15 +292,15 @@ namespace boost { } 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 @@ -356,30 +343,21 @@ namespace boost { 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; - + std::vector distance_map; + std::vector cost_map; + std::vector color_map; + 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])), + choose_param(cost, vector_property_map(index_map)), + choose_param(distance, vector_property_map(index_map)), weight, index_map, - choose_param(color, make_iterator_property_map - (color_map.begin(), index_map, c)), + choose_param(color, vector_property_map(index_map)), params); } } // namespace detail - - + + // Named parameter interface template ::vertex_descriptor s, AStarHeuristic h, const bgl_named_params& params) { - + detail::astar_dispatch1 (g, s, h, get_param(params, vertex_rank), @@ -399,9 +377,9 @@ namespace boost { 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/graph/bandwidth.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/bandwidth.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/bandwidth.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/bandwidth.hpp diff --git a/deal.II/contrib/boost/include/boost/graph/bc_clustering.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/bc_clustering.hpp similarity index 94% rename from deal.II/contrib/boost/include/boost/graph/bc_clustering.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/bc_clustering.hpp index eb438c1425..6f4bbf40b8 100644 --- a/deal.II/contrib/boost/include/boost/graph/bc_clustering.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/bc_clustering.hpp @@ -11,10 +11,11 @@ #include #include +#include #include #include #include -#include +#include namespace boost { @@ -116,7 +117,7 @@ betweenness_centrality_clustering(MutableGraph& g, Done done, typedef typename graph_traits::vertices_size_type vertices_size_type; - if (edges(g).first == edges(g).second) return; + if (has_no_edges(g)) return; // Function object that compares the centrality of edges indirect_cmp > @@ -127,10 +128,11 @@ betweenness_centrality_clustering(MutableGraph& g, Done done, 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); + std::pair edges_iters = edges(g); + edge_descriptor e = *max_element(edges_iters.first, edges_iters.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); + } while (!is_done && !has_no_edges(g)); } /** diff --git a/deal.II/contrib/boost/include/boost/graph/bellman_ford_shortest_paths.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/bellman_ford_shortest_paths.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/bellman_ford_shortest_paths.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/bellman_ford_shortest_paths.hpp diff --git a/deal.II/contrib/boost/include/boost/graph/betweenness_centrality.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/betweenness_centrality.hpp similarity index 93% rename from deal.II/contrib/boost/include/boost/graph/betweenness_centrality.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/betweenness_centrality.hpp index 0262ad9741..06b7be0622 100644 --- a/deal.II/contrib/boost/include/boost/graph/betweenness_centrality.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/betweenness_centrality.hpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -19,7 +20,7 @@ #include #include #include -#include +#include #include #include @@ -369,7 +370,8 @@ brandes_betweenness_centrality(const Graph& g, DistanceMap distance, // d DependencyMap dependency, // delta PathCountMap path_count, // sigma - VertexIndexMap vertex_index) + VertexIndexMap vertex_index + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { detail::graph::brandes_unweighted_shortest_paths shortest_paths; @@ -394,7 +396,8 @@ brandes_betweenness_centrality(const Graph& g, DependencyMap dependency, // delta PathCountMap path_count, // sigma VertexIndexMap vertex_index, - WeightMap weight_map) + WeightMap weight_map + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { detail::graph::brandes_dijkstra_shortest_paths shortest_paths(weight_map); @@ -417,6 +420,7 @@ namespace detail { namespace graph { WeightMap weight_map, VertexIndexMap vertex_index) { + typedef typename graph_traits::degree_size_type degree_size_type; typedef typename graph_traits::vertex_descriptor vertex_descriptor; typedef typename graph_traits::edge_descriptor edge_descriptor; typedef typename mpl::if_c<(is_same > incoming(V); std::vector distance(V); std::vector dependency(V); - std::vector path_count(V); + std::vector path_count(V); brandes_betweenness_centrality( g, centrality, edge_centrality_map, @@ -452,6 +456,7 @@ namespace detail { namespace graph { EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index) { + typedef typename graph_traits::degree_size_type degree_size_type; typedef typename graph_traits::vertex_descriptor vertex_descriptor; typedef typename graph_traits::edge_descriptor edge_descriptor; typedef typename mpl::if_c<(is_same > incoming(V); std::vector distance(V); std::vector dependency(V); - std::vector path_count(V); + std::vector path_count(V); brandes_betweenness_centrality( g, centrality, edge_centrality_map, @@ -507,12 +512,23 @@ namespace detail { namespace graph { } }; + template + struct is_bgl_named_params { + BOOST_STATIC_CONSTANT(bool, value = false); + }; + + template + struct is_bgl_named_params > { + BOOST_STATIC_CONSTANT(bool, value = true); + }; + } } // end namespace detail::graph template void brandes_betweenness_centrality(const Graph& g, - const bgl_named_params& params) + const bgl_named_params& params + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { typedef bgl_named_params named_params; @@ -527,9 +543,13 @@ brandes_betweenness_centrality(const Graph& g, get_param(params, edge_weight)); } +// disable_if is required to work around problem with MSVC 7.1 (it seems to not +// get partial ordering getween this overload and the previous one correct) template -void -brandes_betweenness_centrality(const Graph& g, CentralityMap centrality) +typename disable_if, + void>::type +brandes_betweenness_centrality(const Graph& g, CentralityMap centrality + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { detail::graph::brandes_betweenness_centrality_dispatch2( g, centrality, dummy_property_map(), get(vertex_index, g)); @@ -538,7 +558,8 @@ brandes_betweenness_centrality(const Graph& g, CentralityMap centrality) template void brandes_betweenness_centrality(const Graph& g, CentralityMap centrality, - EdgeCentralityMap edge_centrality_map) + EdgeCentralityMap edge_centrality_map + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { detail::graph::brandes_betweenness_centrality_dispatch2( g, centrality, edge_centrality_map, get(vertex_index, g)); @@ -568,7 +589,8 @@ relative_betweenness_centrality(const Graph& g, CentralityMap centrality) // Compute the central point dominance of a graph. template typename property_traits::value_type -central_point_dominance(const Graph& g, CentralityMap centrality) +central_point_dominance(const Graph& g, CentralityMap centrality + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { using std::max; diff --git a/deal.II/contrib/boost/include/boost/graph/biconnected_components.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/biconnected_components.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/graph/biconnected_components.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/biconnected_components.hpp index 2d8b271d88..ac220659d0 100644 --- a/deal.II/contrib/boost/include/boost/graph/biconnected_components.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/biconnected_components.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include diff --git a/deal.II/contrib/boost/include/boost/graph/boyer_myrvold_planar_test.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/boyer_myrvold_planar_test.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/boyer_myrvold_planar_test.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/boyer_myrvold_planar_test.hpp diff --git a/deal.II/contrib/boost/include/boost/graph/breadth_first_search.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/breadth_first_search.hpp similarity index 78% rename from deal.II/contrib/boost/include/boost/graph/breadth_first_search.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/breadth_first_search.hpp index d8ffd7fed5..1cf06cf7e1 100644 --- a/deal.II/contrib/boost/include/boost/graph/breadth_first_search.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/breadth_first_search.hpp @@ -21,6 +21,13 @@ #include #include #include +#include +#include +#include + +#ifdef BOOST_GRAPH_USE_MPI +#include +#endif // BOOST_GRAPH_USE_MPI namespace boost { @@ -100,6 +107,8 @@ namespace boost { breadth_first_visit(g, s, Q, vis, color); } + namespace graph { struct bfs_visitor_event_not_overridden {}; } + template class bfs_visitor { @@ -108,40 +117,75 @@ namespace boost { bfs_visitor(Visitors vis) : m_vis(vis) { } template - void initialize_vertex(Vertex u, Graph& g) { + graph::bfs_visitor_event_not_overridden + initialize_vertex(Vertex u, Graph& g) + { invoke_visitors(m_vis, u, g, ::boost::on_initialize_vertex()); + return graph::bfs_visitor_event_not_overridden(); } + template - void discover_vertex(Vertex u, Graph& g) { + graph::bfs_visitor_event_not_overridden + discover_vertex(Vertex u, Graph& g) + { invoke_visitors(m_vis, u, g, ::boost::on_discover_vertex()); + return graph::bfs_visitor_event_not_overridden(); } + template - void examine_vertex(Vertex u, Graph& g) { + graph::bfs_visitor_event_not_overridden + examine_vertex(Vertex u, Graph& g) + { invoke_visitors(m_vis, u, g, ::boost::on_examine_vertex()); + return graph::bfs_visitor_event_not_overridden(); } + template - void examine_edge(Edge e, Graph& g) { + graph::bfs_visitor_event_not_overridden + examine_edge(Edge e, Graph& g) + { invoke_visitors(m_vis, e, g, ::boost::on_examine_edge()); + return graph::bfs_visitor_event_not_overridden(); } + template - void tree_edge(Edge e, Graph& g) { + graph::bfs_visitor_event_not_overridden + tree_edge(Edge e, Graph& g) + { invoke_visitors(m_vis, e, g, ::boost::on_tree_edge()); + return graph::bfs_visitor_event_not_overridden(); } + template - void non_tree_edge(Edge e, Graph& g) { + graph::bfs_visitor_event_not_overridden + non_tree_edge(Edge e, Graph& g) + { invoke_visitors(m_vis, e, g, ::boost::on_non_tree_edge()); + return graph::bfs_visitor_event_not_overridden(); } + template - void gray_target(Edge e, Graph& g) { + graph::bfs_visitor_event_not_overridden + gray_target(Edge e, Graph& g) + { invoke_visitors(m_vis, e, g, ::boost::on_gray_target()); + return graph::bfs_visitor_event_not_overridden(); } + template - void black_target(Edge e, Graph& g) { + graph::bfs_visitor_event_not_overridden + black_target(Edge e, Graph& g) + { invoke_visitors(m_vis, e, g, ::boost::on_black_target()); + return graph::bfs_visitor_event_not_overridden(); } + template - void finish_vertex(Vertex u, Graph& g) { + graph::bfs_visitor_event_not_overridden + finish_vertex(Vertex u, Graph& g) + { invoke_visitors(m_vis, u, g, ::boost::on_finish_vertex()); + return graph::bfs_visitor_event_not_overridden(); } BOOST_GRAPH_EVENT_STUB(on_initialize_vertex,bfs) @@ -174,20 +218,34 @@ namespace boost { typename graph_traits::vertex_descriptor s, ColorMap color, BFSVisitor vis, - const bgl_named_params& params) + const bgl_named_params& params, + BOOST_GRAPH_ENABLE_IF_MODELS(VertexListGraph, vertex_list_graph_tag, + void)* = 0) { 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, + choose_param(get_param(params, buffer_param_t()), boost::ref(Q)).get(), vis, color); } +#ifdef BOOST_GRAPH_USE_MPI + template + void bfs_helper + (DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + ColorMap color, + BFSVisitor vis, + const bgl_named_params& params, + BOOST_GRAPH_ENABLE_IF_MODELS(DistributedGraph, distributed_graph_tag, + void)* = 0); +#endif // BOOST_GRAPH_USE_MPI + //------------------------------------------------------------------------- // Choose between default color and color parameters. Using // function dispatching so that we don't require vertex index if @@ -219,16 +277,14 @@ namespace boost { 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(), + make_two_bit_color_map + (num_vertices(g), choose_const_pmap(get_param(params, vertex_index), - g, vertex_index), c), + g, vertex_index)), choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_vis)), params); @@ -276,11 +332,10 @@ namespace boost { 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, buffer_param_t()), boost::ref(Q)).get(), choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_visitor())), choose_pmap(get_param(params, vertex_color), ng, vertex_color) @@ -289,5 +344,9 @@ namespace boost { } // namespace boost +#ifdef BOOST_GRAPH_USE_MPI +# include +#endif + #endif // BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/bron_kerbosch_all_cliques.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/bron_kerbosch_all_cliques.hpp new file mode 100644 index 0000000000..bf7e3ff429 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/bron_kerbosch_all_cliques.hpp @@ -0,0 +1,311 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_CLIQUE_HPP +#define BOOST_GRAPH_CLIQUE_HPP + +#include +#include +#include + +#include + +#include +namespace boost { + namespace concepts { + BOOST_concept(CliqueVisitor,(Visitor)(Clique)(Graph)) + { + BOOST_CONCEPT_USAGE(CliqueVisitor) + { + vis.clique(k, g); + } + private: + Visitor vis; + Graph g; + Clique k; + }; + } /* namespace concepts */ +using concepts::CliqueVisitorConcept; +} /* namespace boost */ +#include + +namespace boost +{ +// The algorithm implemented in this paper is based on the so-called +// Algorithm 457, published as: +// +// @article{362367, +// author = {Coen Bron and Joep Kerbosch}, +// title = {Algorithm 457: finding all cliques of an undirected graph}, +// journal = {Communications of the ACM}, +// volume = {16}, +// number = {9}, +// year = {1973}, +// issn = {0001-0782}, +// pages = {575--577}, +// doi = {http://doi.acm.org/10.1145/362342.362367}, +// publisher = {ACM Press}, +// address = {New York, NY, USA}, +// } +// +// Sort of. This implementation is adapted from the 1st version of the +// algorithm and does not implement the candidate selection optimization +// described as published - it could, it just doesn't yet. +// +// The algorithm is given as proportional to (3.14)^(n/3) power. This is +// not the same as O(...), but based on time measures and approximation. +// +// Unfortunately, this implementation may be less efficient on non- +// AdjacencyMatrix modeled graphs due to the non-constant implementation +// of the edge(u,v,g) functions. +// +// TODO: It might be worthwhile to provide functionality for passing +// a connectivity matrix to improve the efficiency of those lookups +// when needed. This could simply be passed as a BooleanMatrix +// s.t. edge(u,v,B) returns true or false. This could easily be +// abstracted for adjacency matricies. +// +// The following paper is interesting for a number of reasons. First, +// it lists a number of other such algorithms and second, it describes +// a new algorithm (that does not appear to require the edge(u,v,g) +// function and appears fairly efficient. It is probably worth investigating. +// +// @article{DBLP:journals/tcs/TomitaTT06, +// author = {Etsuji Tomita and Akira Tanaka and Haruhisa Takahashi}, +// title = {The worst-case time complexity for generating all maximal cliques and computational experiments}, +// journal = {Theor. Comput. Sci.}, +// volume = {363}, +// number = {1}, +// year = {2006}, +// pages = {28-42} +// ee = {http://dx.doi.org/10.1016/j.tcs.2006.06.015} +// } + +/** + * The default clique_visitor supplies an empty visitation function. + */ +struct clique_visitor +{ + template + void clique(const VertexSet&, Graph&) + { } +}; + +/** + * The max_clique_visitor records the size of the maximum clique (but not the + * clique itself). + */ +struct max_clique_visitor +{ + max_clique_visitor(std::size_t& max) + : maximum(max) + { } + + template + inline void clique(const Clique& p, const Graph& g) + { + BOOST_USING_STD_MAX(); + maximum = max BOOST_PREVENT_MACRO_SUBSTITUTION (maximum, p.size()); + } + std::size_t& maximum; +}; + +inline max_clique_visitor find_max_clique(std::size_t& max) +{ return max_clique_visitor(max); } + +namespace detail +{ + template + inline bool + is_connected_to_clique(const Graph& g, + typename graph_traits::vertex_descriptor u, + typename graph_traits::vertex_descriptor v, + typename graph_traits::undirected_category) + { + function_requires< AdjacencyMatrixConcept >(); + + return edge(u, v, g).second; + } + + template + inline bool + is_connected_to_clique(const Graph& g, + typename graph_traits::vertex_descriptor u, + typename graph_traits::vertex_descriptor v, + typename graph_traits::directed_category) + { + function_requires< AdjacencyMatrixConcept >(); + // Note that this could alternate between using an || to determine + // full connectivity. I believe that this should produce strongly + // connected components. Note that using && instead of || will + // change the results to a fully connected subgraph (i.e., symmetric + // edges between all vertices s.t., if a->b, then b->a. + return edge(u, v, g).second && edge(v, u, g).second; + } + + template + inline void + filter_unconnected_vertices(const Graph& g, + typename graph_traits::vertex_descriptor v, + const Container& in, + Container& out) + { + function_requires< GraphConcept >(); + + typename graph_traits::directed_category cat; + typename Container::const_iterator i, end = in.end(); + for(i = in.begin(); i != end; ++i) { + if(is_connected_to_clique(g, v, *i, cat)) { + out.push_back(*i); + } + } + } + + template < + typename Graph, + typename Clique, // compsub type + typename Container, // candidates/not type + typename Visitor> + void extend_clique(const Graph& g, + Clique& clique, + Container& cands, + Container& nots, + Visitor vis, + std::size_t min) + { + function_requires< GraphConcept >(); + function_requires< CliqueVisitorConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + + // Is there vertex in nots that is connected to all vertices + // in the candidate set? If so, no clique can ever be found. + // This could be broken out into a separate function. + { + typename Container::iterator ni, nend = nots.end(); + typename Container::iterator ci, cend = cands.end(); + for(ni = nots.begin(); ni != nend; ++ni) { + for(ci = cands.begin(); ci != cend; ++ci) { + // if we don't find an edge, then we're okay. + if(!edge(*ni, *ci, g).second) break; + } + // if we iterated all the way to the end, then *ni + // is connected to all *ci + if(ci == cend) break; + } + // if we broke early, we found *ni connected to all *ci + if(ni != nend) return; + } + + // TODO: the original algorithm 457 describes an alternative + // (albeit really complicated) mechanism for selecting candidates. + // The given optimizaiton seeks to bring about the above + // condition sooner (i.e., there is a vertex in the not set + // that is connected to all candidates). unfortunately, the + // method they give for doing this is fairly unclear. + + // basically, for every vertex in not, we should know how many + // vertices it is disconnected from in the candidate set. if + // we fix some vertex in the not set, then we want to keep + // choosing vertices that are not connected to that fixed vertex. + // apparently, by selecting fix point with the minimum number + // of disconnections (i.e., the maximum number of connections + // within the candidate set), then the previous condition wil + // be reached sooner. + + // there's some other stuff about using the number of disconnects + // as a counter, but i'm jot really sure i followed it. + + // TODO: If we min-sized cliques to visit, then theoretically, we + // should be able to stop recursing if the clique falls below that + // size - maybe? + + // otherwise, iterate over candidates and and test + // for maxmimal cliquiness. + typename Container::iterator i, j, end = cands.end(); + for(i = cands.begin(); i != cands.end(); ) { + Vertex candidate = *i; + + // add the candidate to the clique (keeping the iterator!) + // typename Clique::iterator ci = clique.insert(clique.end(), candidate); + clique.push_back(candidate); + + // remove it from the candidate set + i = cands.erase(i); + + // build new candidate and not sets by removing all vertices + // that are not connected to the current candidate vertex. + // these actually invert the operation, adding them to the new + // sets if the vertices are connected. its semantically the same. + Container new_cands, new_nots; + filter_unconnected_vertices(g, candidate, cands, new_cands); + filter_unconnected_vertices(g, candidate, nots, new_nots); + + if(new_cands.empty() && new_nots.empty()) { + // our current clique is maximal since there's nothing + // that's connected that we haven't already visited. If + // the clique is below our radar, then we won't visit it. + if(clique.size() >= min) { + vis.clique(clique, g); + } + } + else { + // recurse to explore the new candidates + extend_clique(g, clique, new_cands, new_nots, vis, min); + } + + // we're done with this vertex, so we need to move it + // to the nots, and remove the candidate from the clique. + nots.push_back(candidate); + clique.pop_back(); + } + } +} /* namespace detail */ + +template +inline void +bron_kerbosch_all_cliques(const Graph& g, Visitor vis, std::size_t min) +{ + function_requires< IncidenceGraphConcept >(); + function_requires< VertexListGraphConcept >(); + function_requires< VertexIndexGraphConcept >(); + function_requires< AdjacencyMatrixConcept >(); // Structural requirement only + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertex_iterator VertexIterator; + typedef std::vector VertexSet; + typedef std::deque Clique; + function_requires< CliqueVisitorConcept >(); + + // NOTE: We're using a deque to implement the clique, because it provides + // constant inserts and removals at the end and also a constant size. + + VertexIterator i, end; + tie(i, end) = vertices(g); + VertexSet cands(i, end); // start with all vertices as candidates + VertexSet nots; // start with no vertices visited + + Clique clique; // the first clique is an empty vertex set + detail::extend_clique(g, clique, cands, nots, vis, min); +} + +// NOTE: By default the minimum number of vertices per clique is set at 2 +// because singleton cliques aren't really very interesting. +template +inline void +bron_kerbosch_all_cliques(const Graph& g, Visitor vis) +{ bron_kerbosch_all_cliques(g, vis, 2); } + +template +inline std::size_t +bron_kerbosch_clique_number(const Graph& g) +{ + std::size_t ret = 0; + bron_kerbosch_all_cliques(g, find_max_clique(ret)); + return ret; +} + +} /* namespace boost */ + +#endif diff --git a/deal.II/contrib/boost/include/boost/graph/chrobak_payne_drawing.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/chrobak_payne_drawing.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/graph/chrobak_payne_drawing.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/chrobak_payne_drawing.hpp index 6fb7b56d91..9e3a2f368e 100644 --- a/deal.II/contrib/boost/include/boost/graph/chrobak_payne_drawing.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/chrobak_payne_drawing.hpp @@ -14,7 +14,7 @@ #include #include //for next and prior #include -#include +#include namespace boost @@ -193,8 +193,8 @@ namespace boost 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[v] = ((y[rightmost] + delta_p_q) - y[leftmost])/2; + y[v] = y[leftmost] + delta_x[v]; delta_x[rightmost] = delta_p_q - delta_x[v]; bool leftmost_and_rightmost_adjacent = right[leftmost] == rightmost; diff --git a/deal.II/contrib/boost/include/boost/graph/circle_layout.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/circle_layout.hpp similarity index 73% rename from deal.II/contrib/boost/include/boost/graph/circle_layout.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/circle_layout.hpp index 26387d14f5..9c6ca6ef57 100644 --- a/deal.II/contrib/boost/include/boost/graph/circle_layout.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/circle_layout.hpp @@ -9,8 +9,12 @@ #ifndef BOOST_GRAPH_CIRCLE_LAYOUT_HPP #define BOOST_GRAPH_CIRCLE_LAYOUT_HPP #include +#include #include #include +#include +#include +#include namespace boost { /** @@ -28,7 +32,8 @@ namespace boost { circle_graph_layout(const VertexListGraph& g, PositionMap position, Radius radius) { - const double pi = 3.14159; + BOOST_STATIC_ASSERT (property_traits::value_type::dimensions >= 2); + const double pi = boost::math::constants::pi(); #ifndef BOOST_NO_STDC_NAMESPACE using std::sin; @@ -40,14 +45,12 @@ namespace boost { 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); + double two_pi_over_n = 2. * pi / n; + BGL_FORALL_VERTICES_T(v, g, VertexListGraph) { + position[v][0] = radius * cos(i * two_pi_over_n); + position[v][1] = radius * sin(i * two_pi_over_n); + ++i; } } } // end namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/closeness_centrality.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/closeness_centrality.hpp new file mode 100644 index 0000000000..77cea7b0e7 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/closeness_centrality.hpp @@ -0,0 +1,157 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_CLOSENESS_CENTRALITY_HPP +#define BOOST_GRAPH_CLOSENESS_CENTRALITY_HPP + +#include +#include + +namespace boost +{ +template > +struct closeness_measure + : public geodesic_measure +{ + typedef geodesic_measure< Graph, DistanceType, ResultType> base_type; + typedef typename base_type::distance_type distance_type; + typedef typename base_type::result_type result_type; + + result_type operator ()(distance_type d, const Graph&) + { + function_requires< NumericValueConcept >(); + function_requires< NumericValueConcept >(); + function_requires< AdaptableUnaryFunctionConcept >(); + return (d == base_type::infinite_distance()) + ? base_type::zero_result() + : rec(result_type(d)); + } + Reciprocal rec; +}; + +template +inline closeness_measure< + Graph, typename property_traits::value_type, double, + detail::reciprocal > +measure_closeness(const Graph&, DistanceMap) +{ + typedef typename property_traits::value_type Distance; + return closeness_measure >(); +} + +template +inline closeness_measure< + Graph, typename property_traits::value_type, T, + detail::reciprocal > +measure_closeness(const Graph&, DistanceMap) +{ + typedef typename property_traits::value_type Distance; + return closeness_measure >(); +} + +template +inline closeness_measure< + Graph, typename property_traits::value_type, T, + Reciprocal> +measure_closeness(const Graph&, DistanceMap) +{ + typedef typename property_traits::value_type Distance; + return closeness_measure(); +} + +template +inline typename Measure::result_type +closeness_centrality(const Graph& g, + DistanceMap dist, + Measure measure, + Combinator combine) +{ + function_requires< VertexListGraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type Distance; + function_requires< NumericValueConcept >(); + function_requires< DistanceMeasureConcept >(); + + Distance n = detail::combine_distances(g, dist, combine, Distance(0)); + return measure(n, g); +} + +template +inline typename Measure::result_type +closeness_centrality(const Graph& g, DistanceMap dist, Measure measure) +{ + function_requires< GraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type Distance; + + return closeness_centrality(g, dist, measure, std::plus()); +} + +template +inline double closeness_centrality(const Graph& g, DistanceMap dist) +{ return closeness_centrality(g, dist, measure_closeness(g, dist)); } + +template +inline T closeness_centrality(const Graph& g, DistanceMap dist) +{ return closeness_centrality(g, dist, measure_closeness(g, dist)); } + +template +inline void +all_closeness_centralities(const Graph& g, + DistanceMatrixMap dist, + CentralityMap cent, + Measure measure) +{ + function_requires< VertexListGraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type DistanceMap; + function_requires< ReadablePropertyMapConcept >(); + function_requires< WritablePropertyMapConcept >(); + typedef typename property_traits::value_type Distance; + typedef typename property_traits::value_type Centrality; + + typename graph_traits::vertex_iterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + DistanceMap dm = get(dist, *i); + Centrality c = closeness_centrality(g, dm, measure); + put(cent, *i, c); + } +} + +template +inline void +all_closeness_centralities(const Graph& g, + DistanceMatrixMap dist, + CentralityMap cent) +{ + function_requires< GraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type DistanceMap; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type Distance; + typedef typename property_traits::value_type Result; + + all_closeness_centralities(g, dist, cent, measure_closeness(g, DistanceMap())); +} + +} /* namespace boost */ + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/clustering_coefficient.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/clustering_coefficient.hpp new file mode 100644 index 0000000000..c84c48027f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/clustering_coefficient.hpp @@ -0,0 +1,157 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP +#define BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP + +#include +#include +#include + +namespace boost +{ +namespace detail +{ + template + inline typename graph_traits::degree_size_type + possible_edges(const Graph& g, std::size_t k, directed_tag) + { + function_requires< GraphConcept >(); + typedef typename graph_traits::degree_size_type T; + return T(k) * (T(k) - 1); + } + + template + inline typename graph_traits::degree_size_type + possible_edges(const Graph& g, size_t k, undirected_tag) + { + // dirty little trick... + return possible_edges(g, k, directed_tag()) / 2; + } + + // This template matches directedS and bidirectionalS. + template + inline typename graph_traits::degree_size_type + count_edges(const Graph& g, + typename Graph::vertex_descriptor u, + typename Graph::vertex_descriptor v, + directed_tag) + + { + function_requires< AdjacencyMatrixConcept >(); + return (edge(u, v, g).second ? 1 : 0) + + (edge(v, u, g).second ? 1 : 0); + } + + // This template matches undirectedS + template + inline typename graph_traits::degree_size_type + count_edges(const Graph& g, + typename Graph::vertex_descriptor u, + typename Graph::vertex_descriptor v, + undirected_tag) + { + function_requires< AdjacencyMatrixConcept >(); + return edge(u, v, g).second ? 1 : 0; + } +} + +template +inline typename graph_traits::degree_size_type +num_paths_through_vertex(const Graph& g, Vertex v) +{ + function_requires< AdjacencyGraphConcept >(); + typedef typename graph_traits::directed_category Directed; + typedef typename graph_traits::adjacency_iterator AdjacencyIterator; + + // TODO: There should actually be a set of neighborhood functions + // for things like this (num_neighbors() would be great). + + AdjacencyIterator i, end; + tie(i, end) = adjacent_vertices(v, g); + std::size_t k = std::distance(i, end); + return detail::possible_edges(g, k, Directed()); +} + +template +inline typename graph_traits::degree_size_type +num_triangles_on_vertex(const Graph& g, Vertex v) +{ + function_requires< IncidenceGraphConcept >(); + function_requires< AdjacencyGraphConcept >(); + typedef typename graph_traits::degree_size_type Degree; + typedef typename graph_traits::directed_category Directed; + typedef typename graph_traits::adjacency_iterator AdjacencyIterator; + + // TODO: I might be able to reduce the requirement from adjacency graph + // to incidence graph by using out edges. + + Degree count(0); + AdjacencyIterator i, j, end; + for(tie(i, end) = adjacent_vertices(v, g); i != end; ++i) { + for(j = boost::next(i); j != end; ++j) { + count += detail::count_edges(g, *i, *j, Directed()); + } + } + return count; +} /* namespace detail */ + +template +inline T +clustering_coefficient(const Graph& g, Vertex v) +{ + T zero(0); + T routes = T(num_paths_through_vertex(g, v)); + return (routes > zero) ? + T(num_triangles_on_vertex(g, v)) / routes : zero; +} + +template +inline double +clustering_coefficient(const Graph& g, Vertex v) +{ return clustering_coefficient(g, v); } + +template +inline typename property_traits::value_type +all_clustering_coefficients(const Graph& g, ClusteringMap cm) +{ + function_requires< VertexListGraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertex_iterator VertexIterator; + function_requires< WritablePropertyMapConcept >(); + typedef typename property_traits::value_type Coefficient; + + Coefficient sum(0); + VertexIterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + Coefficient cc = clustering_coefficient(g, *i); + put(cm, *i, cc); + sum += cc; + } + return sum / Coefficient(num_vertices(g)); +} + +template +inline typename property_traits::value_type +mean_clustering_coefficient(const Graph& g, ClusteringMap cm) +{ + function_requires< VertexListGraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertex_iterator VertexIterator; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type Coefficient; + + Coefficient cc(0); + VertexIterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + cc += get(cm, *i); + } + return cc / Coefficient(num_vertices(g)); +} + +} /* namespace boost */ + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/compressed_sparse_row_graph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/compressed_sparse_row_graph.hpp new file mode 100644 index 0000000000..b4f013526d --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/compressed_sparse_row_graph.hpp @@ -0,0 +1,1680 @@ +// Copyright 2005-2009 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 +#if 0 +#include // For some debugging code below +#endif +#include +#include +#include // For keep_all +#include +#include +#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 + +#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE +#warning "Using deprecated BGL compressed sparse row graph interface --" +#warning "please see the documentation for the new interface and then" +#warning "#define BOOST_GRAPH_USE_NEW_CSR_INTERFACE before including" +#warning "" +#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE + +#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE +#define BOOST_GRAPH_USE_OLD_CSR_INTERFACE +#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; + +// A type (edges_are_sorted_t) and a value (edges_are_sorted) used to indicate +// that the edge list passed into the CSR graph is already sorted by source +// vertex. +enum edges_are_sorted_t {edges_are_sorted}; + +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE +// A type (edges_are_sorted_global_t) and a value (edges_are_sorted_global) +// used to indicate that the edge list passed into the CSR graph is already +// sorted by source vertex. +enum edges_are_sorted_global_t {edges_are_sorted_global}; + +// A type (edges_are_unsorted_t) and a value (edges_are_unsorted) used to +// indicate that the edge list passed into the CSR graph is not sorted by +// source vertex. This version caches the edge information in memory, and thus +// requires only a single pass over the input data. +enum edges_are_unsorted_t {edges_are_unsorted}; + +// A type (edges_are_unsorted_multi_pass_t) and a value +// (edges_are_unsorted_multi_pass) used to indicate that the edge list passed +// into the CSR graph is not sorted by source vertex. This version uses less +// memory but requires multi-pass capability on the iterators. +enum edges_are_unsorted_multi_pass_t {edges_are_unsorted_multi_pass}; + +// A type (edges_are_unsorted_multi_pass_global_t) and a value +// (edges_are_unsorted_multi_pass_global) used to indicate that the edge list +// passed into the CSR graph is not sorted by source vertex. This version uses +// less memory but requires multi-pass capability on the iterators. The +// global mapping and filtering is done here because it is often faster and it +// greatly simplifies handling of edge properties. +enum edges_are_unsorted_multi_pass_global_t {edges_are_unsorted_multi_pass_global}; + +// A type (construct_inplace_from_sources_and_targets_t) and a value +// (construct_inplace_from_sources_and_targets) used to indicate that mutable +// vectors of sources and targets (and possibly edge properties) are being used +// to construct the CSR graph. These vectors are sorted in-place and then the +// targets and properties are swapped into the graph data structure. +enum construct_inplace_from_sources_and_targets_t {construct_inplace_from_sources_and_targets}; + +// A type (construct_inplace_from_sources_and_targets_global_t) and a value +// (construct_inplace_from_sources_and_targets_global) used to indicate that +// mutable vectors of sources and targets (and possibly edge properties) are +// being used to construct the CSR graph. These vectors are sorted in-place +// and then the targets and properties are swapped into the graph data +// structure. It is assumed that global indices (for distributed CSR) are +// used, and a map is required to convert those to local indices. This +// constructor is intended for internal use by the various CSR graphs +// (sequential and distributed). +enum construct_inplace_from_sources_and_targets_global_t {construct_inplace_from_sources_and_targets_global}; + +// A type (edges_are_unsorted_global_t) and a value (edges_are_unsorted_global) +// used to indicate that the edge list passed into the CSR graph is not sorted +// by source vertex. The data is also stored using global vertex indices, and +// must be filtered to choose only local vertices. This constructor caches the +// edge information in memory, and thus requires only a single pass over the +// input data. This constructor is intended for internal use by the +// distributed CSR constructors. +enum edges_are_unsorted_global_t {edges_are_unsorted_global}; + +#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE + +/**************************************************************************** + * 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 +#define BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS \ + typename VertexProperty, typename EdgeProperty, \ + typename GraphProperty, typename Vertex, typename EdgeIndex +#define BOOST_DIR_CSR_GRAPH_TYPE \ + compressed_sparse_row_graph +#define BOOST_BIDIR_CSR_GRAPH_TEMPLATE_PARMS \ + typename VertexProperty, typename EdgeProperty, \ + typename GraphProperty, typename Vertex, typename EdgeIndex +#define BOOST_BIDIR_CSR_GRAPH_TYPE \ + compressed_sparse_row_graph + +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE +namespace detail { + template + struct default_construct_iterator: public boost::iterator_facade, T, boost::random_access_traversal_tag, const T&> { + typedef boost::iterator_facade, T, std::random_access_iterator_tag, const T&> base_type; + T saved_value; + const T& dereference() const {return saved_value;} + bool equal(default_construct_iterator i) const {return true;} + void increment() {} + void decrement() {} + void advance(typename base_type::difference_type) {} + typename base_type::difference_type distance_to(default_construct_iterator) const {return 0;} + }; + + template + struct compare_first { + Less less; + compare_first(Less less = Less()): less(less) {} + template + bool operator()(const Tuple& a, const Tuple& b) const { + return less(a.template get<0>(), b.template get<0>()); + } + }; + + template + struct my_tuple_get_class { + typedef const Result& result_type; + template + result_type operator()(const Tuple& t) const { + return t.template get(); + } + }; +} +#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE + +/** Compressed sparse row graph. + * + * Vertex and EdgeIndex should be unsigned integral types and should + * specialize numeric_limits. + */ +template +class compressed_sparse_row_graph; // Not defined + +template +class compressed_sparse_row_graph + : public detail::indexed_vertex_properties +{ + public: + typedef detail::indexed_vertex_properties + inherited_vertex_properties; + + public: + // For Property Graph + typedef GraphProperty graph_property_type; + + typedef detail::compressed_sparse_row_structure forward_type; + + public: + /* At this time, the compressed sparse row graph can only be used to + * create directed and bidirectional graphs. In the future, + * undirected CSR graphs will also be supported. + */ + // BOOST_STATIC_ASSERT((is_same::value)); + + // Concept requirements: + // For Graph + typedef Vertex vertex_descriptor; + typedef detail::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 + typedef detail::csr_out_edge_iterator out_edge_iterator; + typedef EdgeIndex degree_size_type; + + // For AdjacencyGraph + typedef typename std::vector::const_iterator adjacency_iterator; + + // For EdgeListGraph + typedef detail::csr_edge_iterator edge_iterator; + + // For BidirectionalGraph (not implemented) + typedef void in_edge_iterator; + + // For internal use + typedef csr_graph_tag graph_tag; + + typedef typename forward_type::inherited_edge_properties::edge_bundled edge_bundled; + typedef typename forward_type::inherited_edge_properties::edge_push_back_type edge_push_back_type; + typedef typename forward_type::inherited_edge_properties::edge_property_type edge_property_type; + + // Constructors + + // Default constructor: an empty graph. + compressed_sparse_row_graph(): m_property() {} + + // With numverts vertices + compressed_sparse_row_graph(vertices_size_type numverts) + : inherited_vertex_properties(numverts), m_forward(numverts) {} + +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + // From number of vertices and unsorted list of edges + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, numverts, identity_property_map(), keep_all()); + } + + // From number of vertices and unsorted list of edges, plus edge properties + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, ep_iter, numverts, identity_property_map(), keep_all()); + } + + // From number of vertices and unsorted list of edges, with filter and + // global-to-local map + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_global_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, numlocalverts, global_to_local, source_pred); + } + + // From number of vertices and unsorted list of edges, plus edge properties, + // with filter and global-to-local map + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_global_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, ep_iter, numlocalverts, global_to_local, source_pred); + } +#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE + +#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE + + // From number of vertices and sorted list of edges (deprecated + // interface) + template + compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + edges_size_type numedges = 0, + const GraphProperty& prop = GraphProperty()) + : m_property(prop) + { + m_forward.assign_from_sorted_edges(edge_begin, edge_end, identity_property_map(), keep_all(), numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // From number of vertices and sorted list of edges (deprecated + // interface) + 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()) + : m_property(prop) + { + m_forward.assign_from_sorted_edges(edge_begin, edge_end, ep_iter, identity_property_map(), keep_all(), numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + +#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE + + // From number of vertices and sorted list of edges (new interface) + template + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + edges_size_type numedges = 0, + const GraphProperty& prop = GraphProperty()) + : m_property(prop) + { + m_forward.assign_from_sorted_edges(edge_begin, edge_end, identity_property_map(), keep_all(), numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // From number of vertices and sorted list of edges (new interface) + template + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + edges_size_type numedges = 0, + const GraphProperty& prop = GraphProperty()) + : m_property(prop) + { + m_forward.assign_from_sorted_edges(edge_begin, edge_end, ep_iter, identity_property_map(), keep_all(), numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + // From number of vertices and sorted list of edges, filtered and global (new interface) + template + compressed_sparse_row_graph(edges_are_sorted_global_t, + InputIterator edge_begin, InputIterator edge_end, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : m_property(prop) + { + m_forward.assign_from_sorted_edges(edge_begin, edge_end, global_to_local, source_pred, numverts, 0); + inherited_vertex_properties::resize(numverts); + } + + // From number of vertices and sorted list of edges (new interface) + template + compressed_sparse_row_graph(edges_are_sorted_global_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : m_property(prop) + { + m_forward.assign_from_sorted_edges(edge_begin, edge_end, ep_iter, global_to_local, source_pred, numverts, 0); + inherited_vertex_properties::resize(numverts); + } + + // From number of vertices and mutable vectors of sources and targets; + // vectors are returned with unspecified contents but are guaranteed not to + // share storage with the constructed graph. + compressed_sparse_row_graph(construct_inplace_from_sources_and_targets_t, + std::vector& sources, + std::vector& targets, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + m_forward.assign_sources_and_targets_global(sources, targets, numverts, boost::identity_property_map()); + } + + // From number of vertices and mutable vectors of sources and targets, + // expressed with global vertex indices; vectors are returned with + // unspecified contents but are guaranteed not to share storage with the + // constructed graph. This constructor should only be used by the + // distributed CSR graph. + template + compressed_sparse_row_graph(construct_inplace_from_sources_and_targets_global_t, + std::vector& sources, + std::vector& targets, + vertices_size_type numlocalverts, + GlobalToLocal global_to_local, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_property(prop) + { + m_forward.assign_sources_and_targets_global(sources, targets, numlocalverts, global_to_local); + } + + // From number of vertices and mutable vectors of sources, targets, and edge + // properties; vectors are returned with unspecified contents but are + // guaranteed not to share storage with the constructed graph. + compressed_sparse_row_graph(construct_inplace_from_sources_and_targets_t, + std::vector& sources, + std::vector& targets, + std::vector& edge_props, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + m_forward.assign_sources_and_targets_global(sources, targets, edge_props, numverts, boost::identity_property_map()); + } + + // From number of vertices and mutable vectors of sources and targets and + // edge properties, expressed with global vertex indices; vectors are + // returned with unspecified contents but are guaranteed not to share + // storage with the constructed graph. This constructor should only be used + // by the distributed CSR graph. + template + compressed_sparse_row_graph(construct_inplace_from_sources_and_targets_global_t, + std::vector& sources, + std::vector& targets, + std::vector& edge_props, + vertices_size_type numlocalverts, + GlobalToLocal global_to_local, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_property(prop) + { + m_forward.assign_sources_and_targets_global(sources, targets, edge_props, numlocalverts, global_to_local); + } + + // From number of vertices and single-pass range of unsorted edges. Data is + // cached in coordinate form before creating the actual graph. + template + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + std::vector sources, targets; + boost::graph::detail::split_into_separate_coords + (edge_begin, edge_end, sources, targets); + m_forward.assign_sources_and_targets_global(sources, targets, numverts, boost::identity_property_map()); + } + + // From number of vertices and single-pass range of unsorted edges and + // single-pass range of edge properties. Data is cached in coordinate form + // before creating the actual graph. + template + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + std::vector sources, targets; + boost::graph::detail::split_into_separate_coords + (edge_begin, edge_end, sources, targets); + size_t numedges = sources.size(); + std::vector edge_props(numedges); + for (size_t i = 0; i < numedges; ++i) { + edge_props[i] = *ep_iter++; + } + m_forward.assign_sources_and_targets_global(sources, targets, edge_props, numverts, boost::identity_property_map()); + } + + // From number of vertices and single-pass range of unsorted edges. Data is + // cached in coordinate form before creating the actual graph. Edges are + // filtered and transformed for use in a distributed graph. + template + compressed_sparse_row_graph(edges_are_unsorted_global_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numlocalverts, + GlobalToLocal global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_property(prop) + { + std::vector sources, targets; + boost::graph::detail::split_into_separate_coords_filtered + (edge_begin, edge_end, sources, targets, source_pred); + m_forward.assign_sources_and_targets_global(sources, targets, numlocalverts, global_to_local); + } + + // From number of vertices and single-pass range of unsorted edges and + // single-pass range of edge properties. Data is cached in coordinate form + // before creating the actual graph. Edges are filtered and transformed for + // use in a distributed graph. + template + compressed_sparse_row_graph(edges_are_unsorted_global_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numlocalverts, + GlobalToLocal global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_property(prop) + { + std::vector sources, targets; + std::vector edge_props; + boost::graph::detail::split_into_separate_coords_filtered + (edge_begin, edge_end, ep_iter, sources, targets, edge_props, source_pred); + m_forward.assign_sources_and_targets_global(sources, targets, edge_props, numlocalverts, global_to_local); + } + +#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE + + + // Requires IncidenceGraph and a vertex index map + template + compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, + edges_size_type numedges) + : m_property() + { + assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires VertexListGraph and EdgeListGraph + template + compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi) + : m_property() + { + typename graph_traits::edges_size_type numedges = num_edges(g); + if (is_same::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires vertex index map plus requirements of previous constructor + template + explicit compressed_sparse_row_graph(const Graph& g) + : m_property() + { + typename graph_traits::edges_size_type numedges = num_edges(g); + if (is_same::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + assign(g, get(vertex_index, g), num_vertices(g), numedges); + } + + // From any graph (slow and uses a lot of memory) + // Requires IncidenceGraph and a vertex index map + // Internal helper function + // Note that numedges must be doubled for undirected source graphs + template + void + assign(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, edges_size_type numedges) + { + m_forward.assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires the above, plus VertexListGraph and EdgeListGraph + template + void assign(const Graph& g, const VertexIndexMap& vi) + { + typename graph_traits::edges_size_type numedges = num_edges(g); + if (is_same::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + m_forward.assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires the above, plus a vertex_index map. + template + void assign(const Graph& g) + { + typename graph_traits::edges_size_type numedges = num_edges(g); + if (is_same::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + m_forward.assign(g, get(vertex_index, g), numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + // Add edges from a sorted (smallest sources first) range of pairs and edge + // properties + template + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); + } + + template + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, identity_property_map()); + } + + // Add edges from a sorted (smallest sources first) range of pairs + template + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator()); + } + + template + void + add_edges_sorted_internal_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator(), global_to_local); + } + + template + void + add_edges_sorted_internal_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); + } + + // Add edges from a range of (source, target) pairs that are unsorted + template + inline void + add_edges_internal(InputIterator first, InputIterator last, + const GlobalToLocal& global_to_local) { + typedef compressed_sparse_row_graph Graph; + typedef typename boost::graph_traits::vertex_descriptor vertex_t; + typedef typename boost::graph_traits::vertices_size_type vertex_num; + typedef typename boost::graph_traits::edges_size_type edge_num; + typedef std::vector > edge_vector_t; + edge_vector_t new_edges(first, last); + if (new_edges.empty()) return; + std::sort(new_edges.begin(), new_edges.end()); + this->add_edges_sorted_internal_global(new_edges.begin(), new_edges.end(), global_to_local); + } + + template + inline void + add_edges_internal(InputIterator first, InputIterator last) { + this->add_edges_internal(first, last, identity_property_map()); + } + + // Add edges from a range of (source, target) pairs and edge properties that + // are unsorted + template + inline void + add_edges_internal(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end, + const GlobalToLocal& global_to_local) { + typedef compressed_sparse_row_graph Graph; + typedef typename boost::graph_traits::vertex_descriptor vertex_t; + typedef typename boost::graph_traits::vertices_size_type vertex_num; + typedef typename boost::graph_traits::edges_size_type edge_num; + typedef std::pair vertex_pair; + typedef std::vector< + boost::tuple > + edge_vector_t; + edge_vector_t new_edges + (boost::make_zip_iterator(boost::make_tuple(first, ep_iter)), + boost::make_zip_iterator(boost::make_tuple(last, ep_iter_end))); + if (new_edges.empty()) return; + std::sort(new_edges.begin(), new_edges.end(), + boost::detail::compare_first< + std::less >()); + m_forward.add_edges_sorted_internal + (boost::make_transform_iterator( + new_edges.begin(), + boost::detail::my_tuple_get_class<0, vertex_pair>()), + boost::make_transform_iterator( + new_edges.end(), + boost::detail::my_tuple_get_class<0, vertex_pair>()), + boost::make_transform_iterator( + new_edges.begin(), + boost::detail::my_tuple_get_class + <1, edge_bundled>()), + global_to_local); + } + + // Add edges from a range of (source, target) pairs and edge properties that + // are unsorted + template + inline void + add_edges_internal(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end) { + this->add_edges_internal(first, last, ep_iter, ep_iter_end, identity_property_map()); + } +#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE + + using inherited_vertex_properties::operator[]; + + // Directly access a edge or edge bundle + edge_push_back_type& operator[](const edge_descriptor& v) + { return m_forward.m_edge_properties[get(edge_index, *this, v)]; } + + const edge_push_back_type& operator[](const edge_descriptor& v) const + { return m_forward.m_edge_properties[get(edge_index, *this, v)]; } + + // private: non-portable, requires friend templates + inherited_vertex_properties& vertex_properties() {return *this;} + const inherited_vertex_properties& vertex_properties() const {return *this;} + typename forward_type::inherited_edge_properties& edge_properties() { return m_forward; } + const typename forward_type::inherited_edge_properties& edge_properties() const { return m_forward; } + + forward_type m_forward; + GraphProperty m_property; +}; + +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE +// Bidir is only supported in this mode +template +class compressed_sparse_row_graph + : public detail::indexed_vertex_properties +{ + public: + typedef detail::indexed_vertex_properties + inherited_vertex_properties; + + public: + // For Property Graph + typedef GraphProperty graph_property_type; + + typedef detail::compressed_sparse_row_structure forward_type; + typedef EdgeIndex /* typename boost::mpl::if_c, boost::no_property, EdgeIndex> */ backward_edge_property; + typedef detail::compressed_sparse_row_structure backward_type; + + public: + // Concept requirements: + // For Graph + typedef Vertex vertex_descriptor; + typedef detail::csr_edge_descriptor edge_descriptor; + typedef bidirectional_tag directed_category; + typedef allow_parallel_edge_tag edge_parallel_category; + + class traversal_category: public bidirectional_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 + typedef detail::csr_out_edge_iterator out_edge_iterator; + typedef EdgeIndex degree_size_type; + + // For AdjacencyGraph + typedef typename std::vector::const_iterator adjacency_iterator; + + // For EdgeListGraph + typedef detail::csr_edge_iterator edge_iterator; + + // For BidirectionalGraph (not implemented) + typedef detail::csr_in_edge_iterator in_edge_iterator; + + // For internal use + typedef csr_graph_tag graph_tag; + + typedef typename forward_type::inherited_edge_properties::edge_bundled edge_bundled; + typedef typename forward_type::inherited_edge_properties::edge_push_back_type edge_push_back_type; + typedef typename forward_type::inherited_edge_properties::edge_property_type edge_property_type; + + // Constructors + + // Default constructor: an empty graph. + compressed_sparse_row_graph(): m_property() {} + + // With numverts vertices + compressed_sparse_row_graph(vertices_size_type numverts) + : inherited_vertex_properties(numverts), + m_forward(numverts), m_backward(numverts) {} + + private: + + void set_up_backward_property_links() { + std::pair e = edges(*this); + m_backward.assign_unsorted_multi_pass_edges + (detail::transpose_edges( + detail::make_edge_to_index_pair_iter + (*this, get(vertex_index, *this), e.first)), + detail::transpose_edges( + detail::make_edge_to_index_pair_iter + (*this, get(vertex_index, *this), e.second)), + boost::counting_iterator(0), + m_forward.m_rowstart.size() - 1, + identity_property_map(), + keep_all()); + } + + public: + + // From number of vertices and unsorted list of edges + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, numverts, identity_property_map(), keep_all()); + set_up_backward_property_links(); + } + + // From number of vertices and unsorted list of edges, plus edge properties + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, ep_iter, numverts, identity_property_map(), keep_all()); + set_up_backward_property_links(); + } + + // From number of vertices and unsorted list of edges, with filter and + // global-to-local map + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_global_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, numlocalverts, global_to_local, source_pred); + set_up_backward_property_links(); + } + + // From number of vertices and unsorted list of edges, plus edge properties, + // with filter and global-to-local map + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_global_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, ep_iter, numlocalverts, global_to_local, source_pred); + set_up_backward_property_links(); + } + + // Requires IncidenceGraph and a vertex index map + template + compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, + edges_size_type numedges) + : m_property() + { + assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires VertexListGraph and EdgeListGraph + template + compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi) + : m_property() + { + typename graph_traits::edges_size_type numedges = num_edges(g); + if (is_same::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires vertex index map plus requirements of previous constructor + template + explicit compressed_sparse_row_graph(const Graph& g) + : m_property() + { + typename graph_traits::edges_size_type numedges = num_edges(g); + if (is_same::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + assign(g, get(vertex_index, g), num_vertices(g), numedges); + } + + // From any graph (slow and uses a lot of memory) + // Requires IncidenceGraph and a vertex index map + // Internal helper function + // Note that numedges must be doubled for undirected source graphs + template + void + assign(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, edges_size_type numedges) + { + m_forward.assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires the above, plus VertexListGraph and EdgeListGraph + template + void assign(const Graph& g, const VertexIndexMap& vi) + { + typename graph_traits::edges_size_type numedges = num_edges(g); + if (is_same::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + m_forward.assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires the above, plus a vertex_index map. + template + void assign(const Graph& g) + { + typename graph_traits::edges_size_type numedges = num_edges(g); + if (is_same::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + m_forward.assign(g, get(vertex_index, g), numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Add edges from a sorted (smallest sources first) range of pairs and edge + // properties + template + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); + } + + template + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, identity_property_map()); + } + + // Add edges from a sorted (smallest sources first) range of pairs + template + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator()); + } + + template + void + add_edges_sorted_internal_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator(), global_to_local); + } + + template + void + add_edges_sorted_internal_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); + } + + // Add edges from a range of (source, target) pairs that are unsorted + template + inline void + add_edges_internal(InputIterator first, InputIterator last, + const GlobalToLocal& global_to_local) { + typedef compressed_sparse_row_graph Graph; + typedef typename boost::graph_traits::vertex_descriptor vertex_t; + typedef typename boost::graph_traits::vertices_size_type vertex_num; + typedef typename boost::graph_traits::edges_size_type edge_num; + typedef std::vector > edge_vector_t; + edge_vector_t new_edges(first, last); + if (new_edges.empty()) return; + std::sort(new_edges.begin(), new_edges.end()); + this->add_edges_sorted_internal_global(new_edges.begin(), new_edges.end(), global_to_local); + } + + template + inline void + add_edges_internal(InputIterator first, InputIterator last) { + this->add_edges_internal(first, last, identity_property_map()); + } + + // Add edges from a range of (source, target) pairs and edge properties that + // are unsorted + template + inline void + add_edges_internal(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end, + const GlobalToLocal& global_to_local) { + typedef compressed_sparse_row_graph Graph; + typedef typename boost::graph_traits::vertex_descriptor vertex_t; + typedef typename boost::graph_traits::vertices_size_type vertex_num; + typedef typename boost::graph_traits::edges_size_type edge_num; + typedef std::pair vertex_pair; + typedef std::vector< + boost::tuple > + edge_vector_t; + edge_vector_t new_edges + (boost::make_zip_iterator(boost::make_tuple(first, ep_iter)), + boost::make_zip_iterator(boost::make_tuple(last, ep_iter_end))); + if (new_edges.empty()) return; + std::sort(new_edges.begin(), new_edges.end(), + boost::detail::compare_first< + std::less >()); + m_forward.add_edges_sorted_internal + (boost::make_transform_iterator( + new_edges.begin(), + boost::detail::my_tuple_get_class<0, vertex_pair>()), + boost::make_transform_iterator( + new_edges.end(), + boost::detail::my_tuple_get_class<0, vertex_pair>()), + boost::make_transform_iterator( + new_edges.begin(), + boost::detail::my_tuple_get_class + <1, edge_bundled>()), + global_to_local); + } + + // Add edges from a range of (source, target) pairs and edge properties that + // are unsorted + template + inline void + add_edges_internal(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end) { + this->add_edges_internal(first, last, ep_iter, ep_iter_end, identity_property_map()); + } + + using inherited_vertex_properties::operator[]; + + // Directly access a edge or edge bundle + edge_push_back_type& operator[](const edge_descriptor& v) + { return m_forward.m_edge_properties[get(edge_index, *this, v)]; } + + const edge_push_back_type& operator[](const edge_descriptor& v) const + { return m_forward.m_edge_properties[get(edge_index, *this, v)]; } + + // private: non-portable, requires friend templates + inherited_vertex_properties& vertex_properties() {return *this;} + const inherited_vertex_properties& vertex_properties() const {return *this;} + typename forward_type::inherited_edge_properties& edge_properties() { return m_forward; } + const typename forward_type::inherited_edge_properties& edge_properties() const { return m_forward; } + + forward_type m_forward; + backward_type m_backward; + GraphProperty m_property; +}; +#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE + +// Construction functions +template +inline Vertex +add_vertex(BOOST_CSR_GRAPH_TYPE& g) { + add_vertex(g, typename BOOST_CSR_GRAPH_TYPE::vertex_bundled()); +} + +template +inline Vertex +add_vertex(BOOST_DIR_CSR_GRAPH_TYPE& g, + typename BOOST_DIR_CSR_GRAPH_TYPE::vertex_bundled const& p) { + Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size(); + g.m_forward.m_rowstart.push_back(g.m_forward.m_rowstart.back()); + g.vertex_properties().push_back(p); + return old_num_verts_plus_one - 1; +} + +template +inline Vertex +add_vertex(BOOST_BIDIR_CSR_GRAPH_TYPE& g, + typename BOOST_BIDIR_CSR_GRAPH_TYPE::vertex_bundled const& p) { + Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size(); + g.m_forward.m_rowstart.push_back(g.m_forward.m_rowstart.back()); + g.m_backward.m_rowstart.push_back(g.m_backward.m_rowstart.back()); + g.vertex_properties().push_back(p); + return old_num_verts_plus_one - 1; +} + +template +inline Vertex +add_vertices(typename BOOST_DIR_CSR_GRAPH_TYPE::vertices_size_type count, BOOST_DIR_CSR_GRAPH_TYPE& g) { + Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size(); + EdgeIndex numedges = g.m_forward.m_rowstart.back(); + g.m_forward.m_rowstart.resize(old_num_verts_plus_one + count, numedges); + g.m_backward.m_rowstart.resize(old_num_verts_plus_one + count, numedges); + g.vertex_properties().resize(num_vertices(g)); + return old_num_verts_plus_one - 1; +} + +#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE +// 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_DIR_CSR_GRAPH_TYPE::edge_descriptor +add_edge(Vertex src, Vertex tgt, BOOST_DIR_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_forward.m_column.size(); + for (; g.m_last_source <= src; ++g.m_last_source) + g.m_forward.m_rowstart[g.m_last_source] = num_edges_orig; + g.m_forward.m_rowstart[src + 1] = num_edges_orig + 1; + g.m_forward.m_column.push_back(tgt); + typedef typename BOOST_DIR_CSR_GRAPH_TYPE::edge_push_back_type push_back_type; + g.edge_properties().push_back(push_back_type()); + return typename BOOST_DIR_CSR_GRAPH_TYPE::edge_descriptor(src, num_edges_orig); +} + +// This function requires that src be at least as large as the largest source +// in the graph so far +template +inline typename BOOST_DIR_CSR_GRAPH_TYPE::edge_descriptor +add_edge(Vertex src, Vertex tgt, + typename BOOST_DIR_CSR_GRAPH_TYPE::edge_bundled const& p, + BOOST_DIR_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_forward.m_column.size(); + for (; g.m_last_source <= src; ++g.m_last_source) + g.m_forward.m_rowstart[g.m_last_source] = num_edges_orig; + g.m_forward.m_rowstart[src + 1] = num_edges_orig + 1; + g.m_forward.m_column.push_back(tgt); + g.edge_properties().push_back(p); + return typename BOOST_DIR_CSR_GRAPH_TYPE::edge_descriptor(src, num_edges_orig); +} +#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE + +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + // Add edges from a sorted (smallest sources first) range of pairs and edge + // properties + template + void + add_edges_sorted( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted); + } + + // Add edges from a sorted (smallest sources first) range of pairs + template + void + add_edges_sorted( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_sorted_internal(first_sorted, last_sorted); + } + + template + void + add_edges_sorted_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_sorted_internal_global(first_sorted, last_sorted, ep_iter_sorted, + global_to_local); + } + + // Add edges from a sorted (smallest sources first) range of pairs + template + void + add_edges_sorted_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + const GlobalToLocal& global_to_local, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_sorted_internal_global(first_sorted, last_sorted, global_to_local); + } + + // Add edges from a range of (source, target) pairs that are unsorted + template + inline void + add_edges_global(InputIterator first, InputIterator last, + const GlobalToLocal& global_to_local, BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_internal(first, last, global_to_local); + } + + // Add edges from a range of (source, target) pairs that are unsorted + template + inline void + add_edges(InputIterator first, InputIterator last, BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_internal(first, last); + } + + // Add edges from a range of (source, target) pairs and edge properties that + // are unsorted + template + inline void + add_edges(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_internal(first, last, ep_iter, ep_iter_end); + } + + template + inline void + add_edges_global(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end, + const GlobalToLocal& global_to_local, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_internal(first, last, ep_iter, ep_iter_end, global_to_local); + } +#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE + +// From VertexListGraph +template +inline Vertex +num_vertices(const BOOST_CSR_GRAPH_TYPE& g) { + return g.m_forward.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 +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_forward.m_column[e.idx]; +} + +namespace detail { + template + inline EdgeIndex get_actual_row_start + (const BOOST_CSR_GRAPH_TYPE& g, + EdgeIndex rowstart_i_minus_1, EdgeIndex rowstart_i) + { +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + return rowstart_i; +#else + // Special case to allow incremental construction + return (std::max)(rowstart_i_minus_1, rowstart_i); +#endif + } +} + +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_forward.m_rowstart[v]; + EdgeIndex next_row_start = g.m_forward.m_rowstart[v + 1]; + return std::make_pair(it(ed(v, v_row_start)), + it(ed(v, detail::get_actual_row_start + (g, 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_forward.m_rowstart[v]; + EdgeIndex next_row_start = g.m_forward.m_rowstart[v + 1]; + return detail::get_actual_row_start(g, v_row_start, next_row_start) - v_row_start; +} + +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + +template +inline std::pair +in_edges(Vertex v, const BOOST_BIDIR_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_BIDIR_CSR_GRAPH_TYPE::edge_descriptor ed; + typedef typename BOOST_BIDIR_CSR_GRAPH_TYPE::in_edge_iterator it; + EdgeIndex v_row_start = g.m_backward.m_rowstart[v]; + EdgeIndex next_row_start = g.m_backward.m_rowstart[v + 1]; + return std::make_pair(it(ed(v, v_row_start)), + it(ed(v, next_row_start))); +} + +template +inline EdgeIndex +in_degree(Vertex v, const BOOST_BIDIR_CSR_GRAPH_TYPE& g) +{ + EdgeIndex v_row_start = g.m_backward.m_rowstart[v]; + EdgeIndex next_row_start = g.m_backward.m_rowstart[v + 1]; + return next_row_start - v_row_start; +} + +#endif // BOOST_GRAPH_USE_NEW_CSR_INTERFACE + +// From AdjacencyGraph +template +inline std::pair +adjacent_vertices(Vertex v, const BOOST_CSR_GRAPH_TYPE& g) +{ + EdgeIndex v_row_start = g.m_forward.m_rowstart[v]; + EdgeIndex next_row_start = g.m_forward.m_rowstart[v + 1]; + return std::make_pair(g.m_forward.m_column.begin() + v_row_start, + g.m_forward.m_column.begin() + + detail::get_actual_row_start + (g, 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; +} + +#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE +// These require that the out edges from a vertex are sorted, which is only +// guaranteed by the old interface + +// 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_forward.m_column.begin(); + EdgeIndex idx_end = adjacencies.second - g.m_forward.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); +} + +#else // !BOOST_GRAPH_USE_OLD_CSR_INTERFACE +// edge() can be provided in linear time for the new interface + +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 = out_edges(i, g); + for (; range.first != range.second; ++range.first) { + if (target(*range.first) == j) + return std::make_pair(*range.first, true); + } + return std::make_pair(typename BOOST_CSR_GRAPH_TYPE::edge_descriptor(), + false); +} + +#endif // !BOOST_GRAPH_USE_OLD_CSR_INTERFACE + +// 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_forward.m_rowstart.begin(), +#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE + // This handles the case where there are some vertices + // with rowstart 0 after the last provided vertex; this + // case does not happen with the new interface + g.m_forward.m_rowstart.begin() + g.m_last_source + 1, +#else // !BOOST_GRAPH_USE_OLD_CSR_INTERFACE + g.m_forward.m_rowstart.end(), +#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE + idx); + // Get last source whose rowstart is at most idx + // upper_bound returns this position plus 1 + Vertex src = (src_plus_1 - g.m_forward.m_rowstart.begin()) - 1; + return typename BOOST_CSR_GRAPH_TYPE::edge_descriptor(src, idx); +} + +template +inline EdgeIndex +num_edges(const BOOST_CSR_GRAPH_TYPE& g) +{ + return g.m_forward.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_forward.m_rowstart.size() == 1 || g.m_forward.m_column.empty()) { + return std::make_pair(ei(), ei()); + } else { + // Find the first vertex that has outgoing edges + Vertex src = 0; + while (g.m_forward.m_rowstart[src + 1] == 0) ++src; + return std::make_pair(ei(g, edgedesc(src, 0), g.m_forward.m_rowstart[src + 1]), + ei(g, edgedesc(num_vertices(g), g.m_forward.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; +} + +template +struct property_map +{ + typedef identity_property_map type; + typedef type const_type; +}; + +template +struct property_map +{ +private: + typedef typename graph_traits::edge_descriptor + edge_descriptor; + typedef csr_edge_index_map edge_index_type; + +public: + typedef edge_index_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; +} + +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 +#undef BOOST_DIR_CSR_GRAPH_TYPE +#undef BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS +#undef BOOST_BIDIR_CSR_GRAPH_TYPE +#undef BOOST_BIDIR_CSR_GRAPH_TEMPLATE_PARMS + +} // end namespace boost + +#endif // BOOST_GRAPH_COMPRESSED_SPARSE_ROW_GRAPH_HPP diff --git a/deal.II/contrib/boost/include/boost/graph/connected_components.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/connected_components.hpp similarity index 87% rename from deal.II/contrib/boost/include/boost/graph/connected_components.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/connected_components.hpp index df9084ce36..90015e6703 100644 --- a/deal.II/contrib/boost/include/boost/graph/connected_components.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/connected_components.hpp @@ -15,7 +15,7 @@ #include #include #include - +#include #include namespace boost { @@ -58,7 +58,8 @@ namespace boost { template inline typename property_traits::value_type connected_components(const Graph& g, ComponentMap c, - const bgl_named_params& params) + const bgl_named_params& params + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, vertex_list_graph_tag)) { if (num_vertices(g) == 0) return 0; @@ -77,14 +78,15 @@ namespace boost { template inline typename property_traits::value_type - connected_components(const Graph& g, ComponentMap c) + connected_components(const Graph& g, ComponentMap c + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, vertex_list_graph_tag)) { 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)); + // 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)()) @@ -97,5 +99,8 @@ namespace boost { } // namespace boost +#ifdef BOOST_GRAPH_USE_MPI +# include +#endif #endif // BOOST_GRAPH_CONNECTED_COMPONENTS_HPP diff --git a/deal.II/contrib/boost/include/boost/graph/copy.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/copy.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/graph/copy.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/copy.hpp index fd98a426a4..c566503af0 100644 --- a/deal.II/contrib/boost/include/boost/graph/copy.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/copy.hpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/core_numbers.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/core_numbers.hpp new file mode 100644 index 0000000000..743c81f916 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/core_numbers.hpp @@ -0,0 +1,350 @@ +// +//======================================================================= +// Copyright 2007 Stanford University +// Authors: David Gleich +// +// Distributed under the 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_CORE_NUMBERS_HPP +#define BOOST_GRAPH_CORE_NUMBERS_HPP + +#include +#include +#include +#include + +/* + * core_numbers + * + * Requirement: IncidenceGraph + */ + +// History +// +// 30 July 2007 +// Added visitors to the implementation +// +// 8 February 2008 +// Fixed headers and missing typename + +namespace boost { + + // A linear time O(m) algorithm to compute the indegree core number + // of a graph for unweighted graphs. + // + // and a O((n+m) log n) algorithm to compute the in-edge-weight core + // numbers of a weighted graph. + // + // The linear algorithm comes from: + // Vladimir Batagelj and Matjaz Zaversnik, "An O(m) Algorithm for Cores + // Decomposition of Networks." Sept. 1 2002. + + template + struct CoreNumbersVisitorConcept { + void constraints() + { + function_requires< CopyConstructibleConcept >(); + vis.examine_vertex(u,g); + vis.finish_vertex(u,g); + vis.examine_edge(e,g); + } + Visitor vis; + Graph g; + typename graph_traits::vertex_descriptor u; + typename graph_traits::edge_descriptor e; + }; + + template + class core_numbers_visitor : public bfs_visitor { + public: + core_numbers_visitor() {} + core_numbers_visitor(Visitors vis) + : bfs_visitor(vis) {} + + private: + template + void initialize_vertex(Vertex, Graph&) {} + + template + void discover_vertex(Vertex , Graph&) {} + + template + void gray_target(Vertex, Graph&) {} + + template + void black_target(Vertex, Graph&) {} + + template + void tree_edge(Edge, Graph&) {} + + template + void non_tree_edge(Edge, Graph&) {} + }; + + template + core_numbers_visitor make_core_numbers_visitor(Visitors vis) + { return core_numbers_visitor(vis); }; + + typedef core_numbers_visitor<> default_core_numbers_visitor; + + namespace detail { + + // implement a constant_property_map to simplify compute_in_degree + // for the weighted and unweighted case + // this is based on dummy property map + template + class constant_value_property_map + : public boost::put_get_helper > + { + public: + typedef void key_type; + typedef ValueType value_type; + typedef const ValueType& reference; + typedef boost::readable_property_map_tag category; + inline constant_value_property_map(ValueType cc) : c(cc) { } + inline constant_value_property_map(const constant_value_property_map& x) + : c(x.c) { } + template + inline reference operator[](Vertex) const { return c; } + protected: + ValueType c; + }; + + + // the core numbers start as the indegree or inweight. This function + // will initialize these values + template + void compute_in_degree_map(Graph& g, CoreMap d, EdgeWeightMap wm) + { + typename graph_traits::vertex_iterator vi,vi_end; + typename graph_traits::out_edge_iterator ei,ei_end; + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + put(d,*vi,0); + } + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + for (tie(ei,ei_end) = out_edges(*vi,g); ei!=ei_end; ++ei) { + put(d,target(*ei,g),get(d,target(*ei,g))+get(wm,*ei)); + } + } + } + + // the version for weighted graphs is a little different + template + typename property_traits::value_type + core_numbers_impl(Graph& g, CoreMap c, EdgeWeightMap wm, + MutableQueue& Q, Visitor vis) + { + typename property_traits::value_type v_cn = 0; + typedef typename graph_traits::vertex_descriptor vertex; + while (!Q.empty()) + { + // remove v from the Q, and then decrease the core numbers + // of its successors + vertex v = Q.top(); + vis.examine_vertex(v,g); + Q.pop(); + v_cn = get(c,v); + typename graph_traits::out_edge_iterator oi,oi_end; + for (tie(oi,oi_end) = out_edges(v,g); oi!=oi_end; ++oi) { + vis.examine_edge(*oi,g); + vertex u = target(*oi,g); + // if c[u] > c[v], then u is still in the graph, + if (get(c,u) > v_cn) { + // remove the edge + put(c,u,get(c,u)-get(wm,*oi)); + Q.update(u); + } + } + vis.finish_vertex(v,g); + } + return (v_cn); + } + + template + typename property_traits::value_type + core_numbers_dispatch(Graph&g, CoreMap c, EdgeWeightMap wm, + IndexMap im, CoreNumVisitor vis) + { + typedef typename property_traits::value_type D; + typedef std::less Cmp; + typedef indirect_cmp IndirectCmp; + IndirectCmp icmp(c, Cmp()); + // build the mutable queue + typedef typename graph_traits::vertex_descriptor vertex; + typedef mutable_queue, IndirectCmp, + IndexMap> MutableQueue; + MutableQueue Q(num_vertices(g), icmp, im); + typename graph_traits::vertex_iterator vi,vi_end; + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + Q.push(*vi); + } + return core_numbers_impl(g, c, wm, Q, vis); + } + + // the version for the unweighted case + // for this functions CoreMap must be initialized + // with the in degree of each vertex + template + typename property_traits::value_type + core_numbers_impl(Graph& g, CoreMap c, PositionMap pos, Visitor vis) + { + typedef typename graph_traits::vertices_size_type size_type; + typedef typename graph_traits::degree_size_type degree_type; + typedef typename graph_traits::vertex_descriptor vertex; + typename graph_traits::vertex_iterator vi,vi_end; + + // store the vertex core numbers + typename property_traits::value_type v_cn = 0; + + // compute the maximum degree (degrees are in the coremap) + typename graph_traits::degree_size_type max_deg = 0; + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + max_deg = (std::max::degree_size_type>)(max_deg, get(c,*vi)); + } + + // store the vertices in bins by their degree + // allocate two extra locations to ease boundary cases + std::vector bin(max_deg+2); + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + ++bin[get(c,*vi)]; + } + + // this loop sets bin[d] to the starting position of vertices + // with degree d in the vert array for the bucket sort + size_type cur_pos = 0; + for (degree_type cur_deg = 0; cur_deg < max_deg+2; ++cur_deg) { + degree_type tmp = bin[cur_deg]; + bin[cur_deg] = cur_pos; + cur_pos += tmp; + } + + // perform the bucket sort with pos and vert so that + // pos[0] is the vertex of smallest degree + std::vector vert(num_vertices(g)); + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + vertex v=*vi; + size_type p=bin[get(c,v)]; + put(pos,v,p); + vert[p]=v; + ++bin[get(c,v)]; + } + // we ``abused'' bin while placing the vertices, now, + // we need to restore it + std::copy(boost::make_reverse_iterator(bin.end()-2), + boost::make_reverse_iterator(bin.begin()), + boost::make_reverse_iterator(bin.end()-1)); + // now simulate removing the vertices + for (size_type i=0; i < num_vertices(g); ++i) { + vertex v = vert[i]; + vis.examine_vertex(v,g); + v_cn = get(c,v); + typename graph_traits::out_edge_iterator oi,oi_end; + for (tie(oi,oi_end) = out_edges(v,g); oi!=oi_end; ++oi) { + vis.examine_edge(*oi,g); + vertex u = target(*oi,g); + // if c[u] > c[v], then u is still in the graph, + if (get(c,u) > v_cn) { + degree_type deg_u = get(c,u); + degree_type pos_u = get(pos,u); + // w is the first vertex with the same degree as u + // (this is the resort operation!) + degree_type pos_w = bin[deg_u]; + vertex w = vert[pos_w]; + if (u!=v) { + // swap u and w + put(pos,u,pos_w); + put(pos,w,pos_u); + vert[pos_w] = u; + vert[pos_u] = w; + } + // now, the vertices array is sorted assuming + // we perform the following step + // start the set of vertices with degree of u + // one into the future (this now points at vertex + // w which we swapped with u). + ++bin[deg_u]; + // we are removing v from the graph, so u's degree + // decreases + put(c,u,get(c,u)-1); + } + } + vis.finish_vertex(v,g); + } + return v_cn; + } + + } // namespace detail + + // non-named parameter version for the unweighted case + template + typename property_traits::value_type + core_numbers(Graph& g, CoreMap c, CoreNumVisitor vis) + { + typedef typename graph_traits::vertices_size_type size_type; + detail::compute_in_degree_map(g,c, + detail::constant_value_property_map< + typename property_traits::value_type>(1) ); + return detail::core_numbers_impl(g,c, + make_iterator_property_map( + std::vector(num_vertices(g)).begin(),get(vertex_index, g)), + vis + ); + } + + // non-named paramter version for the unweighted case + template + typename property_traits::value_type + core_numbers(Graph& g, CoreMap c) + { + return core_numbers(g, c, make_core_numbers_visitor(null_visitor())); + } + + // non-named parameter version for the weighted case + template + typename property_traits::value_type + core_numbers(Graph& g, CoreMap c, EdgeWeightMap wm, VertexIndexMap vim, + CoreNumVisitor vis) + { + typedef typename graph_traits::vertices_size_type size_type; + detail::compute_in_degree_map(g,c,wm); + return detail::core_numbers_dispatch(g,c,wm,vim,vis); + } + + // non-named parameter version for the weighted case +// template +// typename property_traits::value_type +// core_numbers(Graph& g, CoreMap c, EdgeWeightMap wm) +// { +// typedef typename graph_traits::vertices_size_type size_type; +// detail::compute_in_degree_map(g,c,wm); +// return detail::core_numbers_dispatch(g,c,wm,get(vertex_index,g), +// make_core_numbers_visitor(null_visitor())); +// } + + template + typename property_traits::value_type + weighted_core_numbers(Graph& g, CoreMap c) + { + return weighted_core_numbers( + g,c, make_core_numbers_visitor(null_visitor()) + ); + } + + template + typename property_traits::value_type + weighted_core_numbers(Graph& g, CoreMap c, CoreNumVisitor vis) + { return core_numbers(g,c,get(edge_weight,g),get(vertex_index,g),vis); } + +} // namespace boost + +#endif // BOOST_GRAPH_CORE_NUMBERS_HPP + diff --git a/deal.II/contrib/boost/include/boost/graph/create_condensation_graph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/create_condensation_graph.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/graph/create_condensation_graph.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/create_condensation_graph.hpp index f3d1113a3d..4f3316f6a1 100644 --- a/deal.II/contrib/boost/include/boost/graph/create_condensation_graph.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/create_condensation_graph.hpp @@ -11,7 +11,7 @@ #define BOOST_CREATE_CONDENSATION_GRAPH_HPP #include -#include +#include namespace boost { diff --git a/deal.II/contrib/boost/include/boost/graph/cuthill_mckee_ordering.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/cuthill_mckee_ordering.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/graph/cuthill_mckee_ordering.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/cuthill_mckee_ordering.hpp index 61336ab177..c930bab3ee 100644 --- a/deal.II/contrib/boost/include/boost/graph/cuthill_mckee_ordering.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/cuthill_mckee_ordering.hpp @@ -13,6 +13,7 @@ #include #include +#include #include @@ -132,7 +133,7 @@ namespace boost { cuthill_mckee_ordering(const Graph& G, OutputIterator permutation, ColorMap color, DegreeMap degree) { - if (vertices(G).first == vertices(G).second) + if (boost::graph::has_no_vertices(G)) return permutation; typedef typename boost::graph_traits::vertex_descriptor Vertex; @@ -168,7 +169,7 @@ namespace boost { cuthill_mckee_ordering(const Graph& G, OutputIterator permutation, VertexIndexMap index_map) { - if (vertices(G).first == vertices(G).second) + if (boost::graph::has_no_vertices(G)) return permutation; typedef out_degree_property_map DegreeMap; diff --git a/deal.II/contrib/boost/include/boost/graph/dag_shortest_paths.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/dag_shortest_paths.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/dag_shortest_paths.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/dag_shortest_paths.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/degree_centrality.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/degree_centrality.hpp new file mode 100644 index 0000000000..24ecb6c511 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/degree_centrality.hpp @@ -0,0 +1,130 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_DEGREE_CENTRALITY_HPP +#define BOOST_GRAPH_DEGREE_CENTRALITY_HPP + +#include + +namespace boost { + +template +struct degree_centrality_measure +{ + typedef typename graph_traits::degree_size_type degree_type; + typedef typename graph_traits::vertex_descriptor vertex_type; +}; + +template +struct influence_measure + : public degree_centrality_measure +{ + typedef degree_centrality_measure base_type; + typedef typename base_type::degree_type degree_type; + typedef typename base_type::vertex_type vertex_type; + + inline degree_type operator ()(vertex_type v, const Graph& g) + { + function_requires< IncidenceGraphConcept >(); + return out_degree(v, g); + } +}; + +template +inline influence_measure +measure_influence(const Graph&) +{ return influence_measure(); } + + +template +struct prestige_measure + : public degree_centrality_measure +{ + typedef degree_centrality_measure base_type; + typedef typename base_type::degree_type degree_type; + typedef typename base_type::vertex_type vertex_type; + + inline degree_type operator ()(vertex_type v, const Graph& g) + { + function_requires< BidirectionalGraphConcept >(); + return in_degree(v, g); + } +}; + +template +inline prestige_measure +measure_prestige(const Graph&) +{ return prestige_measure(); } + + +template +inline typename Measure::degree_type +degree_centrality(const Graph& g, Vertex v, Measure measure) +{ + function_requires< DegreeMeasureConcept >(); + return measure(v, g); +} + +template +inline typename graph_traits::degree_size_type +degree_centrality(const Graph& g, Vertex v) +{ + return degree_centrality(g, v, measure_influence(g)); +} + + +// These are alias functions, intended to provide a more expressive interface. + +template +inline typename graph_traits::degree_size_type +influence(const Graph& g, Vertex v) +{ return degree_centrality(g, v, measure_influence(g)); } + + +template +inline typename graph_traits::degree_size_type +prestige(const Graph& g, Vertex v) +{ return degree_centrality(g, v, measure_prestige(g)); } + + +template +inline void +all_degree_centralities(const Graph& g, CentralityMap cent, Measure measure) +{ + function_requires< VertexListGraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertex_iterator VertexIterator; + function_requires< WritablePropertyMapConcept >(); + typedef typename property_traits::value_type Centrality; + + VertexIterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + Centrality c = degree_centrality(g, *i, measure); + put(cent, *i, c); + } +} + +template +inline void all_degree_centralities(const Graph& g, CentralityMap cent) +{ all_degree_centralities(g, cent, measure_influence(g)); } + +// More helper functions for computing influence and prestige. +// I hate the names of these functions, but influence and prestige +// don't pluralize too well. + +template +inline void all_influence_values(const Graph& g, CentralityMap cent) +{ all_degree_centralities(g, cent, measure_influence(g)); } + +template +inline void all_prestige_values(const Graph& g, CentralityMap cent) +{ all_degree_centralities(g, cent, measure_prestige(g)); } + +} /* namespace boost */ + +#endif + + diff --git a/deal.II/contrib/boost/include/boost/graph/depth_first_search.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/depth_first_search.hpp similarity index 86% rename from deal.II/contrib/boost/include/boost/graph/depth_first_search.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/depth_first_search.hpp index 6a0abb9a6a..1bf0667113 100644 --- a/deal.II/contrib/boost/include/boost/graph/depth_first_search.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/depth_first_search.hpp @@ -19,7 +19,6 @@ #include #include #include - #include #include @@ -214,49 +213,14 @@ namespace boost { void depth_first_search(const VertexListGraph& g, DFSVisitor vis, ColorMap color) { - if (vertices(g).first == vertices(g).second) + typedef typename boost::graph_traits::vertex_iterator vi; + std::pair verts = vertices(g); + if (verts.first == verts.second) return; - depth_first_search(g, vis, color, *vertices(g).first); + depth_first_search(g, vis, color, *verts.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: @@ -315,26 +279,25 @@ namespace boost { } 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) + typedef typename boost::graph_traits::vertex_iterator vi; + std::pair verts = vertices(g); + if (verts.first == verts.second) return; - detail::dfs_dispatch::apply + using namespace boost::graph::keywords; + typedef bgl_named_params params_type; + BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) + depth_first_search (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) - ); + arg_pack[_visitor | make_dfs_visitor(null_visitor())], + boost::detail::color_map_maker::make_map(g, arg_pack), + arg_pack[_root_vertex | *vertices(g).first] + ); } template @@ -357,9 +320,10 @@ namespace boost { vis.start_vertex(u, g); detail::depth_first_visit_impl(g, u, vis, color, func); } - - } // namespace boost +#ifdef BOOST_GRAPH_USE_MPI +# include +#endif #endif diff --git a/deal.II/contrib/boost/include/boost/graph/detail/adj_list_edge_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/adj_list_edge_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/detail/adj_list_edge_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/adj_list_edge_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/graph/detail/adjacency_list.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/adjacency_list.hpp similarity index 92% rename from deal.II/contrib/boost/include/boost/graph/detail/adjacency_list.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/adjacency_list.hpp index 0839dc0fad..c02a310b84 100644 --- a/deal.II/contrib/boost/include/boost/graph/detail/adjacency_list.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/adjacency_list.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -140,7 +140,7 @@ namespace boost { , EdgeDescriptor , Difference > super_t; - + inline out_edge_iter() { } inline out_edge_iter(const BaseIter& i, const VertexDescriptor& src) : super_t(i), m_src(src) { } @@ -148,12 +148,12 @@ namespace boost { inline EdgeDescriptor dereference() const { - return EdgeDescriptor(m_src, (*this->base()).get_target(), + return EdgeDescriptor(m_src, (*this->base()).get_target(), &(*this->base()).get_property()); } VertexDescriptor m_src; }; - + template struct in_edge_iter : iterator_adaptor< @@ -173,9 +173,9 @@ namespace boost { , EdgeDescriptor , Difference > super_t; - + inline in_edge_iter() { } - inline in_edge_iter(const BaseIter& i, const VertexDescriptor& src) + inline in_edge_iter(const BaseIter& i, const VertexDescriptor& src) : super_t(i), m_src(src) { } inline EdgeDescriptor @@ -211,10 +211,10 @@ namespace boost { > super_t; undirected_edge_iter() {} - + explicit undirected_edge_iter(EdgeIter i) : super_t(i) {} - + inline EdgeDescriptor dereference() const { return EdgeDescriptor( @@ -268,11 +268,11 @@ namespace boost { inline stored_edge_property(Vertex target, const Property& p = Property()) : stored_edge(target), m_property(new Property(p)) { } - stored_edge_property(const self& x) + 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; + m_property = const_cast(x).m_property; return *this; } inline Property& get_property() { return *m_property; } @@ -298,7 +298,7 @@ namespace boost { 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 { + inline const Property& get_property() const { return m_iter->get_property(); } inline Iter get_iter() const { return m_iter; } @@ -317,11 +317,11 @@ namespace boost { public: typedef Property property_type; inline stored_ra_edge_iter() { } - inline stored_ra_edge_iter(Vertex v, Iter i = 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 { + inline const Property& get_property() const { return (*m_vec)[m_i].get_property(); } inline Iter get_iter() const { return m_vec->begin() + m_i; } @@ -331,7 +331,7 @@ namespace boost { }; } // namespace detail - + template const typename property_value::type& get(Tag property_tag, @@ -355,7 +355,7 @@ namespace boost { { return get_property_value(e.get_property(), property_tag); } - + //========================================================================= // Directed Edges Helper Class @@ -378,7 +378,7 @@ namespace boost { template inline void remove_directed_edge_if_dispatch(incidence_iterator first, - incidence_iterator last, + incidence_iterator last, EdgeList& el, Predicate pred, boost::allow_parallel_edge_tag) { @@ -387,7 +387,7 @@ namespace boost { ++first; incidence_iterator i = first; if (first != last) - for (; i != last; ++i) + for (++i; i != last; ++i) if (!pred(*i)) { *first.base() = *i.base(); ++first; @@ -397,8 +397,8 @@ namespace boost { template inline void remove_directed_edge_if_dispatch(incidence_iterator first, - incidence_iterator last, - EdgeList& el, + incidence_iterator last, + EdgeList& el, Predicate pred, boost::disallow_parallel_edge_tag) { @@ -410,12 +410,12 @@ namespace boost { } } - template inline void - undirected_remove_out_edge_if_dispatch(Graph& g, + undirected_remove_out_edge_if_dispatch(Graph& g, incidence_iterator first, - incidence_iterator last, + incidence_iterator last, EdgeList& el, Predicate pred, boost::allow_parallel_edge_tag) { @@ -444,8 +444,8 @@ namespace boost { else { // Remove the edge from the target detail::remove_directed_edge_dispatch - (*i, - g.out_edge_list(target(*i, g)), + (*i, + g.out_edge_list(target(*i, g)), *(PropT*)(*i).get_property()); } @@ -455,13 +455,13 @@ namespace boost { } el.erase(first.base(), el.end()); } - template inline void - undirected_remove_out_edge_if_dispatch(Graph& g, + undirected_remove_out_edge_if_dispatch(Graph& g, incidence_iterator first, - incidence_iterator last, - EdgeList& el, + incidence_iterator last, + EdgeList& el, Predicate pred, boost::disallow_parallel_edge_tag) { @@ -475,8 +475,8 @@ namespace boost { 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)), + (*first, + g.out_edge_list(target(*first, g)), *(PropT*)(*first).get_property()); } @@ -510,7 +510,7 @@ namespace boost { // 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) @@ -538,7 +538,7 @@ namespace boost { // O(1) template - inline std::pair edges(const directed_edges_helper& g_) { @@ -546,8 +546,8 @@ namespace boost { 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(), + 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(), @@ -565,7 +565,7 @@ namespace boost { template struct directed_graph_helper - : public directed_edges_helper { + : public directed_edges_helper { typedef typename Config::edge_descriptor edge_descriptor; typedef adj_list_dir_traversal_tag traversal_category; }; @@ -607,7 +607,7 @@ namespace boost { 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 @@ -619,7 +619,7 @@ namespace boost { // O(V + E) for allow_parallel_edges // O(V * log(E/V)) for disallow_parallel_edges template - inline void + inline void clear_vertex(typename Config::vertex_descriptor u, directed_graph_helper& g_) { @@ -635,7 +635,7 @@ namespace boost { } template - inline void + inline void clear_out_edges(typename Config::vertex_descriptor u, directed_graph_helper& g_) { @@ -664,27 +664,27 @@ namespace boost { // O(log(E/V)) for disallow_parallel_edge_tag template inline std::pair::edge_descriptor, bool> - add_edge(typename Config::vertex_descriptor u, + add_edge(typename Config::vertex_descriptor u, typename Config::vertex_descriptor v, - const typename Config::edge_property_type& p, + 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; + typename Config::OutEdgeList::iterator i; bool inserted; - boost::tie(i, inserted) = boost::graph_detail::push(g.out_edge_list(u), + 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()), + 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, + add_edge(typename Config::vertex_descriptor u, typename Config::vertex_descriptor v, directed_graph_helper& g_) { @@ -697,7 +697,7 @@ namespace boost { template struct undirected_graph_helper; - struct undir_adj_list_traversal_tag : + struct undir_adj_list_traversal_tag : public virtual vertex_list_graph_tag, public virtual incidence_graph_tag, public virtual adjacency_graph_tag, @@ -713,8 +713,8 @@ namespace boost { // O(E/V) template static void - apply(edge_descriptor e, - undirected_graph_helper& g_, + apply(edge_descriptor e, + undirected_graph_helper& g_, StoredProperty& p) { typedef typename Config::global_edgelist_selector EdgeListS; @@ -722,7 +722,7 @@ namespace boost { 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) @@ -777,7 +777,7 @@ namespace boost { // O(E/V) template inline void - remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, + remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, boost::allow_parallel_edge_tag cat) { typedef typename Graph::global_edgelist_selector EdgeListS; @@ -785,15 +785,23 @@ namespace boost { typedef typename EdgeList::value_type StoredEdge; typename EdgeList::iterator i = el.begin(), end = el.end(); - for (; i != end; ++i) - if ((*i).get_target() == v) + for (; i != end; ++i) { + if ((*i).get_target() == v) { + // NOTE: Wihtout this skip, this loop will double-delete properties + // of loop edges. This solution is based on the observation that + // the incidence edges of a vertex with a loop are adjacent in the + // out edge list. This *may* actually hold for multisets also. + bool skip = (boost::next(i) != end && i->get_iter() == boost::next(i)->get_iter()); g.m_edges.erase((*i).get_iter()); + if (skip) ++i; + } + } 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, + remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, boost::disallow_parallel_edge_tag) { typedef typename Graph::global_edgelist_selector EdgeListS; @@ -857,15 +865,15 @@ namespace boost { // 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&, + 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& + 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; @@ -886,8 +894,8 @@ namespace boost { // O(E/V) or O(log(E/V)) template void - remove_edge(typename Config::vertex_descriptor u, - typename Config::vertex_descriptor v, + remove_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, undirected_graph_helper& g_) { typedef typename Config::global_edgelist_selector EdgeListS; @@ -899,7 +907,7 @@ namespace boost { 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, @@ -907,7 +915,7 @@ namespace boost { { 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_); @@ -949,7 +957,7 @@ namespace boost { // O(1) template - inline std::pair edges(const undirected_graph_helper& g_) { @@ -963,7 +971,7 @@ namespace boost { // O(1) template inline typename Config::edges_size_type - num_edges(const undirected_graph_helper& g_) + num_edges(const undirected_graph_helper& g_) { typedef typename Config::graph_type graph_type; const graph_type& g = static_cast(g_); @@ -971,7 +979,7 @@ namespace boost { } // O(E/V * E/V) template - inline void + inline void clear_vertex(typename Config::vertex_descriptor u, undirected_graph_helper& g_) { @@ -982,7 +990,7 @@ namespace boost { 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 + typename Config::OutEdgeList::iterator ei = el.begin(), ei_end = el.end(); for (; ei != ei_end; ++ei) { detail::erase_from_incidence_list @@ -995,8 +1003,8 @@ namespace boost { // 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, + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, const typename Config::edge_property_type& p, undirected_graph_helper& g_) { @@ -1007,11 +1015,11 @@ namespace boost { bool inserted; typename Config::EdgeContainer::value_type e(u, v, p); - typename Config::EdgeContainer::iterator p_iter + 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), + 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)); @@ -1025,8 +1033,8 @@ namespace boost { } template inline std::pair - add_edge(typename Config::vertex_descriptor u, - typename Config::vertex_descriptor v, + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, undirected_graph_helper& g_) { typename Config::edge_property_type p; @@ -1036,7 +1044,7 @@ namespace boost { // O(1) template inline typename Config::degree_size_type - degree(typename Config::vertex_descriptor u, + degree(typename Config::vertex_descriptor u, const undirected_graph_helper& g_) { typedef typename Config::graph_type Graph; @@ -1045,9 +1053,9 @@ namespace boost { } template - inline std::pair - in_edges(typename Config::vertex_descriptor u, + in_edges(typename Config::vertex_descriptor u, const undirected_graph_helper& g_) { typedef typename Config::graph_type Graph; @@ -1068,7 +1076,7 @@ namespace boost { //========================================================================= // Bidirectional Graph Helper Class - struct bidir_adj_list_traversal_tag : + struct bidir_adj_list_traversal_tag : public virtual vertex_list_graph_tag, public virtual incidence_graph_tag, public virtual adjacency_graph_tag, @@ -1084,15 +1092,15 @@ namespace boost { // 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&, + 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& + 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; @@ -1118,9 +1126,9 @@ namespace boost { } template - inline std::pair - in_edges(typename Config::vertex_descriptor u, + in_edges(typename Config::vertex_descriptor u, const bidirectional_graph_helper& g_) { typedef typename Config::graph_type graph_type; @@ -1134,7 +1142,7 @@ namespace boost { // O(1) template - inline std::pair edges(const bidirectional_graph_helper& g_) { @@ -1156,7 +1164,7 @@ namespace boost { { 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, @@ -1197,7 +1205,7 @@ namespace boost { typedef typename Config::edgelist_selector OutEdgeListS; - std::pair rng = + 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); @@ -1227,8 +1235,8 @@ namespace boost { // O(log(E/V)) for disallow_parallel_edge_tag template inline void - remove_edge(typename Config::vertex_descriptor u, - typename Config::vertex_descriptor v, + 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; @@ -1264,7 +1272,7 @@ namespace boost { 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; @@ -1338,7 +1346,7 @@ namespace boost { // O(1) template inline typename Config::edges_size_type - num_edges(const bidirectional_graph_helper_with_property& g_) + num_edges(const bidirectional_graph_helper_with_property& g_) { typedef typename Config::graph_type graph_type; const graph_type& g = static_cast(g_); @@ -1358,20 +1366,20 @@ namespace boost { 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 + 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 + 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.m_edges.erase((*in_ei).get_iter()); } g.out_edge_list(u).clear(); in_edge_list(g, u).clear(); @@ -1389,13 +1397,13 @@ namespace boost { 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 + 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(); } @@ -1411,12 +1419,12 @@ namespace boost { 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 + 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.m_edges.erase((*in_ei).get_iter()); } in_edge_list(g, u).clear(); } @@ -1426,7 +1434,7 @@ namespace boost { template inline std::pair add_edge(typename Config::vertex_descriptor u, - typename Config::vertex_descriptor v, + typename Config::vertex_descriptor v, const typename Config::edge_property_type& p, bidirectional_graph_helper_with_property& g_) { @@ -1436,19 +1444,19 @@ namespace boost { typedef typename Config::StoredEdge StoredEdge; bool inserted; typename Config::EdgeContainer::value_type e(u, v, p); - typename Config::EdgeContainer::iterator p_iter + 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), + 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), + 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()), + return std::make_pair(edge_descriptor(u, v, + &i->get_iter()->get_property()), false); } } @@ -1465,7 +1473,7 @@ namespace boost { // O(1) template inline typename Config::degree_size_type - degree(typename Config::vertex_descriptor u, + degree(typename Config::vertex_descriptor u, const bidirectional_graph_helper_with_property& g_) { typedef typename Config::graph_type graph_type; @@ -1505,15 +1513,15 @@ namespace boost { // Borland gets confused about constness. // O(E/V) - inline std::pair - edge_dispatch(const AdjList& g, - vertex_descriptor u, vertex_descriptor 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(), + 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) @@ -1523,9 +1531,9 @@ namespace boost { 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, + inline std::pair + edge_dispatch(const AdjList& g, + vertex_descriptor u, vertex_descriptor v, boost::disallow_parallel_edge_tag) const { bool found; @@ -1533,7 +1541,7 @@ namespace boost { 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 + typename Config::OutEdgeList::const_iterator i = g.out_edge_list(u).find(StoredEdge(v)), end = g.out_edge_list(u).end(); found = (i != end); @@ -1546,9 +1554,9 @@ namespace boost { }; template - inline std::pair - adjacent_vertices(typename Config::vertex_descriptor u, + adjacent_vertices(typename Config::vertex_descriptor u, const adj_list_helper& g_) { typedef typename Config::graph_type AdjList; @@ -1561,9 +1569,9 @@ namespace boost { adjacency_iterator(last, &g)); } template - inline std::pair - inv_adjacent_vertices(typename Config::vertex_descriptor u, + inv_adjacent_vertices(typename Config::vertex_descriptor u, const adj_list_helper& g_) { typedef typename Config::graph_type AdjList; @@ -1576,9 +1584,9 @@ namespace boost { inv_adjacency_iterator(last, &g)); } template - inline std::pair - out_edges(typename Config::vertex_descriptor u, + out_edges(typename Config::vertex_descriptor u, const adj_list_helper& g_) { typedef typename Config::graph_type AdjList; @@ -1590,7 +1598,7 @@ namespace boost { out_edge_iterator(g.out_edge_list(u).end(), u)); } template - inline std::pair vertices(const adj_list_helper& g_) { @@ -1609,7 +1617,7 @@ namespace boost { } template inline typename Config::degree_size_type - out_degree(typename Config::vertex_descriptor u, + out_degree(typename Config::vertex_descriptor u, const adj_list_helper& g_) { typedef typename Config::graph_type AdjList; @@ -1618,8 +1626,8 @@ namespace boost { } template inline std::pair - edge(typename Config::vertex_descriptor u, - typename Config::vertex_descriptor v, + edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, const adj_list_helper& g_) { typedef typename Config::graph_type Graph; @@ -1642,8 +1650,8 @@ namespace boost { 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(), + 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), @@ -1652,7 +1660,7 @@ namespace boost { template inline typename Config::degree_size_type - in_degree(typename Config::vertex_descriptor u, + in_degree(typename Config::vertex_descriptor u, const directed_edges_helper& g_) { typedef typename Config::graph_type Graph; @@ -1666,7 +1674,7 @@ namespace boost { inline typename boost::property_map::type - get_dispatch(adj_list_helper&, Property, + get_dispatch(adj_list_helper&, Property, boost::edge_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map::type PA; @@ -1674,9 +1682,9 @@ namespace boost { } template inline - typename boost::property_map::const_type - get_dispatch(const adj_list_helper&, Property, + 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; @@ -1685,9 +1693,9 @@ namespace boost { template inline - typename boost::property_map::type - get_dispatch(adj_list_helper& g, Property, + get_dispatch(adj_list_helper& g, Property, boost::vertex_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map::type PA; @@ -1697,7 +1705,7 @@ namespace boost { inline typename boost::property_map::const_type - get_dispatch(const adj_list_helper& g, Property, + 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; @@ -1717,7 +1725,7 @@ namespace boost { } template inline - typename boost::property_map::const_type get(Property p, const adj_list_helper& g) { typedef typename property_kind::type Kind; @@ -1727,7 +1735,7 @@ namespace boost { template inline typename boost::property_traits< - typename boost::property_map::type >::reference get(Property p, adj_list_helper& g, const Key& key) { @@ -1737,7 +1745,7 @@ namespace boost { template inline typename boost::property_traits< - typename boost::property_map::const_type >::reference get(Property p, const adj_list_helper& g, const Key& key) { @@ -1746,7 +1754,7 @@ namespace boost { template inline void - put(Property p, adj_list_helper& g, + put(Property p, adj_list_helper& g, const Key& key, const Value& value) { typedef typename Config::graph_type Graph; @@ -1786,7 +1794,7 @@ namespace boost { { return 0; } - + inline adj_list_impl() { } inline adj_list_impl(const adj_list_impl& x) { @@ -1855,7 +1863,7 @@ namespace boost { 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_) + inline void copy_impl(const adj_list_impl& x_) { const Derived& x = static_cast(x_); @@ -1876,9 +1884,9 @@ namespace boost { edge_iterator ei, ei_end; for (tie(ei, ei_end) = edges(x); ei != ei_end; ++ei) { edge_descriptor e; - bool inserted; + bool inserted; vertex_descriptor s = source(*ei,x), t = target(*ei,x); - tie(e, inserted) = add_edge(vertex_map[(stored_vertex*)s], + 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); @@ -1902,6 +1910,7 @@ namespace boost { bool inserted; boost::tie(pos,inserted) = boost::graph_detail::push(g.m_vertices, v); v->m_position = pos; + g.added_vertex(v); return v; } // O(1) @@ -1910,13 +1919,19 @@ namespace boost { add_vertex(const typename Config::vertex_property_type& p, adj_list_impl& g_) { + typedef typename Config::vertex_descriptor vertex_descriptor; Derived& g = static_cast(g_); + if (optional v + = g.vertex_by_property(get_property_value(p, vertex_bundle))) + return *v; + 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; + g.added_vertex(v); return v; } // O(1) @@ -1926,6 +1941,7 @@ namespace boost { { typedef typename Config::stored_vertex stored_vertex; Derived& g = static_cast(g_); + g.removing_vertex(u); stored_vertex* su = (stored_vertex*)u; g.m_vertices.erase(su->m_position); delete su; @@ -1933,7 +1949,7 @@ namespace boost { // O(V) template inline typename Config::vertex_descriptor - vertex(typename Config::vertices_size_type n, + vertex(typename Config::vertices_size_type n, const adj_list_impl& g_) { const Derived& g = static_cast(g_); @@ -1948,8 +1964,8 @@ namespace boost { namespace detail { template - inline void - remove_vertex_dispatch(Graph& g, vertex_descriptor u, + inline void + remove_vertex_dispatch(Graph& g, vertex_descriptor u, boost::directed_tag) { typedef typename Graph::edge_parallel_category edge_parallel_category; @@ -1962,8 +1978,8 @@ namespace boost { } template - inline void - remove_vertex_dispatch(Graph& g, vertex_descriptor u, + inline void + remove_vertex_dispatch(Graph& g, vertex_descriptor u, boost::undirected_tag) { typedef typename Graph::global_edgelist_selector EdgeListS; @@ -1973,7 +1989,7 @@ namespace boost { 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, + reindex_edge_list(g.out_edge_list(v), u, edge_parallel_category()); typedef typename Graph::EdgeContainer Container; typedef typename Container::iterator Iter; @@ -1986,8 +2002,8 @@ namespace boost { } } template - inline void - remove_vertex_dispatch(Graph& g, vertex_descriptor u, + inline void + remove_vertex_dispatch(Graph& g, vertex_descriptor u, boost::bidirectional_tag) { typedef typename Graph::global_edgelist_selector EdgeListS; @@ -1999,10 +2015,10 @@ namespace boost { vertex_descriptor v; if (u != V) { for (v = 0; v < V; ++v) - reindex_edge_list(g.out_edge_list(v), u, + 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, + reindex_edge_list(in_edge_list(g, v), u, edge_parallel_category()); typedef typename Graph::EdgeContainer Container; @@ -2019,7 +2035,7 @@ namespace boost { template inline void - reindex_edge_list(EdgeList& el, vertex_descriptor u, + reindex_edge_list(EdgeList& el, vertex_descriptor u, boost::allow_parallel_edge_tag) { typename EdgeList::iterator ei = el.begin(), e_end = el.end(); @@ -2029,7 +2045,7 @@ namespace boost { } template inline void - reindex_edge_list(EdgeList& el, vertex_descriptor u, + reindex_edge_list(EdgeList& el, vertex_descriptor u, boost::disallow_parallel_edge_tag) { typename EdgeList::iterator ei = el.begin(), e_end = el.end(); @@ -2046,14 +2062,14 @@ namespace boost { } // 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; + typedef typename Config::StoredVertexList StoredVertexList; public: typedef typename Config::vertex_descriptor vertex_descriptor; typedef typename Config::edge_descriptor edge_descriptor; @@ -2073,7 +2089,7 @@ namespace boost { { return (std::numeric_limits::max)(); } - + inline vec_adj_list_impl() { } inline vec_adj_list_impl(const vec_adj_list_impl& x) { @@ -2098,7 +2114,7 @@ namespace boost { : m_vertices(num_vertices) { while (first != last) { - add_edge((*first).first, (*first).second, + add_edge((*first).first, (*first).second, static_cast(*this)); ++first; } @@ -2110,7 +2126,7 @@ namespace boost { : m_vertices(num_vertices) { while (first != last) { - add_edge((*first).first, (*first).second, *ep_iter, + add_edge((*first).first, (*first).second, *ep_iter, static_cast(*this)); ++first; ++ep_iter; @@ -2127,7 +2143,7 @@ namespace boost { 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_) + 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 @@ -2141,7 +2157,7 @@ namespace boost { edge_iterator ei, ei_end; for (tie(ei, ei_end) = edges(x); ei != ei_end; ++ei) { edge_descriptor e; - bool inserted; + 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); @@ -2153,14 +2169,14 @@ namespace boost { // 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, + 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, + 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; } @@ -2171,6 +2187,7 @@ namespace boost { add_vertex(vec_adj_list_impl& g_) { Graph& g = static_cast(g_); g.m_vertices.resize(g.m_vertices.size() + 1); + g.added_vertex(g.m_vertices.size() - 1); return g.m_vertices.size() - 1; } @@ -2178,9 +2195,14 @@ namespace boost { inline typename Config::vertex_descriptor add_vertex(const typename Config::vertex_property_type& p, vec_adj_list_impl& g_) { + typedef typename Config::vertex_descriptor vertex_descriptor; Graph& g = static_cast(g_); + if (optional v + = g.vertex_by_property(get_property_value(p, vertex_bundle))) + return *v; typedef typename Config::stored_vertex stored_vertex; g.m_vertices.push_back(stored_vertex(p)); + g.added_vertex(g.m_vertices.size() - 1); return g.m_vertices.size() - 1; } @@ -2189,7 +2211,7 @@ namespace boost { // either u or v is greater than the number of vertices. template inline std::pair - add_edge(typename Config::vertex_descriptor u, + add_edge(typename Config::vertex_descriptor u, typename Config::vertex_descriptor v, const typename Config::edge_property_type& p, vec_adj_list_impl& g_) @@ -2203,7 +2225,7 @@ namespace boost { } template inline std::pair - add_edge(typename Config::vertex_descriptor u, + add_edge(typename Config::vertex_descriptor u, typename Config::vertex_descriptor v, vec_adj_list_impl& g_) { @@ -2219,12 +2241,13 @@ namespace boost { { typedef typename Config::directed_category Cat; Graph& g = static_cast(g_); + g.removing_vertex(v); detail::remove_vertex_dispatch(g, v, Cat()); } // O(1) template - inline typename Config::vertex_descriptor - vertex(typename Config::vertices_size_type n, + inline typename Config::vertex_descriptor + vertex(typename Config::vertices_size_type n, const vec_adj_list_impl&) { return n; @@ -2237,13 +2260,13 @@ namespace boost { // Adjacency List Generator template struct adj_list_gen { - typedef typename detail::is_random_access::type + typedef typename detail::is_random_access::type is_rand_access; - typedef typename has_property::type has_edge_property; + typedef typename has_property::type has_edge_property; typedef typename DirectedS::is_directed_t DirectedT; typedef typename DirectedS::is_bidir_t BidirectionalT; @@ -2258,7 +2281,7 @@ namespace boost { typedef GraphProperty graph_property_type; typedef std::size_t vertices_size_type; - typedef adjacency_list_traits + typedef adjacency_list_traits Traits; typedef typename Traits::directed_category directed_category; @@ -2266,15 +2289,15 @@ namespace boost { typedef typename Traits::vertex_descriptor vertex_descriptor; typedef typename Traits::edge_descriptor edge_descriptor; - typedef void* vertex_ptr; + 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 boost::integer_range RandVertexList; typedef typename mpl::if_::type VertexList; @@ -2282,10 +2305,10 @@ namespace boost { // EdgeContainer and StoredEdge - typedef typename container_gen >::type EdgeContainer; - typedef typename mpl::and_::type >::type on_edge_storage; typedef typename mpl::if_::type + typedef typename container_gen::type OutEdgeList; typedef typename OutEdgeList::size_type degree_size_type; typedef typename OutEdgeList::iterator OutEdgeIter; @@ -2343,10 +2366,10 @@ namespace boost { typedef undirected_edge_iter< EdgeIter , edge_descriptor - , EdgeIterDiff + , EdgeIterDiff > UndirectedEdgeIter; // also used for bidirectional - typedef adj_list_edge_iterator DirectedEdgeIter; typedef typename mpl::if_ struct adj_list_edge_property_map - : public put_get_helper< + : public put_get_helper< Ref, - adj_list_edge_property_map > { @@ -2652,7 +2675,7 @@ namespace boost { class Vertex> struct adj_list_edge_all_properties_map : public put_get_helper > { @@ -2677,12 +2700,12 @@ namespace boost { 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; }; }; @@ -2693,7 +2716,7 @@ namespace boost { type; typedef adj_list_edge_all_properties_map - const_type; }; }; @@ -2723,11 +2746,11 @@ namespace boost { }; } // namespace detail - template <> + template <> struct edge_property_selector { typedef detail::adj_list_edge_property_selector type; }; - template <> + template <> struct edge_property_selector { typedef detail::adj_list_edge_property_selector type; }; @@ -2742,7 +2765,7 @@ namespace boost { typedef typename Choice::const_type const_type; }; }; - template <> + template <> struct vertex_property_selector { typedef adj_list_vertex_property_selector type; }; @@ -2755,7 +2778,7 @@ namespace boost { typedef typename Choice::const_type const_type; }; }; - template <> + template <> struct vertex_property_selector { typedef vec_adj_list_vertex_property_selector type; }; @@ -2777,7 +2800,7 @@ namespace BOOST_STD_EXTENSION_NAMESPACE { #endif template - struct hash< boost::detail::stored_edge > + struct hash< boost::detail::stored_edge > { std::size_t operator()(const boost::detail::stored_edge& e) const @@ -2787,7 +2810,7 @@ namespace BOOST_STD_EXTENSION_NAMESPACE { }; template - struct hash< boost::detail::stored_edge_property > + struct hash< boost::detail::stored_edge_property > { std::size_t operator()(const boost::detail::stored_edge_property& e) const @@ -2797,7 +2820,7 @@ namespace BOOST_STD_EXTENSION_NAMESPACE { }; template - struct hash< boost::detail::stored_edge_iter > + struct hash< boost::detail::stored_edge_iter > { std::size_t operator()(const boost::detail::stored_edge_iter& e) const @@ -2823,17 +2846,17 @@ namespace BOOST_STD_EXTENSION_NAMESPACE { /* 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 + 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. diff --git a/deal.II/contrib/boost/include/boost/graph/detail/array_binary_tree.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/array_binary_tree.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/detail/array_binary_tree.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/array_binary_tree.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/compressed_sparse_row_struct.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/compressed_sparse_row_struct.hpp new file mode 100644 index 0000000000..1146c77d80 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/compressed_sparse_row_struct.hpp @@ -0,0 +1,649 @@ +// Copyright 2005-2009 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 internal structure + +#ifndef BOOST_GRAPH_COMPRESSED_SPARSE_ROW_STRUCT_HPP +#define BOOST_GRAPH_COMPRESSED_SPARSE_ROW_STRUCT_HPP + +#ifndef BOOST_GRAPH_COMPRESSED_SPARSE_ROW_GRAPH_HPP +#error This file should only be included from boost/graph/compressed_sparse_row_graph.hpp +#endif + +#include +#include +#include +#include +#include +#include +#if 0 +#include // For some debugging code below +#endif +#include +#include +#include // For keep_all +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + +namespace detail { + // Forward declaration of CSR edge descriptor type, needed to pass to + // indexed_edge_properties. + template + class csr_edge_descriptor; + + /** Compressed sparse row graph internal structure. + * + * Vertex and EdgeIndex should be unsigned integral types and should + * specialize numeric_limits. + */ + template + class compressed_sparse_row_structure : + public detail::indexed_edge_properties< + compressed_sparse_row_structure, + EdgeProperty, + csr_edge_descriptor > { + public: + typedef detail::indexed_edge_properties< + compressed_sparse_row_structure, + EdgeProperty, + csr_edge_descriptor > + inherited_edge_properties; + + typedef Vertex vertices_size_type; + typedef Vertex vertex_descriptor; + typedef EdgeIndex edges_size_type; + + static vertex_descriptor null_vertex() { return vertex_descriptor(-1); } + + std::vector m_rowstart; + std::vector m_column; +#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE + // This member is only needed to support add_edge(), which is not provided by + // the new interface + Vertex m_last_source; // Last source of added edge, plus one +#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE + + compressed_sparse_row_structure(Vertex numverts = 0) + : m_rowstart(numverts + 1, EdgeIndex(0)), m_column() +#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE + , m_last_source(numverts) +#endif + {} + + // Rebuild graph from number of vertices and multi-pass unsorted list of + // edges (filtered using source_pred and mapped using global_to_local) + template + void + assign_unsorted_multi_pass_edges(MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred) { + m_rowstart.clear(); + m_rowstart.resize(numlocalverts + 1, 0); + typedef std::pair edge_type; + typedef boost::transform_iterator, MultiPassInputIterator> source_iterator; + typedef boost::transform_iterator, MultiPassInputIterator> target_iterator; + source_iterator sources_begin(edge_begin, boost::graph::detail::project1st()); + source_iterator sources_end(edge_end, boost::graph::detail::project1st()); + target_iterator targets_begin(edge_begin, boost::graph::detail::project2nd()); + target_iterator targets_end(edge_end, boost::graph::detail::project2nd()); + + boost::graph::detail::count_starts + (sources_begin, sources_end, m_rowstart.begin(), numlocalverts, + source_pred, boost::make_property_map_function(global_to_local)); + + m_column.resize(m_rowstart.back()); + + boost::graph::detail::histogram_sort + (sources_begin, sources_end, m_rowstart.begin(), numlocalverts, + targets_begin, m_column.begin(), + source_pred, boost::make_property_map_function(global_to_local)); + } + + // Rebuild graph from number of vertices and multi-pass unsorted list of + // edges and their properties (filtered using source_pred and mapped using + // global_to_local) + template + void + assign_unsorted_multi_pass_edges(MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred) { + m_rowstart.clear(); + m_rowstart.resize(numlocalverts + 1, 0); + typedef std::pair edge_type; + typedef boost::transform_iterator, MultiPassInputIterator> source_iterator; + typedef boost::transform_iterator, MultiPassInputIterator> target_iterator; + source_iterator sources_begin(edge_begin, boost::graph::detail::project1st()); + source_iterator sources_end(edge_end, boost::graph::detail::project1st()); + target_iterator targets_begin(edge_begin, boost::graph::detail::project2nd()); + target_iterator targets_end(edge_end, boost::graph::detail::project2nd()); + + boost::graph::detail::count_starts + (sources_begin, sources_end, m_rowstart.begin(), numlocalverts, + source_pred, boost::make_property_map_function(global_to_local)); + + m_column.resize(m_rowstart.back()); + inherited_edge_properties::resize(m_rowstart.back()); + + boost::graph::detail::histogram_sort + (sources_begin, sources_end, m_rowstart.begin(), numlocalverts, + targets_begin, m_column.begin(), + ep_iter, inherited_edge_properties::begin(), + source_pred, boost::make_property_map_function(global_to_local)); + } + + // Assign from number of vertices and sorted list of edges + template + void assign_from_sorted_edges( + InputIterator edge_begin, InputIterator edge_end, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + vertices_size_type numlocalverts, + edges_size_type numedges_or_zero) { + m_column.clear(); + m_column.reserve(numedges_or_zero); + m_rowstart.resize(numlocalverts + 1); + EdgeIndex current_edge = 0; + Vertex current_vertex_plus_one = 1; + m_rowstart[0] = 0; + for (InputIterator ei = edge_begin; ei != edge_end; ++ei) { + if (!source_pred(ei->first)) continue; + Vertex src = get(global_to_local, 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 != numlocalverts + 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()); + } + + // Assign from number of vertices and sorted list of edges + template + void assign_from_sorted_edges( + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + vertices_size_type numlocalverts, + edges_size_type numedges_or_zero) { + // 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. + edges_size_type numedges = numedges_or_zero; + if (numedges == 0) { + typedef typename std::iterator_traits::iterator_category + category; + numedges = boost::graph::detail::reserve_count_for_single_pass(edge_begin, edge_end); + } + m_column.clear(); + m_column.reserve(numedges_or_zero); + inherited_edge_properties::clear(); + inherited_edge_properties::reserve(numedges_or_zero); + m_rowstart.resize(numlocalverts + 1); + 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) { + if (!source_pred(ei->first)) continue; + Vertex src = get(global_to_local, 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 != numlocalverts + 1; ++current_vertex_plus_one) + m_rowstart[current_vertex_plus_one] = current_edge; + } + + // Replace graph with sources and targets given, sorting them in-place, and + // using the given global-to-local property map to get local indices from + // global ones in the two arrays. + template + void assign_sources_and_targets_global(std::vector& sources, + std::vector& targets, + vertices_size_type numverts, + GlobalToLocal global_to_local) { + assert (sources.size() == targets.size()); + // Do an in-place histogram sort (at least that's what I think it is) to + // sort sources and targets + m_rowstart.clear(); + m_rowstart.resize(numverts + 1); + boost::graph::detail::count_starts + (sources.begin(), sources.end(), m_rowstart.begin(), numverts, + keep_all(), boost::make_property_map_function(global_to_local)); + boost::graph::detail::histogram_sort_inplace + (sources.begin(), sources.end(), m_rowstart.begin(), numverts, + targets.begin(), boost::make_property_map_function(global_to_local)); + // Now targets is the correct vector (properly sorted by source) for + // m_column + m_column.swap(targets); + } + + // Replace graph with sources and targets and edge properties given, sorting + // them in-place, and using the given global-to-local property map to get + // local indices from global ones in the two arrays. + template + void assign_sources_and_targets_global(std::vector& sources, + std::vector& targets, + std::vector& edge_props, + vertices_size_type numverts, + GlobalToLocal global_to_local) { + assert (sources.size() == targets.size()); + assert (sources.size() == edge_props.size()); + // Do an in-place histogram sort (at least that's what I think it is) to + // sort sources and targets + m_rowstart.clear(); + m_rowstart.resize(numverts + 1); + boost::graph::detail::count_starts + (sources.begin(), sources.end(), m_rowstart.begin(), numverts, + keep_all(), boost::make_property_map_function(global_to_local)); + boost::graph::detail::histogram_sort_inplace + (sources.begin(), sources.end(), m_rowstart.begin(), numverts, + targets.begin(), edge_props.begin(), + boost::make_property_map_function(global_to_local)); + // Now targets is the correct vector (properly sorted by source) for + // m_column, and edge_props for m_edge_properties + m_column.swap(targets); + this->m_edge_properties.swap(edge_props); + } + + // From any graph (slow and uses a lot of memory) + // Requires IncidenceGraph and a vertex index map + // Internal helper function + // Note that numedges must be doubled for undirected source graphs + template + void + assign(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, edges_size_type numedges) + { + 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; + + std::vector ordered_verts_of_g(numverts); + BGL_FORALL_VERTICES_T(v, g, Graph) { + ordered_verts_of_g[get(vertex_index, g, v)] = v; + } + for (Vertex i = 0; i != numverts; ++i) { + m_rowstart[i] = current_edge; + g_vertex v = ordered_verts_of_g[i]; +#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE + // Out edges in a single vertex are only sorted for the old interface + EdgeIndex num_edges_before_this_vertex = current_edge; +#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE + 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)); + } +#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE + // Out edges in a single vertex are only sorted for the old interface + std::sort(m_column.begin() + num_edges_before_this_vertex, + m_column.begin() + current_edge); +#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE + } + m_rowstart[numverts] = current_edge; +#ifdef BOOST_GRAPH_USE_OLD_CSR_INTERFACE + m_last_source = numverts; +#endif // BOOST_GRAPH_USE_OLD_CSR_INTERFACE + } + + // Add edges from a sorted (smallest sources first) range of pairs and edge + // properties + template + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local) { + typedef boost::reverse_iterator BidirectionalIterator; + typedef boost::reverse_iterator EPIter; + // Flip sequence + BidirectionalIterator first(last_sorted); + BidirectionalIterator last(first_sorted); + typedef Vertex vertex_t; + typedef Vertex vertex_num; + typedef EdgeIndex edge_num; + edge_num new_edge_count = std::distance(first, last); + + EPIter ep_iter(ep_iter_sorted); + std::advance(ep_iter, -(std::ptrdiff_t)new_edge_count); + edge_num edges_added_before_i = new_edge_count; // Count increment to add to rowstarts + m_column.resize(m_column.size() + new_edge_count); + inherited_edge_properties::resize(inherited_edge_properties::size() + new_edge_count); + BidirectionalIterator current_new_edge = first, prev_new_edge = first; + EPIter current_new_edge_prop = ep_iter; + for (vertex_num i_plus_1 = m_rowstart.size() - 1; i_plus_1 > 0; --i_plus_1) { + vertex_num i = i_plus_1 - 1; + prev_new_edge = current_new_edge; + // edges_added_to_this_vertex = #mbrs of new_edges with first == i + edge_num edges_added_to_this_vertex = 0; + while (current_new_edge != last) { + if (get(global_to_local, current_new_edge->first) != i) break; + ++current_new_edge; + ++current_new_edge_prop; + ++edges_added_to_this_vertex; + } + edges_added_before_i -= edges_added_to_this_vertex; + // Invariant: edges_added_before_i = #mbrs of new_edges with first < i + edge_num old_rowstart = m_rowstart[i]; + edge_num new_rowstart = m_rowstart[i] + edges_added_before_i; + edge_num old_degree = m_rowstart[i + 1] - m_rowstart[i]; + edge_num new_degree = old_degree + edges_added_to_this_vertex; + // Move old edges forward (by #new_edges before this i) to make room + // new_rowstart > old_rowstart, so use copy_backwards + if (old_rowstart != new_rowstart) { + std::copy_backward(m_column.begin() + old_rowstart, + m_column.begin() + old_rowstart + old_degree, + m_column.begin() + new_rowstart + old_degree); + inherited_edge_properties::move_range(old_rowstart, old_rowstart + old_degree, new_rowstart); + } + // Add new edges (reversed because current_new_edge is a + // const_reverse_iterator) + BidirectionalIterator temp = current_new_edge; + EPIter temp_prop = current_new_edge_prop; + for (; temp != prev_new_edge; ++old_degree) { + --temp; + --temp_prop; + m_column[new_rowstart + old_degree] = temp->second; + inherited_edge_properties::write_by_index(new_rowstart + old_degree, *temp_prop); + } + m_rowstart[i + 1] = new_rowstart + new_degree; + if (edges_added_before_i == 0) break; // No more edges inserted before this point + // m_rowstart[i] will be fixed up on the next iteration (to avoid + // changing the degree of vertex i - 1); the last iteration never changes + // it (either because of the condition of the break or because + // m_rowstart[0] is always 0) + } + } + + }; + + 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;} + + template + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & src & idx; + } + }; + + // Common out edge and edge iterators + template + class csr_out_edge_iterator + : public iterator_facade, + typename CSRGraph::edge_descriptor, + std::random_access_iterator_tag, + const typename CSRGraph::edge_descriptor&, + typename int_t::fast> + { + public: + typedef typename CSRGraph::edges_size_type EdgeIndex; + typedef typename CSRGraph::edge_descriptor edge_descriptor; + typedef typename int_t::fast difference_type; + + csr_out_edge_iterator() {} + // Implicit copy constructor OK + explicit csr_out_edge_iterator(edge_descriptor edge) : m_edge(edge) { } + + public: // GCC 4.2.1 doesn't like the private-and-friend thing + // iterator_facade requirements + const edge_descriptor& dereference() const { return m_edge; } + + bool equal(const csr_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 csr_out_edge_iterator& other) const + { return other.m_edge.idx - m_edge.idx; } + + edge_descriptor m_edge; + + friend class iterator_core_access; + }; + + template + class csr_edge_iterator + : public iterator_facade, + typename CSRGraph::edge_descriptor, + boost::forward_traversal_tag, + typename CSRGraph::edge_descriptor> + { + private: + typedef typename CSRGraph::edge_descriptor edge_descriptor; + typedef typename CSRGraph::edges_size_type EdgeIndex; + + public: + csr_edge_iterator() : rowstart_array(0), current_edge(), end_of_this_vertex(0), total_num_edges(0) {} + + csr_edge_iterator(const CSRGraph& graph, + edge_descriptor current_edge, + EdgeIndex end_of_this_vertex) + : rowstart_array(&graph.m_forward.m_rowstart[0]), + current_edge(current_edge), + end_of_this_vertex(end_of_this_vertex), + total_num_edges(num_edges(graph)) {} + + public: // See above + friend class boost::iterator_core_access; + + edge_descriptor dereference() const {return current_edge;} + + bool equal(const csr_edge_iterator& o) const { + return current_edge == o.current_edge; + } + + void increment() { + ++current_edge.idx; + if (current_edge.idx == total_num_edges) return; + while (current_edge.idx == end_of_this_vertex) { + ++current_edge.src; + end_of_this_vertex = rowstart_array[current_edge.src + 1]; + } + } + + const EdgeIndex* rowstart_array; + edge_descriptor current_edge; + EdgeIndex end_of_this_vertex; + EdgeIndex total_num_edges; + }; + + // Only for bidirectional graphs + template + class csr_in_edge_iterator + : public iterator_facade, + typename CSRGraph::edge_descriptor, + boost::forward_traversal_tag, + typename CSRGraph::edge_descriptor> + { + public: + typedef typename CSRGraph::edges_size_type EdgeIndex; + typedef typename CSRGraph::edge_descriptor edge_descriptor; + + csr_in_edge_iterator() {} + // Implicit copy constructor OK + csr_in_edge_iterator(const CSRGraph& graph, + EdgeIndex index_in_backward_graph) + : m_graph(graph), m_index_in_backward_graph(index_in_backward_graph) {} + + public: // See above + // iterator_facade requirements + edge_descriptor dereference() const { + return edge_descriptor( + m_graph.m_backward.m_column[m_index_in_backward_graph], + m_graph.m_backward.m_edge_properties[m_index_in_backward_graph]); + } + + bool equal(const csr_in_edge_iterator& other) const + { return m_index_in_backward_graph == other.m_index_in_backward_graph; } + + void increment() { ++m_index_in_backward_graph; } + void decrement() { --m_index_in_backward_graph; } + void advance(std::ptrdiff_t n) { m_index_in_backward_graph += n; } + + std::ptrdiff_t distance_to(const csr_in_edge_iterator& other) const + { return other.m_index_in_backward_graph - m_index_in_backward_graph; } + + EdgeIndex m_index_in_backward_graph; + const CSRGraph& m_graph; + + friend class iterator_core_access; + }; + + template + struct transpose_pair { + typedef std::pair result_type; + result_type operator()(const std::pair& p) const { + return result_type(p.second, p.first); + } + }; + + template + struct transpose_iterator_gen { + typedef typename std::iterator_traits::value_type vt; + typedef typename vt::first_type first_type; + typedef typename vt::second_type second_type; + typedef transpose_pair transpose; + typedef boost::transform_iterator type; + static type make(Iter it) { + return type(it, transpose()); + } + }; + + template + typename transpose_iterator_gen::type transpose_edges(Iter i) { + return transpose_iterator_gen::make(i); + } + + template + class edge_to_index_pair + { + typedef typename boost::graph_traits::vertices_size_type + vertices_size_type; + typedef typename boost::graph_traits::edge_descriptor edge_descriptor; + + public: + typedef std::pair result_type; + + edge_to_index_pair() : g(0), index() { } + edge_to_index_pair(const GraphT& g, const VertexIndexMap& index) + : g(&g), index(index) + { } + + result_type operator()(edge_descriptor e) const + { + return result_type(get(index, source(e, *g)), get(index, target(e, *g))); + } + + private: + const GraphT* g; + VertexIndexMap index; + }; + + template + edge_to_index_pair + make_edge_to_index_pair(const GraphT& g, const VertexIndexMap& index) + { + return edge_to_index_pair(g, index); + } + + template + edge_to_index_pair + ::const_type> + make_edge_to_index_pair(const GraphT& g) + { + typedef typename boost::property_map::const_type + VertexIndexMap; + return edge_to_index_pair(g, + get(boost::vertex_index, + g)); + } + + template + boost::transform_iterator, Iter> + make_edge_to_index_pair_iter(const GraphT& g, const VertexIndexMap& index, + Iter it) { + return boost::transform_iterator, Iter>(it, edge_to_index_pair(g, index)); + } + +} // namespace detail + + template + struct hash > + { + std::size_t operator() + (detail::csr_edge_descriptor const& x) const + { + std::size_t hash = hash_value(x.src); + hash_combine(hash, x.idx); + return hash; + } + }; + +} // namespace boost + +#endif // BOOST_GRAPH_COMPRESSED_SPARSE_ROW_STRUCT_HPP diff --git a/deal.II/contrib/boost/include/boost/graph/detail/connected_components.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/connected_components.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/detail/connected_components.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/connected_components.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/d_ary_heap.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/d_ary_heap.hpp new file mode 100644 index 0000000000..2ec716d3af --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/d_ary_heap.hpp @@ -0,0 +1,305 @@ +// +//======================================================================= +// Copyright 2009 Trustees of Indiana University +// Authors: Jeremiah J. Willcock, 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) +//======================================================================= +// +#ifndef BOOST_D_ARY_HEAP_HPP +#define BOOST_D_ARY_HEAP_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + // Swap two elements in a property map without assuming they model + // LvaluePropertyMap -- currently not used + template + inline void property_map_swap( + PropMap prop_map, + const typename boost::property_traits::key_type& ka, + const typename boost::property_traits::key_type& kb) { + typename boost::property_traits::value_type va = get(prop_map, ka); + put(prop_map, ka, get(prop_map, kb)); + put(prop_map, kb, va); + } + + namespace detail { + template + class fixed_max_size_vector { + boost::shared_array m_data; + std::size_t m_size; + + public: + typedef std::size_t size_type; + fixed_max_size_vector(std::size_t max_size) + : m_data(new Value[max_size]), m_size(0) {} + std::size_t size() const {return m_size;} + bool empty() const {return m_size == 0;} + Value& operator[](std::size_t i) {return m_data[i];} + const Value& operator[](std::size_t i) const {return m_data[i];} + void push_back(Value v) {m_data[m_size++] = v;} + void pop_back() {--m_size;} + Value& back() {return m_data[m_size - 1];} + const Value& back() const {return m_data[m_size - 1];} + }; + } + + // D-ary heap using an indirect compare operator (use identity_property_map + // as DistanceMap to get a direct compare operator). This heap appears to be + // commonly used for Dijkstra's algorithm for its good practical performance + // on some platforms; asymptotically, it has an O(lg N) decrease-key + // operation while that can be done in constant time on a relaxed heap. The + // implementation is mostly based on the binary heap page on Wikipedia and + // online sources that state that the operations are the same for d-ary + // heaps. This code is not based on the old Boost d-ary heap code. + // + // - d_ary_heap_indirect is a model of UpdatableQueue as is needed for + // dijkstra_shortest_paths. + // + // - Value must model Assignable. + // - Arity must be at least 2 (optimal value appears to be 4, both in my and + // third-party experiments). + // - IndexInHeapMap must be a ReadWritePropertyMap from Value to + // Container::size_type (to store the index of each stored value within the + // heap for decrease-key aka update). + // - DistanceMap must be a ReadablePropertyMap from Value to something + // (typedef'ed as distance_type). + // - Compare must be a BinaryPredicate used as a less-than operator on + // distance_type. + // - Container must be a random-access, contiguous container (in practice, + // the operations used probably require that it is std::vector). + // + template , + typename Container = std::vector > + class d_ary_heap_indirect { + BOOST_STATIC_ASSERT (Arity >= 2); + + public: + typedef typename Container::size_type size_type; + typedef Value value_type; + + d_ary_heap_indirect(DistanceMap distance, + IndexInHeapPropertyMap index_in_heap, + const Compare& compare = Compare(), + const Container& data = Container()) + : compare(compare), data(data), distance(distance), + index_in_heap(index_in_heap) {} + /* Implicit copy constructor */ + /* Implicit assignment operator */ + + size_type size() const { + return data.size(); + } + + bool empty() const { + return data.empty(); + } + + void push(const Value& v) { + size_type index = data.size(); + data.push_back(v); + put(index_in_heap, v, index); + preserve_heap_property_up(index); + verify_heap(); + } + + Value& top() { + return data[0]; + } + + const Value& top() const { + return data[0]; + } + + void pop() { + put(index_in_heap, data[0], (size_type)(-1)); + if (data.size() != 1) { + data[0] = data.back(); + put(index_in_heap, data[0], 0); + data.pop_back(); + preserve_heap_property_down(); + verify_heap(); + } else { + data.pop_back(); + } + } + + // This function assumes the key has been updated (using an external write + // to the distance map or such) + // See http://coding.derkeiler.com/Archive/General/comp.theory/2007-05/msg00043.html + void update(const Value& v) { /* decrease-key */ + size_type index = get(index_in_heap, v); + preserve_heap_property_up(index); + verify_heap(); + } + + bool contains(const Value& v) const { + size_type index = get(index_in_heap, v); + return (index != (size_type)(-1)); + } + + void push_or_update(const Value& v) { /* insert if not present, else update */ + size_type index = get(index_in_heap, v); + if (index == (size_type)(-1)) { + index = data.size(); + data.push_back(v); + put(index_in_heap, v, index); + } + preserve_heap_property_up(index); + verify_heap(); + } + + private: + Compare compare; + Container data; + DistanceMap distance; + IndexInHeapPropertyMap index_in_heap; + + // The distances being compared using compare and that are stored in the + // distance map + typedef typename boost::property_traits::value_type distance_type; + + // Get the parent of a given node in the heap + static size_type parent(size_type index) { + return (index - 1) / Arity; + } + + // Get the child_idx'th child of a given node; 0 <= child_idx < Arity + static size_type child(size_type index, std::size_t child_idx) { + return index * Arity + child_idx + 1; + } + + // Swap two elements in the heap by index, updating index_in_heap + void swap_heap_elements(size_type index_a, size_type index_b) { + using std::swap; + Value value_a = data[index_a]; + Value value_b = data[index_b]; + data[index_a] = value_b; + data[index_b] = value_a; + put(index_in_heap, value_a, index_b); + put(index_in_heap, value_b, index_a); + } + + // Emulate the indirect_cmp that is now folded into this heap class + bool compare_indirect(const Value& a, const Value& b) const { + return compare(get(distance, a), get(distance, b)); + } + + // Verify that the array forms a heap; commented out by default + void verify_heap() const { + // This is a very expensive test so it should be disabled even when + // NDEBUG is not defined +#if 0 + for (size_t i = 1; i < data.size(); ++i) { + if (compare_indirect(data[i], data[parent(i)])) { + assert (!"Element is smaller than its parent"); + } + } +#endif + } + + // Starting at a node, move up the tree swapping elements to preserve the + // heap property + void preserve_heap_property_up(size_type index) { + size_type orig_index = index; + size_type num_levels_moved = 0; + // The first loop just saves swaps that need to be done in order to avoid + // aliasing issues in its search; there is a second loop that does the + // necessary swap operations + if (index == 0) return; // Do nothing on root + Value currently_being_moved = data[index]; + distance_type currently_being_moved_dist = + get(distance, currently_being_moved); + for (;;) { + if (index == 0) break; // Stop at root + size_type parent_index = parent(index); + Value parent_value = data[parent_index]; + if (compare(currently_being_moved_dist, get(distance, parent_value))) { + ++num_levels_moved; + index = parent_index; + continue; + } else { + break; // Heap property satisfied + } + } + // Actually do the moves -- move num_levels_moved elements down in the + // tree, then put currently_being_moved at the top + index = orig_index; + for (size_type i = 0; i < num_levels_moved; ++i) { + size_type parent_index = parent(index); + Value parent_value = data[parent_index]; + put(index_in_heap, parent_value, index); + data[index] = parent_value; + index = parent_index; + } + data[index] = currently_being_moved; + put(index_in_heap, currently_being_moved, index); + verify_heap(); + } + + // From the root, swap elements (each one with its smallest child) if there + // are any parent-child pairs that violate the heap property + void preserve_heap_property_down() { + if (data.empty()) return; + size_type index = 0; + Value currently_being_moved = data[0]; + distance_type currently_being_moved_dist = + get(distance, currently_being_moved); + size_type heap_size = data.size(); + Value* data_ptr = &data[0]; + for (;;) { + size_type first_child_index = child(index, 0); + if (first_child_index >= heap_size) break; /* No children */ + Value* child_base_ptr = data_ptr + first_child_index; + size_type smallest_child_index = 0; + distance_type smallest_child_dist = get(distance, child_base_ptr[smallest_child_index]); + if (first_child_index + Arity <= heap_size) { + // Special case for a statically known loop count (common case) + for (size_t i = 1; i < Arity; ++i) { + Value i_value = child_base_ptr[i]; + distance_type i_dist = get(distance, i_value); + if (compare(i_dist, smallest_child_dist)) { + smallest_child_index = i; + smallest_child_dist = i_dist; + } + } + } else { + for (size_t i = 1; i < heap_size - first_child_index; ++i) { + distance_type i_dist = get(distance, child_base_ptr[i]); + if (compare(i_dist, smallest_child_dist)) { + smallest_child_index = i; + smallest_child_dist = i_dist; + } + } + } + if (compare(smallest_child_dist, currently_being_moved_dist)) { + swap_heap_elements(smallest_child_index + first_child_index, index); + index = smallest_child_index + first_child_index; + continue; + } else { + break; // Heap property satisfied + } + } + verify_heap(); + } + + }; + +} // namespace boost + +#endif // BOOST_D_ARY_HEAP_HPP diff --git a/deal.II/contrib/boost/include/boost/graph/detail/edge.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/edge.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/detail/edge.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/edge.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/geodesic.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/geodesic.hpp new file mode 100644 index 0000000000..99edaf9e39 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/geodesic.hpp @@ -0,0 +1,130 @@ +// (C) Copyright 2007 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_DETAIL_GEODESIC_HPP +#define BOOST_GRAPH_DETAIL_GEODESIC_HPP + +#include +#include +#include +#include + +// TODO: Should this really be in detail? + +namespace boost +{ +// This is a very good discussion on centrality measures. While I can't +// say that this has been the motivating factor for the design and +// implementation of ths centrality framework, it does provide a single +// point of reference for defining things like degree and closeness +// centrality. Plus, the bibliography seems fairly complete. +// +// @article{citeulike:1144245, +// author = {Borgatti, Stephen P. and Everett, Martin G.}, +// citeulike-article-id = {1144245}, +// doi = {10.1016/j.socnet.2005.11.005}, +// journal = {Social Networks}, +// month = {October}, +// number = {4}, +// pages = {466--484}, +// priority = {0}, +// title = {A Graph-theoretic perspective on centrality}, +// url = {http://dx.doi.org/10.1016/j.socnet.2005.11.005}, +// volume = {28}, +// year = {2006} +// } +// } + +namespace detail { + // Note that this assumes T == property_traits::value_type + // and that the args and return of combine are also T. + template + inline Distance + combine_distances(const Graph& g, + DistanceMap dist, + Combinator combine, + Distance init) + { + function_requires< VertexListGraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertex_iterator VertexIterator; + function_requires< ReadablePropertyMapConcept >(); + function_requires< NumericValueConcept >(); + typedef numeric_values DistanceNumbers; + function_requires< AdaptableBinaryFunction >(); + + // If there's ever an infinite distance, then we simply return + // infinity. Note that this /will/ include the a non-zero + // distance-to-self in the combined values. However, this is usually + // zero, so it shouldn't be too problematic. + Distance ret = init; + VertexIterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + Vertex v = *i; + if(get(dist, v) != DistanceNumbers::infinity()) { + ret = combine(ret, get(dist, v)); + } + else { + ret = DistanceNumbers::infinity(); + break; + } + } + return ret; + } + + // Similar to std::plus, but maximizes parameters + // rather than adding them. + template + struct maximize : public std::binary_function + { + T operator ()(T x, T y) const + { BOOST_USING_STD_MAX(); return max BOOST_PREVENT_MACRO_SUBSTITUTION (x, y); } + }; + + // Another helper, like maximize() to help abstract functional + // concepts. This is trivially instantiated for builtin numeric + // types, but should be specialized for those types that have + // discrete notions of reciprocals. + template + struct reciprocal : public std::unary_function + { + typedef std::unary_function function_type; + typedef typename function_type::result_type result_type; + typedef typename function_type::argument_type argument_type; + T operator ()(T t) + { return T(1) / t; } + }; +} /* namespace detail */ + +// This type defines the basic facilities used for computing values +// based on the geodesic distances between vertices. Examples include +// closeness centrality and mean geodesic distance. +template +struct geodesic_measure +{ + typedef DistanceType distance_type; + typedef ResultType result_type; + typedef typename graph_traits::vertices_size_type size_type; + + typedef numeric_values distance_values; + typedef numeric_values result_values; + + static inline distance_type infinite_distance() + { return distance_values::infinity(); } + + static inline result_type infinite_result() + { return result_values::infinity(); } + + static inline result_type zero_result() + { return result_values::zero(); } +}; + +} /* namespace boost */ + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/histogram_sort.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/histogram_sort.hpp new file mode 100644 index 0000000000..9706d25494 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/histogram_sort.hpp @@ -0,0 +1,286 @@ +// Copyright 2009 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 +// Andrew Lumsdaine + +#ifndef BOOST_GRAPH_DETAIL_HISTOGRAM_SORT_HPP +#define BOOST_GRAPH_DETAIL_HISTOGRAM_SORT_HPP + +namespace boost { + namespace graph { + namespace detail { + +template +size_t +reserve_count_for_single_pass_helper(InputIterator, InputIterator, + std::input_iterator_tag) +{ + // Do nothing: we have no idea how much storage to reserve. + return 0; +} + +template +size_t +reserve_count_for_single_pass_helper(InputIterator first, InputIterator last, + std::random_access_iterator_tag) +{ + using std::distance; + typename std::iterator_traits::difference_type n = + distance(first, last); + return (size_t)n; +} + +template +size_t +reserve_count_for_single_pass(InputIterator first, InputIterator last) { + typedef typename std::iterator_traits::iterator_category + category; + return reserve_count_for_single_pass_helper(first, last, category()); +} + +template +void +count_starts + (KeyIterator begin, KeyIterator end, + RowstartIterator starts, // Must support numverts + 1 elements + VerticesSize numkeys, + KeyFilter key_filter, + KeyTransform key_transform) { + + typedef VerticesSize vertices_size_type; + typedef typename std::iterator_traits::value_type EdgeIndex; + + // Put the degree of each vertex v into m_rowstart[v + 1] + for (KeyIterator i = begin; i != end; ++i) { + if (key_filter(*i)) { + ++starts[key_transform(*i) + 1]; + } + } + + // Compute the partial sum of the degrees to get the actual values of + // m_rowstart + EdgeIndex start_of_this_row = 0; + starts[0] = start_of_this_row; + for (vertices_size_type i = 1; i <= numkeys; ++i) { + start_of_this_row += starts[i]; + starts[i] = start_of_this_row; + } +} + +template +void +histogram_sort(KeyIterator key_begin, KeyIterator key_end, + RowstartIterator rowstart, // Must support numkeys + 1 elements and be precomputed + NumKeys numkeys, + Value1InputIter values1_begin, + Value1OutputIter values1_out, + KeyFilter key_filter, + KeyTransform key_transform) { + + typedef NumKeys vertices_size_type; + typedef typename std::iterator_traits::value_type EdgeIndex; + + // Histogram sort the edges by their source vertices, putting the targets + // into m_column. The index current_insert_positions[v] contains the next + // location to insert out edges for vertex v. + std::vector + current_insert_positions(rowstart, rowstart + numkeys); + Value1InputIter v1i = values1_begin; + for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i) { + if (key_filter(*i)) { + vertices_size_type source = key_transform(*i); + EdgeIndex insert_pos = current_insert_positions[source]; + ++current_insert_positions[source]; + values1_out[insert_pos] = *v1i; + } + } +} + +template +void +histogram_sort(KeyIterator key_begin, KeyIterator key_end, + RowstartIterator rowstart, // Must support numkeys + 1 elements and be precomputed + NumKeys numkeys, + Value1InputIter values1_begin, + Value1OutputIter values1_out, + Value2InputIter values2_begin, + Value2OutputIter values2_out, + KeyFilter key_filter, + KeyTransform key_transform) { + + typedef NumKeys vertices_size_type; + typedef typename std::iterator_traits::value_type EdgeIndex; + + // Histogram sort the edges by their source vertices, putting the targets + // into m_column. The index current_insert_positions[v] contains the next + // location to insert out edges for vertex v. + std::vector + current_insert_positions(rowstart, rowstart + numkeys); + Value1InputIter v1i = values1_begin; + Value2InputIter v2i = values2_begin; + for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i, ++v2i) { + if (key_filter(*i)) { + vertices_size_type source = key_transform(*i); + EdgeIndex insert_pos = current_insert_positions[source]; + ++current_insert_positions[source]; + values1_out[insert_pos] = *v1i; + values2_out[insert_pos] = *v2i; + } + } +} + +template +void +histogram_sort_inplace(KeyIterator key_begin, KeyIterator key_end, + RowstartIterator rowstart, // Must support numkeys + 1 elements and be precomputed + NumKeys numkeys, + Value1Iter values1, + KeyTransform key_transform) { + + typedef NumKeys vertices_size_type; + typedef typename std::iterator_traits::value_type EdgeIndex; + + // 1. Copy m_rowstart (except last element) to get insert positions + std::vector insert_positions(rowstart, rowstart + numkeys); + // 2. Swap the sources and targets into place + for (size_t i = 0; i < rowstart[numkeys]; ++i) { + // While edge i is not in the right bucket: + while (!(i >= rowstart[key_transform(key_begin[i])] && i < insert_positions[key_transform(key_begin[i])])) { + // Add a slot in the right bucket + size_t target_pos = insert_positions[key_transform(key_begin[i])]++; + assert (target_pos < rowstart[key_transform(key_begin[i]) + 1]); + if (target_pos == i) continue; + // Swap this edge into place + using std::swap; + swap(key_begin[i], key_begin[target_pos]); + swap(values1[i], values1[target_pos]); + } + } +} + +template +void +histogram_sort_inplace(KeyIterator key_begin, KeyIterator key_end, + RowstartIterator rowstart, // Must support numkeys + 1 elements and be precomputed + NumKeys numkeys, + Value1Iter values1, + Value2Iter values2, + KeyTransform key_transform) { + + typedef NumKeys vertices_size_type; + typedef typename std::iterator_traits::value_type EdgeIndex; + + // 1. Copy m_rowstart (except last element) to get insert positions + std::vector insert_positions(rowstart, rowstart + numkeys); + // 2. Swap the sources and targets into place + for (size_t i = 0; i < rowstart[numkeys]; ++i) { + // While edge i is not in the right bucket: + while (!(i >= rowstart[key_transform(key_begin[i])] && i < insert_positions[key_transform(key_begin[i])])) { + // Add a slot in the right bucket + size_t target_pos = insert_positions[key_transform(key_begin[i])]++; + assert (target_pos < rowstart[key_transform(key_begin[i]) + 1]); + if (target_pos == i) continue; + // Swap this edge into place + using std::swap; + swap(key_begin[i], key_begin[target_pos]); + swap(values1[i], values1[target_pos]); + swap(values2[i], values2[target_pos]); + } + } +} + +template +void split_into_separate_coords(InputIterator begin, InputIterator end, + std::vector& firsts, + std::vector& seconds) { + firsts.clear(); + seconds.clear(); + size_t reserve_size + = detail::reserve_count_for_single_pass(begin, end); + firsts.reserve(reserve_size); + seconds.reserve(reserve_size); + for (; begin != end; ++begin) { + std::pair edge = *begin; + firsts.push_back(edge.first); + seconds.push_back(edge.second); + } +} + +template +void split_into_separate_coords_filtered + (InputIterator begin, InputIterator end, + std::vector& firsts, + std::vector& seconds, + const SourceFilter& filter) { + firsts.clear(); + seconds.clear(); + for (; begin != end; ++begin) { + std::pair edge = *begin; + if (filter(edge.first)) { + firsts.push_back(edge.first); + seconds.push_back(edge.second); + } + } +} + +template +void split_into_separate_coords_filtered + (InputIterator begin, InputIterator end, + PropInputIterator props, + std::vector& firsts, + std::vector& seconds, + std::vector& props_out, + const SourceFilter& filter) { + firsts.clear(); + seconds.clear(); + props_out.clear(); + for (; begin != end; ++begin) { + std::pair edge = *begin; + if (filter(edge.first)) { + firsts.push_back(edge.first); + seconds.push_back(edge.second); + props_out.push_back(*props); + } + ++props; + } +} + +template +struct project1st { + typedef typename Pair::first_type result_type; + const result_type& operator()(const Pair& p) const {return p.first;} +}; + +template +struct project2nd { + typedef typename Pair::second_type result_type; + const result_type& operator()(const Pair& p) const {return p.second;} +}; + + } + } +} + +#endif // BOOST_GRAPH_DETAIL_HISTOGRAM_SORT_HPP diff --git a/deal.II/contrib/boost/include/boost/graph/detail/incidence_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/incidence_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/detail/incidence_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/incidence_iterator.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/incremental_components.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/incremental_components.hpp new file mode 100644 index 0000000000..b13b93dabe --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/incremental_components.hpp @@ -0,0 +1,77 @@ +//======================================================================= +// Copyright 2002 Indiana University. +// Copyright 2009 Trustees of Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Michael Hansen +// +// Distributed under the 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 + +namespace boost { + + namespace detail { + + // Iterator for a component index linked list. The contents of + // each array element represent the next index in the list. A + // special value (the maximum index + 1) is used to terminate a + // list. + template + class component_index_iterator : + boost::forward_iterator_helper, + typename std::iterator_traits::value_type, + typename std::iterator_traits::difference_type, + typename std::iterator_traits::pointer, + typename std::iterator_traits::reference> { + + private: + typedef component_index_iterator self; + + public: + typedef std::forward_iterator_tag iterator_category; + typedef typename std::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::difference_type reference; + typedef typename std::iterator_traits::pointer pointer; + typedef typename std::iterator_traits::reference difference_type; + + // Constructor for "begin" iterator + component_index_iterator(IndexRandomAccessIterator index_iterator, + value_type begin_index) : + m_index_iterator(index_iterator), + m_current_index(begin_index) { } + + // Constructor for "end" iterator (end_index should be the linked + // list terminator). + component_index_iterator(value_type end_index) : + m_current_index(end_index) { } + + inline value_type operator*() const { + return (m_current_index); + } + + self& operator++() { + // Move to the next element in the linked list + m_current_index = m_index_iterator[m_current_index]; + return (*this); + } + + bool operator==(self& other_iterator) { + return (m_current_index == *other_iterator); + } + + protected: + IndexRandomAccessIterator m_index_iterator; + value_type m_current_index; + + }; // class component_index_iterator + + } // namespace detail + +} // namespace detail + +#endif // BOOST_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/index.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/index.hpp new file mode 100644 index 0000000000..db1152f8c4 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/index.hpp @@ -0,0 +1,74 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_DETAIL_INDEX_HPP +#define BOOST_GRAPH_DETAIL_INDEX_HPP + +#include + +// The structures in this module are responsible for selecting and defining +// types for accessing a builting index map. Note that the selection of these +// types requires the Graph parameter to model either VertexIndexGraph or +// EdgeIndexGraph. + +namespace boost +{ + namespace detail + { + template + struct vertex_indexer + { + typedef vertex_index_t index_type; + typedef typename property_map::type map_type; + typedef typename property_map::const_type const_map_type; + typedef typename property_traits::value_type value_type; + typedef typename graph_traits::vertex_descriptor key_type; + + static const_map_type index_map(const Graph& g) + { return get(vertex_index, g); } + + static map_type index_map(Graph& g) + { return get(vertex_index, g); } + + static value_type index(key_type k, const Graph& g) + { return get(vertex_index, g, k); } + }; + + template + struct edge_indexer + { + typedef edge_index_t index_type; + typedef typename property_map::type map_type; + typedef typename property_map::const_type const_map_type; + typedef typename property_traits::value_type value_type; + typedef typename graph_traits::edge_descriptor key_type; + + static const_map_type index_map(const Graph& g) + { return get(edge_index, g); } + + static map_type index_map(Graph& g) + { return get(edge_index, g); } + + static value_type index(key_type k, const Graph& g) + { return get(edge_index, g, k); } + }; + + // NOTE: The Graph parameter MUST be a model of VertexIndexGraph or + // VertexEdgeGraph - whichever type Key is selecting. + template + struct choose_indexer + { + typedef typename mpl::if_< + is_same::vertex_descriptor>, + vertex_indexer, + edge_indexer + >::type indexer_type; + typedef typename indexer_type::index_type index_type; + }; + } +} + +#endif diff --git a/deal.II/contrib/boost/include/boost/graph/detail/indexed_properties.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/indexed_properties.hpp similarity index 70% rename from deal.II/contrib/boost/include/boost/graph/detail/indexed_properties.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/indexed_properties.hpp index 17bbdad1a4..7fa1548e24 100644 --- a/deal.II/contrib/boost/include/boost/graph/detail/indexed_properties.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/indexed_properties.hpp @@ -50,6 +50,12 @@ protected: indexed_vertex_properties(std::size_t n) : m_vertex_properties(n) { } public: + // Clear the properties vector + void clear() + { + m_vertex_properties.clear(); + } + // Resize the properties vector void resize(std::size_t n) { @@ -68,6 +74,12 @@ public: m_vertex_properties.push_back(prop); } + // Write an element by raw index + void write_by_index(std::size_t idx, const Property& prop) + { + m_vertex_properties[idx] = prop; + } + // Access to the derived object Derived& derived() { return *static_cast(this); } @@ -95,6 +107,7 @@ class indexed_vertex_properties indexed_vertex_properties(std::size_t) { } public: + void clear() { } void resize(std::size_t) { } void reserve(std::size_t) { } }; @@ -121,6 +134,18 @@ protected: // Initialize with n default-constructed property values indexed_edge_properties(std::size_t n) : m_edge_properties(n) { } + // Get the size of the properties vector + std::size_t size() const + { + return m_edge_properties.size(); + } + + // Clear the properties vector + void clear() + { + m_edge_properties.clear(); + } + // Resize the properties vector void resize(std::size_t n) { @@ -133,6 +158,12 @@ protected: m_edge_properties.reserve(n); } + // Write an element by raw index + void write_by_index(std::size_t idx, const Property& prop) + { + m_edge_properties[idx] = prop; + } + public: // Add a new property value to the back void push_back(const Property& prop) @@ -140,6 +171,18 @@ protected: m_edge_properties.push_back(prop); } + // Move range of properties backwards + void move_range(std::size_t src_begin, std::size_t src_end, std::size_t dest_begin) { + std::copy_backward( + m_edge_properties.begin() + src_begin, + m_edge_properties.begin() + src_end, + m_edge_properties.begin() + dest_begin + (src_end - src_begin)); + } + + typedef typename std::vector::iterator iterator; + iterator begin() {return m_edge_properties.begin();} + iterator end() {return m_edge_properties.end();} + private: // Access to the derived object Derived& derived() { return *static_cast(this); } @@ -151,6 +194,17 @@ public: // should be private, but friend templates not portable std::vector m_edge_properties; }; +struct dummy_no_property_iterator +: public boost::iterator_facade { + mutable no_property prop; + no_property& dereference() const {return prop;} + bool equal(const dummy_no_property_iterator&) const {return true;} + void increment() {} + void decrement() {} + void advance(std::ptrdiff_t) {} + std::ptrdiff_t distance_to(const dummy_no_property_iterator) const {return 0;} +}; + template class indexed_edge_properties { @@ -162,16 +216,25 @@ class indexed_edge_properties typedef void* edge_push_back_type; secret operator[](secret) { return secret(); } + void write_by_index(std::size_t idx, const no_property& prop) {} protected: // All operations do nothing. indexed_edge_properties() { } indexed_edge_properties(std::size_t) { } + std::size_t size() const {return 0;} + void clear() { } void resize(std::size_t) { } void reserve(std::size_t) { } public: void push_back(const edge_push_back_type&) { } + void move_range(std::size_t src_begin, std::size_t src_end, std::size_t dest_begin) {} + + typedef dummy_no_property_iterator iterator; + iterator begin() {return dummy_no_property_iterator();} + iterator end() {return dummy_no_property_iterator();} + }; } diff --git a/deal.II/contrib/boost/include/boost/graph/detail/is_same.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/is_same.hpp similarity index 72% rename from deal.II/contrib/boost/include/boost/graph/detail/is_same.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/is_same.hpp index 8027a47a77..07330d301e 100644 --- a/deal.II/contrib/boost/include/boost/graph/detail/is_same.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/is_same.hpp @@ -9,6 +9,14 @@ #ifndef BOOST_GRAPH_DETAIL_IS_SAME_HPP #define BOOST_GRAPH_DETAIL_IS_SAME_HPP +// Deprecate the use of this header. +// TODO: Remove this file from trunk/release in 1.41/1.42. +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +# pragma message ("Warning: This header is deprecated. Please use: boost/type_traits/is_same.hpp") +#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) +# warning "This header is deprecated. Please use: boost/type_traits/is_same.hpp" +#endif + #include namespace boost { diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/labeled_graph_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/labeled_graph_traits.hpp new file mode 100644 index 0000000000..f61c24a408 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/labeled_graph_traits.hpp @@ -0,0 +1,237 @@ +// Copyright (C) 2009 Andrew Sutton + +// 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 BOOST_GRAPH_LABELED_GRAPH_TRAITS_HPP +#define BOOST_GRAPH_LABELED_GRAPH_TRAITS_HPP + +#include + +namespace boost { + +// Extend the graph mutability traits (and metafunctions) to include options +// for labeled graphs. + +// NOTE: the label_vertex tag denotes the fact that you can basically assign +// arbitrary labels to vertices without modifying the actual graph. + +// TODO: We might also overlay the uniqueness/multiplicity of labels in this +// hierarchy also. For now, we just assumed that labels are unique. + +struct label_vertex_tag { }; +struct labeled_add_vertex_tag : virtual label_vertex_tag { }; +struct labeled_add_vertex_property_tag : virtual labeled_add_vertex_tag { }; +struct labeled_remove_vertex_tag { }; +struct labeled_add_edge_tag : virtual label_vertex_tag { }; +struct labeled_add_edge_property_tag : virtual labeled_add_edge_tag{ }; +struct labeled_remove_edge_tag { }; + +struct labeled_mutable_vertex_graph_tag + : virtual labeled_add_vertex_tag, virtual labeled_remove_vertex_tag +{ }; +struct labeled_mutable_vertex_property_graph_tag + : virtual labeled_add_vertex_property_tag, virtual labeled_remove_vertex_tag +{ }; +struct labeled_mutable_edge_graph_tag + : virtual labeled_add_edge_tag, virtual labeled_remove_edge_tag +{ }; +struct labeled_mutable_edge_property_graph_tag + : virtual labeled_add_edge_property_tag, virtual labeled_remove_edge_tag +{ }; + +struct labeled_graph_tag + : virtual label_vertex_tag +{ }; +struct labeled_mutable_graph_tag + : virtual labeled_mutable_vertex_graph_tag + , virtual labeled_mutable_edge_graph_tag +{ }; +struct labeled_mutable_property_graph_tag + : virtual labeled_mutable_vertex_property_graph_tag + , virtual labeled_mutable_edge_property_graph_tag +{ }; +struct labeled_add_only_property_graph_tag + : virtual labeled_add_vertex_property_tag + , virtual labeled_mutable_edge_property_graph_tag +{ }; + +// Metafunctions + +template +struct graph_has_add_vertex_by_label + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + labeled_add_vertex_tag + >::value + > +{ }; + +template +struct graph_has_add_vertex_by_label_with_property + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + labeled_add_vertex_property_tag + >::value + > +{ }; + +template +struct graph_has_remove_vertex_by_label + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + labeled_remove_vertex_tag + >::value + > +{ }; + +template +struct graph_has_add_edge_by_label + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + labeled_add_edge_tag + >::value + > +{ }; + +template +struct graph_has_add_edge_by_label_with_property + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + labeled_add_edge_property_tag + >::value + > +{ }; + +template +struct graph_has_remove_edge_by_label + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + labeled_remove_edge_tag + >::value + > +{ }; + +template +struct is_labeled_mutable_vertex_graph + : mpl::and_< + graph_has_add_vertex_by_label, + graph_has_remove_vertex_by_label + > +{ }; + +template +struct is_labeled_mutable_vertex_property_graph + : mpl::and_< + graph_has_add_vertex_by_label, + graph_has_remove_vertex_by_label + > +{ }; + +template +struct is_labeled_mutable_edge_graph + : mpl::and_< + graph_has_add_edge_by_label, + graph_has_remove_edge_by_label + > +{ }; + +template +struct is_labeled_mutable_edge_property_graph + : mpl::and_< + graph_has_add_edge_by_label, + graph_has_remove_edge_by_label + > +{ }; + +template +struct is_labeled_mutable_graph + : mpl::and_< + is_labeled_mutable_vertex_graph, + is_labeled_mutable_edge_graph + > +{ }; + +template +struct is_labeled_mutable_property_graph + : mpl::and_< + is_labeled_mutable_vertex_property_graph, + is_labeled_mutable_edge_property_graph + > +{ }; + +template +struct is_labeled_add_only_property_graph + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + labeled_add_only_property_graph_tag + >::value + > +{ }; + +template +struct is_labeled_graph + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + label_vertex_tag + >::value + > +{ }; + +template class graph_mutability_traits; + +namespace graph_detail { + // The determine mutability metafunction computes a labeled mutability tag + // based on the mutability of the given graph type. This is used by the + // graph_mutability_traits specialization below. + template + struct determine_mutability { + typedef typename mpl::if_< + is_add_only_property_graph, + labeled_add_only_property_graph_tag, + typename mpl::if_< + is_mutable_property_graph, + labeled_mutable_property_graph_tag, + typename mpl::if_< + is_mutable_graph, + labeled_mutable_graph_tag, + typename mpl::if_< + is_mutable_edge_graph, + labeled_graph_tag, + typename graph_mutability_traits::category + >::type + >::type + >::type + >::type type; + }; +} // namespace graph_detail + +#define LABELED_GRAPH_PARAMS typename G, typename L, typename S +#define LABELED_GRAPH labeled_graph + +// Specialize mutability traits for for the labeled graph. +// This specialization depends on the mutability of the underlying graph type. +// If the underlying graph is fully mutable, this this is also fully mutable. +// Otherwise, it's different. +template +struct graph_mutability_traits< LABELED_GRAPH > { + typedef typename graph_detail::determine_mutability< + typename LABELED_GRAPH::graph_type + >::type category; +}; + +#undef LABELED_GRAPH_PARAMS +#undef LABELED_GRAPH + +} // namespace boost + +#endif diff --git a/deal.II/contrib/boost/include/boost/graph/detail/list_base.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/list_base.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/detail/list_base.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/list_base.hpp diff --git a/deal.II/contrib/boost/include/boost/graph/detail/permutation.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/permutation.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/detail/permutation.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/permutation.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/read_graphviz_new.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/read_graphviz_new.hpp new file mode 100644 index 0000000000..215f9ef939 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/read_graphviz_new.hpp @@ -0,0 +1,116 @@ +// Copyright 2004-9 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_new.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 +// +// Jeremiah rewrite used grammar found at: +// http://www.graphviz.org/doc/info/lang.html +// and page 34 or http://www.graphviz.org/pdf/dotguide.pdf +// +// See documentation for this code at: +// http://www.boost.org/libs/graph/doc/read-graphviz.html +// + +// Author: Jeremiah Willcock +// Ronald Garcia +// + +#ifndef BOOST_READ_GRAPHVIZ_NEW_HPP +#define BOOST_READ_GRAPHVIZ_NEW_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + +namespace read_graphviz_detail { + typedef std::string node_name; + typedef std::string subgraph_name; + + typedef std::map properties; + + struct node_and_port { + node_name name; + std::string angle; // Or empty if no angle + std::vector location; // Up to two identifiers + + friend inline bool operator==(const node_and_port& a, const node_and_port& b) { + return a.name == b.name && + a.angle == b.angle && + a.location == b.location; + } + + friend inline bool operator<(const node_and_port& a, const node_and_port& b) { + if (a.name != b.name) return a.name < b.name; + if (a.angle != b.angle) return a.angle < b.angle; + return a.location < b.location; + } + }; + + struct edge_info { + node_and_port source; + node_and_port target; + properties props; + }; + + struct parser_result { + bool graph_is_directed; + bool graph_is_strict; + std::map nodes; // Global set + std::vector edges; + std::map graph_props; // Root and subgraphs + }; + + // The actual parser, from libs/graph/src/read_graphviz_new.cpp + void parse_graphviz_from_string(const std::string& str, parser_result& result, bool want_directed); + + // Translate from those results to a graph + void translate_results_to_graph(const parser_result& r, ::boost::detail::graph::mutate_graph* mg); + +} // namespace read_graphviz_detail + +// This is also in boost/graph/graphviz.hpp +namespace detail { + namespace graph { + BOOST_GRAPH_DECL bool read_graphviz(const std::string& str, boost::detail::graph::mutate_graph* mg); + } // end namespace graph +} // end namespace detail + +template +bool read_graphviz(const std::string& str, + MutableGraph& graph, boost::dynamic_properties& dp, + std::string const& node_id = "node_id") { + boost::detail::graph::mutate_graph_impl mg(graph, dp, node_id); + return detail::graph::read_graphviz(str, &mg); +} + +template +bool read_graphviz(InputIter begin, InputIter end, + MutableGraph& graph, boost::dynamic_properties& dp, + std::string const& node_id = "node_id") { + return read_graphviz(std::string(begin, end), graph, dp, node_id); +} + +} // namespace boost + +#endif // BOOST_READ_GRAPHVIZ_NEW_HPP diff --git a/deal.II/contrib/boost/include/boost/graph/detail/read_graphviz_spirit.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/read_graphviz_spirit.hpp similarity index 89% rename from deal.II/contrib/boost/include/boost/graph/detail/read_graphviz_spirit.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/read_graphviz_spirit.hpp index 16224c2392..815befe91f 100644 --- a/deal.II/contrib/boost/include/boost/graph/detail/read_graphviz_spirit.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/read_graphviz_spirit.hpp @@ -1,4 +1,4 @@ -// Copyright 2004-5 Trustees of Indiana University +// Copyright 2004-9 Trustees of Indiana University // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -28,21 +28,22 @@ #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 +#include +#include +#include +#include #include #include #include -#include +#include #include #include #include @@ -93,25 +94,25 @@ typedef std::map subgraph_edges_t; ///////////////////////////////////////////////////////////////////////////// // Stack frames used by semantic actions ///////////////////////////////////////////////////////////////////////////// -struct id_closure : boost::spirit::closure { +struct id_closure : boost::spirit::classic::closure { member1 name; }; -struct node_id_closure : boost::spirit::closure { +struct node_id_closure : boost::spirit::classic::closure { member1 name; }; -struct attr_list_closure : boost::spirit::closure { +struct attr_list_closure : boost::spirit::classic::closure { member1 prop_actor; }; -struct property_closure : boost::spirit::closure { +struct property_closure : boost::spirit::classic::closure { member1 key; member2 value; }; -struct data_stmt_closure : boost::spirit::closure { member1 sources; member2 dests; @@ -120,7 +121,7 @@ struct data_stmt_closure : boost::spirit::closure { member1 nodes; member2 edges; @@ -132,7 +133,7 @@ struct subgraph_closure : boost::spirit::closure { +struct dot_grammar : public boost::spirit::classic::grammar { mutate_graph& graph_; explicit dot_grammar(mutate_graph& graph) : graph_(graph) { } @@ -141,7 +142,7 @@ struct dot_grammar : public boost::spirit::grammar { definition(dot_grammar const& self) : self(self), subgraph_depth(0), keyword_p("0-9a-zA-Z_") { - using namespace boost::spirit; + using namespace boost::spirit::classic; using namespace phoenix; // RG - Future Work @@ -282,7 +283,7 @@ struct dot_grammar : public boost::spirit::grammar { } // definition() - typedef boost::spirit::rule rule_t; + typedef boost::spirit::classic::rule rule_t; rule_t const& start() const { return the_grammar; } @@ -492,21 +493,21 @@ struct dot_grammar : public boost::spirit::grammar { int subgraph_depth; // Keywords; - const boost::spirit::distinct_parser<> keyword_p; + const boost::spirit::classic::distinct_parser<> keyword_p; // // rules that make up the grammar // - boost::spirit::rule ID; - boost::spirit::rule a_list; - boost::spirit::rule attr_list; + boost::spirit::classic::rule ID; + boost::spirit::classic::rule a_list; + boost::spirit::classic::rule attr_list; rule_t port_location; rule_t port_angle; rule_t port; - boost::spirit::rule node_id; - boost::spirit::rule graph_stmt; + boost::spirit::classic::rule node_id; + boost::spirit::classic::rule graph_stmt; rule_t attr_stmt; - boost::spirit::rule data_stmt; - boost::spirit::rule subgraph; + boost::spirit::classic::rule data_stmt; + boost::spirit::classic::rule subgraph; rule_t edgeop; rule_t edgeRHS; rule_t stmt; @@ -544,7 +545,7 @@ struct dot_grammar : public boost::spirit::grammar { // // dot_skipper - GraphViz whitespace and comment skipper // -struct dot_skipper : public boost::spirit::grammar +struct dot_skipper : public boost::spirit::classic::grammar { dot_skipper() {} @@ -552,7 +553,7 @@ struct dot_skipper : public boost::spirit::grammar struct definition { definition(dot_skipper const& /*self*/) { - using namespace boost::spirit; + using namespace boost::spirit::classic; using namespace phoenix; // comment forms skip = eol_p >> comment_p("#") @@ -570,8 +571,8 @@ struct dot_skipper : public boost::spirit::grammar #endif } - boost::spirit::rule skip; - boost::spirit::rule const& + boost::spirit::classic::rule skip; + boost::spirit::classic::rule const& start() const { return skip; } }; // definition }; // dot_skipper @@ -584,7 +585,7 @@ 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; + using namespace boost::spirit::classic; typedef MultiPassIterator iterator_t; typedef skip_parser_iteration_policy< boost::detail::graph::dot_skipper> diff --git a/deal.II/contrib/boost/include/boost/graph/detail/self_avoiding_walk.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/self_avoiding_walk.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/graph/detail/self_avoiding_walk.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/self_avoiding_walk.hpp index def0c6eef2..c171897f22 100644 --- a/deal.II/contrib/boost/include/boost/graph/detail/self_avoiding_walk.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/self_avoiding_walk.hpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #define SAW_SENTINAL -1 diff --git a/deal.II/contrib/boost/include/boost/graph/detail/set_adaptor.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/set_adaptor.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/detail/set_adaptor.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/set_adaptor.hpp diff --git a/deal.II/contrib/boost/include/boost/graph/detail/shadow_iterator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/shadow_iterator.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/detail/shadow_iterator.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/shadow_iterator.hpp diff --git a/deal.II/contrib/boost/include/boost/graph/detail/sparse_ordering.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/sparse_ordering.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/graph/detail/sparse_ordering.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/detail/sparse_ordering.hpp index cf4bbb0bee..593d8c8579 100644 --- a/deal.II/contrib/boost/include/boost/graph/detail/sparse_ordering.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/detail/sparse_ordering.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -128,7 +128,7 @@ namespace boost { // template Vertex - pseudo_peripheral_pair(Graph& G, const Vertex& u, int& ecc, + pseudo_peripheral_pair(Graph const& G, const Vertex& u, int& ecc, ColorMap color, DegreeMap degree) { typedef typename property_traits::value_type ColorValue; @@ -152,7 +152,7 @@ namespace boost { // of the ordering generated by RCM. // template - Vertex find_starting_node(Graph& G, Vertex r, Color color, Degree degree) + Vertex find_starting_node(Graph const& G, Vertex r, Color color, Degree degree) { Vertex x, y; int eccen_r, eccen_x; diff --git a/deal.II/contrib/boost/include/boost/graph/dijkstra_shortest_paths.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/dijkstra_shortest_paths.hpp similarity index 60% rename from deal.II/contrib/boost/include/boost/graph/dijkstra_shortest_paths.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/dijkstra_shortest_paths.hpp index 243b17f752..d7456734ea 100644 --- a/deal.II/contrib/boost/include/boost/graph/dijkstra_shortest_paths.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/dijkstra_shortest_paths.hpp @@ -6,6 +6,12 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //======================================================================= +// +// +// Revision History: +// 04 April 2001: Added named parameter variant. (Jeremy Siek) +// 01 April 2001: Modified to use new header. (JMaddock) +// #ifndef BOOST_GRAPH_DIJKSTRA_HPP #define BOOST_GRAPH_DIJKSTRA_HPP @@ -17,6 +23,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #ifdef BOOST_GRAPH_DIJKSTRA_TESTING # include @@ -24,7 +37,31 @@ namespace boost { + /** + * @brief Updates a particular value in a queue used by Dijkstra's + * algorithm. + * + * This routine is called by Dijkstra's algorithm after it has + * decreased the distance from the source vertex to the given @p + * vertex. By default, this routine will just call @c + * Q.update(vertex). However, other queues may provide more + * specialized versions of this routine. + * + * @param Q the queue that will be updated. + * @param vertex the vertex whose distance has been updated + * @param old_distance the previous distance to @p vertex + */ + template + inline void + dijkstra_queue_update(Buffer& Q, Vertex vertex, DistanceType old_distance) + { + (void)old_distance; + Q.update(vertex); + } + #ifdef BOOST_GRAPH_DIJKSTRA_TESTING + // This is a misnomer now: it now just refers to the "default heap", which is + // currently d-ary (d=4) but can be changed by a #define. static bool dijkstra_relaxed_heap = true; #endif @@ -90,26 +127,29 @@ namespace boost { 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) + bool decreased = relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); + if (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)); + D old_distance = get(m_distance, target(e, g)); + + bool decreased = relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); + if (decreased) { + dijkstra_queue_update(m_Q, target(e, g), old_distance); m_vis.edge_relaxed(e, g); } else m_vis.edge_not_relaxed(e, g); } template - void initialize_vertex(Vertex /*u*/, Graph& /*g*/) { } + void initialize_vertex(Vertex u, Graph& g) + { m_vis.initialize_vertex(u, g); } template void non_tree_edge(Edge, Graph&) { } template @@ -119,7 +159,7 @@ namespace boost { template void examine_edge(Edge e, Graph& g) { if (m_compare(get(m_weight, e), m_zero)) - throw negative_edge(); + boost::throw_exception(negative_edge()); m_vis.examine_edge(e, g); } template @@ -134,42 +174,116 @@ namespace boost { DistanceMap m_distance; BinaryFunction m_combine; BinaryPredicate m_compare; - bool m_decreased; D m_zero; }; } // namespace detail + namespace detail { + template + struct vertex_property_map_generator_helper {}; + + template + struct vertex_property_map_generator_helper { + typedef boost::iterator_property_map type; + static type build(const Graph& g, const IndexMap& index, boost::scoped_array& array_holder) { + array_holder.reset(new Value[num_vertices(g)]); + std::fill(array_holder.get(), array_holder.get() + num_vertices(g), Value()); + return make_iterator_property_map(array_holder.get(), index); + } + }; + + template + struct vertex_property_map_generator_helper { + typedef boost::vector_property_map type; + static type build(const Graph& g, const IndexMap& index, boost::scoped_array& array_holder) { + return boost::make_vector_property_map(index); + } + }; + + template + struct vertex_property_map_generator { + typedef boost::is_base_and_derived< + boost::vertex_list_graph_tag, + typename boost::graph_traits::traversal_category> + known_num_vertices; + typedef vertex_property_map_generator_helper helper; + typedef typename helper::type type; + static type build(const Graph& g, const IndexMap& index, boost::scoped_array& array_holder) { + return helper::build(g, index, array_holder); + } + }; + } + + namespace detail { + template + struct default_color_map_generator_helper {}; + + template + struct default_color_map_generator_helper { + typedef boost::two_bit_color_map type; + static type build(const Graph& g, const IndexMap& index) { + size_t nv = num_vertices(g); + return boost::two_bit_color_map(nv, index); + } + }; + + template + struct default_color_map_generator_helper { + typedef boost::vector_property_map type; + static type build(const Graph& g, const IndexMap& index) { + return boost::make_vector_property_map(index); + } + }; + + template + struct default_color_map_generator { + typedef boost::is_base_and_derived< + boost::vertex_list_graph_tag, + typename boost::graph_traits::traversal_category> + known_num_vertices; + typedef default_color_map_generator_helper helper; + typedef typename helper::type type; + static type build(const Graph& g, const IndexMap& index) { + return helper::build(g, index); + } + }; + } + // 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, + (const Graph& 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; + typedef + detail::default_color_map_generator + ColorMapHelper; + typedef typename ColorMapHelper::type ColorMap; + ColorMap color = + ColorMapHelper::build(g, index_map); 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)); + color); } // Call breadth first search - template inline void dijkstra_shortest_paths_no_init - (const VertexListGraph& g, - typename graph_traits::vertex_descriptor s, + (const Graph& g, + typename graph_traits::vertex_descriptor s, PredecessorMap predecessor, DistanceMap distance, WeightMap weight, IndexMap index_map, Compare compare, Combine combine, DistZero zero, @@ -178,7 +292,7 @@ namespace boost { typedef indirect_cmp IndirectCmp; IndirectCmp icmp(distance, compare); - typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertex_descriptor Vertex; #ifdef BOOST_GRAPH_DIJKSTRA_TESTING if (!dijkstra_relaxed_heap) { @@ -186,7 +300,6 @@ namespace boost { MutableQueue; MutableQueue Q(num_vertices(g), icmp, index_map); - detail::dijkstra_bfs_visitor bfs_vis(vis, Q, weight, predecessor, distance, combine, compare, zero); @@ -196,9 +309,21 @@ namespace boost { } #endif // BOOST_GRAPH_DIJKSTRA_TESTING +#ifdef BOOST_GRAPH_DIJKSTRA_USE_RELAXED_HEAP typedef relaxed_heap MutableQueue; - MutableQueue Q(num_vertices(g), icmp, index_map); +#else // Now the default: use a d-ary heap + boost::scoped_array index_in_heap_map_holder; + typedef + detail::vertex_property_map_generator + IndexInHeapMapHelper; + typedef typename IndexInHeapMapHelper::type IndexInHeapMap; + IndexInHeapMap index_in_heap = + IndexInHeapMapHelper::build(g, index_map, index_in_heap_map_holder); + typedef d_ary_heap_indirect + MutableQueue; + MutableQueue Q(distance, index_in_heap, compare); +#endif // Relaxed heap detail::dijkstra_bfs_visitor @@ -211,7 +336,8 @@ namespace boost { template + class DistInf, class DistZero, typename T, typename Tag, + typename Base> inline void dijkstra_shortest_paths (const VertexListGraph& g, @@ -219,14 +345,14 @@ namespace boost { PredecessorMap predecessor, DistanceMap distance, WeightMap weight, IndexMap index_map, Compare compare, Combine combine, DistInf inf, DistZero zero, - DijkstraVisitor vis) + DijkstraVisitor vis, + const bgl_named_params& + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(VertexListGraph,vertex_list_graph_tag)) { - std::vector color(num_vertices(g)); - default_color_type c = white_color; + boost::two_bit_color_map color(num_vertices(g), index_map); dijkstra_shortest_paths(g, s, predecessor, distance, weight, index_map, compare, combine, inf, zero, vis, - make_iterator_property_map(&color[0], index_map, - c)); + color); } // Initialize distances and call breadth first search @@ -258,18 +384,37 @@ namespace boost { index_map, compare, combine, zero, vis, color); } + // 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) + { + dijkstra_shortest_paths(g, s, predecessor, distance, weight, index_map, + compare, combine, inf, zero, vis, + no_named_parameters()); + } + namespace detail { // Handle defaults for PredecessorMap and // Distance Compare, Combine, Inf and Zero template + class IndexMap, class Params> 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) + const Params& params) { // Default for predecessor map dummy_property_map p_map; @@ -289,17 +434,17 @@ namespace boost { D()), choose_param(get_param(params, graph_visitor), make_dijkstra_visitor(null_visitor())), - color); + params); } template + class IndexMap, class Params> 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) + const Params& params) { // Default for distance map typedef typename property_traits::value_type D; @@ -307,19 +452,11 @@ namespace boost { 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]))); + weight, index_map, params); } } // namespace detail @@ -338,10 +475,13 @@ namespace boost { 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)); + params); } } // namespace boost +#ifdef BOOST_GRAPH_USE_MPI +# include +#endif + #endif // BOOST_GRAPH_DIJKSTRA_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp new file mode 100644 index 0000000000..443984ff0c --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp @@ -0,0 +1,249 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright 2009 Trustees of Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Michael Hansen +// +// Distributed under the 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_NO_COLOR_MAP_HPP +#define BOOST_GRAPH_DIJKSTRA_NO_COLOR_MAP_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { + + // No init version + template + void dijkstra_shortest_paths_no_color_map_no_init + (const Graph& graph, + typename graph_traits::vertex_descriptor start_vertex, + PredecessorMap predecessor_map, + DistanceMap distance_map, + WeightMap weight_map, + VertexIndexMap index_map, + DistanceCompare distance_compare, + DistanceWeightCombine distance_weight_combine, + DistanceInfinity distance_infinity, + DistanceZero distance_zero, + DijkstraVisitor visitor) + { + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename property_traits::value_type Distance; + typedef typename property_traits::value_type Weight; + + typedef indirect_cmp DistanceIndirectCompare; + DistanceIndirectCompare + distance_indirect_compare(distance_map, distance_compare); + + // Choose vertex queue type +#if BOOST_GRAPH_DIJKSTRA_USE_RELAXED_HEAP + typedef relaxed_heap + VertexQueue; + VertexQueue vertex_queue(num_vertices(graph), + distance_indirect_compare, + index_map); +#else + // Default - use d-ary heap (d = 4) + typedef + detail::vertex_property_map_generator + IndexInHeapMapHelper; + typedef typename IndexInHeapMapHelper::type IndexInHeapMap; + typedef + d_ary_heap_indirect + VertexQueue; + + boost::scoped_array index_in_heap_map_holder; + IndexInHeapMap index_in_heap = + IndexInHeapMapHelper::build(graph, index_map, + index_in_heap_map_holder); + VertexQueue vertex_queue(distance_map, index_in_heap, distance_compare); +#endif + + // Add vertex to the queue + vertex_queue.push(start_vertex); + + // Starting vertex will always be the first discovered vertex + visitor.discover_vertex(start_vertex, graph); + + while (!vertex_queue.empty()) { + Vertex min_vertex = vertex_queue.top(); + vertex_queue.pop(); + + visitor.examine_vertex(min_vertex, graph); + + // Check if any other vertices can be reached + Distance min_vertex_distance = get(distance_map, min_vertex); + + if (!distance_compare(min_vertex_distance, distance_infinity)) { + // This is the minimum vertex, so all other vertices are unreachable + return; + } + + // Examine neighbors of min_vertex + typedef typename graph_traits::edge_descriptor Edge; + BGL_FORALL_OUTEDGES_T(min_vertex, current_edge, graph, Graph) { + visitor.examine_edge(current_edge, graph); + + // Check if the edge has a negative weight + if (distance_compare(get(weight_map, current_edge), distance_zero)) { + boost::throw_exception(negative_edge()); + } + + // Extract the neighboring vertex and get its distance + Vertex neighbor_vertex = target(current_edge, graph); + Distance neighbor_vertex_distance = get(distance_map, neighbor_vertex); + bool is_neighbor_undiscovered = + !distance_compare(neighbor_vertex_distance, distance_infinity); + + // Attempt to relax the edge + bool was_edge_relaxed = relax(current_edge, graph, weight_map, + predecessor_map, distance_map, + distance_weight_combine, distance_compare); + + if (was_edge_relaxed) { + vertex_queue.update(neighbor_vertex); + visitor.edge_relaxed(current_edge, graph); + } else { + visitor.edge_not_relaxed(current_edge, graph); + } + + if (is_neighbor_undiscovered) { + visitor.discover_vertex(neighbor_vertex, graph); + vertex_queue.push(neighbor_vertex); + } + } // end out edge iteration + + visitor.finish_vertex(min_vertex, graph); + } // end while queue not empty + } + + // Full init version + template + void dijkstra_shortest_paths_no_color_map + (const Graph& graph, + typename graph_traits::vertex_descriptor start_vertex, + PredecessorMap predecessor_map, + DistanceMap distance_map, + WeightMap weight_map, + VertexIndexMap index_map, + DistanceCompare distance_compare, + DistanceWeightCombine distance_weight_combine, + DistanceInfinity distance_infinity, + DistanceZero distance_zero, + DijkstraVisitor visitor) + { + // Initialize vertices + BGL_FORALL_VERTICES_T(current_vertex, graph, Graph) { + visitor.initialize_vertex(current_vertex, graph); + + // Default all distances to infinity + put(distance_map, current_vertex, distance_infinity); + + // Default all vertex predecessors to the vertex itself + put(predecessor_map, current_vertex, current_vertex); + } + + // Set distance for start_vertex to zero + put(distance_map, start_vertex, distance_zero); + + // Pass everything on to the no_init version + dijkstra_shortest_paths_no_color_map_no_init(graph, + start_vertex, predecessor_map, distance_map, weight_map, + index_map, distance_compare, distance_weight_combine, + distance_infinity, distance_zero, visitor); + } + + namespace detail { + + // Handle defaults for PredecessorMap, DistanceCompare, + // DistanceWeightCombine, DistanceInfinity and DistanceZero + template + inline void + dijkstra_no_color_map_dispatch2 + (const Graph& graph, + typename graph_traits::vertex_descriptor start_vertex, + DistanceMap distance_map, WeightMap weight_map, + VertexIndexMap index_map, const Params& params) + { + // Default for predecessor map + dummy_property_map predecessor_map; + + typedef typename property_traits::value_type DistanceType; + dijkstra_shortest_paths_no_color_map + (graph, start_vertex, + choose_param(get_param(params, vertex_predecessor), predecessor_map), + distance_map, weight_map, 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()), + DistanceType()), + choose_param(get_param(params, graph_visitor), + make_dijkstra_visitor(null_visitor()))); + } + + template + inline void + dijkstra_no_color_map_dispatch1 + (const Graph& graph, + typename graph_traits::vertex_descriptor start_vertex, + DistanceMap distance_map, WeightMap weight_map, + IndexMap index_map, const Params& params) + { + // Default for distance map + typedef typename property_traits::value_type DistanceType; + typename std::vector::size_type + vertex_count = is_default_param(distance_map) ? num_vertices(graph) : 1; + + std::vector default_distance_map(vertex_count); + + detail::dijkstra_no_color_map_dispatch2 + (graph, start_vertex, choose_param(distance_map, + make_iterator_property_map(default_distance_map.begin(), index_map, + default_distance_map[0])), + weight_map, index_map, params); + } + } // namespace detail + + // Named parameter version + template + inline void + dijkstra_shortest_paths_no_color_map + (const Graph& graph, + typename graph_traits::vertex_descriptor start_vertex, + 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_no_color_map_dispatch1 + (graph, start_vertex, + get_param(params, vertex_distance), + choose_const_pmap(get_param(params, edge_weight), graph, edge_weight), + choose_const_pmap(get_param(params, vertex_index), graph, vertex_index), + params); + } + +} // namespace boost + +#endif // BOOST_GRAPH_DIJKSTRA_NO_COLOR_MAP_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/dimacs.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/dimacs.hpp new file mode 100644 index 0000000000..195ad3b651 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/dimacs.hpp @@ -0,0 +1,309 @@ +// Copyright 2005 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: Alex Breuer +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DIMACS_HPP +#define BOOST_GRAPH_DIMACS_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace graph { + +class dimacs_exception : public std::exception {}; + +class dimacs_basic_reader { +public: + typedef std::size_t vertices_size_type; + typedef std::size_t edges_size_type; + typedef double vertex_weight_type; + typedef double edge_weight_type; + typedef std::pair edge_type; + enum incr_mode {edge, edge_weight}; + + dimacs_basic_reader( std::istream& in, bool want_weights = true ) : + inpt( in ), seen_edges( 0 ), want_weights(want_weights) + { + while( getline( inpt, buf ) && !buf.empty() && buf[0] == 'c' ); + + if( buf[0] != 'p' ) { + boost::throw_exception(dimacs_exception()); + } + + std::stringstream instr( buf ); + std::string junk; + + instr >> junk >> junk >> num_vertices >> num_edges; + read_edge_weights.push( -1 ); + incr( edge_weight ); + } + + //for a past the end iterator + dimacs_basic_reader() : inpt( std::cin ), num_vertices( 0 ), + num_edges( 0 ), seen_edges( 0 ), want_weights(false) {} + + edge_type edge_deref() { + assert( !read_edges.empty() ); + return read_edges.front(); + } + + inline edge_type* edge_ref() { + assert( !read_edges.empty() ); + return &read_edges.front(); + } + + inline edge_weight_type edge_weight_deref() { + assert( !read_edge_weights.empty() ); + return read_edge_weights.front(); + } + + inline dimacs_basic_reader incr( incr_mode mode ) { + if( mode == edge ) { + assert( !read_edges.empty() ); + read_edges.pop(); + } + else if( mode == edge_weight ) { + assert( !read_edge_weights.empty() ); + read_edge_weights.pop(); + } + + if( (mode == edge && read_edges.empty()) || + (mode == edge_weight && read_edge_weights.empty() )) { + + if( seen_edges > num_edges ) { + boost::throw_exception(dimacs_exception()); + } + + while( getline( inpt, buf ) && !buf.empty() && buf[0] == 'c' ); + + if( !inpt.eof() ) { + int source, dest, weight; + read_edge_line((char*) buf.c_str(), source, dest, weight); + + seen_edges++; + source--; + dest--; + + read_edges.push( edge_type( source, dest ) ); + if (want_weights) { + read_edge_weights.push( weight ); + } + } + assert( read_edges.size() < 100 ); + assert( read_edge_weights.size() < 100 ); + } + + // the 1000000 just happens to be about how many edges can be read in + // 10s +// if( !(seen_edges % 1000000) && !process_id( pg ) && mode == edge ) { +// std::cout << "read " << seen_edges << " edges" << std::endl; +// } + return *this; + } + + inline bool done_edges() { + return inpt.eof() && read_edges.size() == 0; + } + + inline bool done_edge_weights() { + return inpt.eof() && read_edge_weights.size() == 0; + } + + inline vertices_size_type n_vertices() { + return num_vertices; + } + + inline vertices_size_type processed_edges() { + return seen_edges - read_edges.size(); + } + + inline vertices_size_type processed_edge_weights() { + return seen_edges - read_edge_weights.size(); + } + + inline vertices_size_type n_edges() { + return num_edges; + } + +protected: + bool read_edge_line(char *linebuf, int &from, int &to, int &weight) + { + char *fs = NULL, *ts = NULL, *ws = NULL; + char *tmp = linebuf + 2; + + fs = tmp; + if ('e' == linebuf[0]) { + while (*tmp != '\n' && *tmp != '\0') { + if (*tmp == ' ') { + *tmp = '\0'; + ts = ++tmp; + break; + } + tmp++; + } + *tmp = '\0'; + if (NULL == fs || NULL == ts) return false; + from = atoi(fs); to = atoi(ts); weight = 0; + + } else if ('a' == linebuf[0]) { + while (*tmp != '\n' && *tmp != '\0') { + if (*tmp == ' ') { + *tmp = '\0'; + ts = ++tmp; + break; + } + tmp++; + } + while (*tmp != '\n' && *tmp != '\0') { + if (*tmp == ' ') { + *tmp = '\0'; + ws = ++tmp; + break; + } + tmp++; + } + while (*tmp != '\n' && *tmp != '\0') tmp++; + *tmp = '\0'; + if (fs == NULL || ts == NULL || ws == NULL) return false; + from = atoi(fs); to = atoi(ts) ; + if (want_weights) weight = atoi(ws); else weight = 0; + + } else { + return false; + } + + return true; + } + + std::queue read_edges; + std::queue read_edge_weights; + + std::istream& inpt; + std::string buf; + vertices_size_type num_vertices, num_edges, seen_edges; + bool want_weights; +}; + +template +class dimacs_edge_iterator { +public: + typedef dimacs_basic_reader::edge_type edge_type; + typedef dimacs_basic_reader::incr_mode incr_mode; + + typedef std::input_iterator_tag iterator_category; + typedef edge_type value_type; + typedef value_type reference; + typedef edge_type* pointer; + typedef std::ptrdiff_t difference_type; + + dimacs_edge_iterator( T& reader ) : + reader( reader ) {} + + inline dimacs_edge_iterator& operator++() { + reader.incr( dimacs_basic_reader::edge ); + return *this; + } + + inline edge_type operator*() { + return reader.edge_deref(); + } + + inline edge_type* operator->() { + return reader.edge_ref(); + } + + // don't expect this to do the right thing if you're not comparing against a + // general past-the-end-iterator made with the default constructor for + // dimacs_basic_reader + inline bool operator==( dimacs_edge_iterator arg ) { + if( reader.n_vertices() == 0 ) { + return arg.reader.done_edges(); + } + else if( arg.reader.n_vertices() == 0 ) { + return reader.done_edges(); + } + else { + return false; + } + return false; + } + + inline bool operator!=( dimacs_edge_iterator arg ) { + if( reader.n_vertices() == 0 ) { + return !arg.reader.done_edges(); + } + else if( arg.reader.n_vertices() == 0 ) { + return !reader.done_edges(); + } + else { + return true; + } + return true; + } + +private: + T& reader; +}; + +template +class dimacs_edge_weight_iterator { +public: + typedef dimacs_basic_reader::edge_weight_type edge_weight_type; + typedef dimacs_basic_reader::incr_mode incr_mode; + + dimacs_edge_weight_iterator( T& reader ) : reader( reader ) {} + + inline dimacs_edge_weight_iterator& operator++() { + reader.incr( dimacs_basic_reader::edge_weight ); + return *this; + } + + inline edge_weight_type operator*() { + return reader.edge_weight_deref(); + } + + // don't expect this to do the right thing if you're not comparing against a + // general past-the-end-iterator made with the default constructor for + // dimacs_basic_reader + inline bool operator==( dimacs_edge_weight_iterator arg ) { + if( reader.n_vertices() == 0 ) { + return arg.reader.done_edge_weights(); + } + else if( arg.reader.n_vertices() == 0 ) { + return reader.done_edge_weights(); + } + else { + return false; + } + return false; + } + + inline bool operator!=( dimacs_edge_weight_iterator arg ) { + if( reader.n_vertices() == 0 ) { + return !arg.reader.done_edge_weights(); + } + else if( arg.reader.n_vertices() == 0 ) { + return !reader.done_edge_weights(); + } + else { + return true; + } + return true; + } +private: + T& reader; +}; + +} } // end namespace boost::graph +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/directed_graph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/directed_graph.hpp new file mode 100644 index 0000000000..28b085dd1c --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/directed_graph.hpp @@ -0,0 +1,678 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_DIRECTED_GRAPH_HPP +#define BOOST_GRAPH_DIRECTED_GRAPH_HPP + +#include +#include +#include + +namespace boost +{ +struct directed_graph_tag { }; + +/** + * The directed_graph class template is a simplified version of the BGL + * adjacency list. This class is provided for ease of use, but may not + * perform as well as custom-defined adjacency list classes. Instances of + * this template model the BidirectionalGraph, VertexIndexGraph, and + * EdgeIndexGraph concepts. The graph is also fully mutable, supporting + * both insertions and removals of vertices and edges. + * + * @note Special care must be taken when removing vertices or edges since + * those operations can invalidate the numbering of vertices. + */ +template < + typename VertexProp = no_property, + typename EdgeProp= no_property, + typename GraphProp= no_property> +class directed_graph +{ +public: + typedef typename graph_detail::vertex_prop::type vertex_property_type; + typedef typename graph_detail::vertex_prop::bundle vertex_bundled; + typedef typename graph_detail::edge_prop::type edge_property_type; + typedef typename graph_detail::edge_prop::bundle edge_bundled; + +private: + // Wrap the user-specified properties with an index. + typedef property vertex_property; + typedef property edge_property; + +public: + typedef adjacency_list< + listS, listS, bidirectionalS, + vertex_property, edge_property, GraphProp, + listS + > graph_type; + +private: + // storage selectors + typedef typename graph_type::vertex_list_selector vertex_list_selector; + typedef typename graph_type::edge_list_selector edge_list_selector; + typedef typename graph_type::out_edge_list_selector out_edge_list_selector; + typedef typename graph_type::directed_selector directed_selector; + +public: + typedef directed_graph_tag graph_tag; + typedef typename graph_type::graph_property_type graph_property_type; + + // more commonly used graph types + typedef typename graph_type::stored_vertex stored_vertex; + typedef typename graph_type::vertices_size_type vertices_size_type; + typedef typename graph_type::edges_size_type edges_size_type; + typedef typename graph_type::degree_size_type degree_size_type; + typedef typename graph_type::vertex_descriptor vertex_descriptor; + typedef typename graph_type::edge_descriptor edge_descriptor; + + // iterator types + typedef typename graph_type::vertex_iterator vertex_iterator; + typedef typename graph_type::edge_iterator edge_iterator; + typedef typename graph_type::out_edge_iterator out_edge_iterator; + typedef typename graph_type::in_edge_iterator in_edge_iterator; + typedef typename graph_type::adjacency_iterator adjacency_iterator; + + // miscellaneous types + typedef typename graph_type::directed_category directed_category; + typedef typename graph_type::edge_parallel_category edge_parallel_category; + typedef typename graph_type::traversal_category traversal_category; + + typedef unsigned vertex_index_type; + typedef unsigned edge_index_type; + + directed_graph(GraphProp const& p = GraphProp()) + : m_graph(p), m_num_vertices(0), m_num_edges(0), m_max_vertex_index(0) + , m_max_edge_index(0) + { } + + directed_graph(directed_graph const& x) + : m_graph(x), m_num_vertices(x.m_num_vertices), m_num_edges(x.m_num_edges) + , m_max_vertex_index(x.m_max_vertex_index), m_max_edge_index(x.m_max_edge_index) + { } + + directed_graph(vertices_size_type n, GraphProp const& p = GraphProp()) + : m_graph(n, p), m_num_vertices(n), m_num_edges(0), m_max_vertex_index(n) + , m_max_edge_index(0) + { renumber_vertex_indices(); } + + template + directed_graph(EdgeIterator f, + EdgeIterator l, + vertices_size_type n, + edges_size_type m = 0, + GraphProp const& p = GraphProp()) + : m_graph(f, l, n, m, p), m_num_vertices(n), m_num_edges(0) + , m_max_vertex_index(n), m_max_edge_index(0) + { + // Unfortunately, we have to renumber the entire graph. + renumber_indices(); + + // Can't always guarantee that the number of edges is actually + // m if distance(f, l) != m (or is undefined). + m_num_edges = m_max_edge_index = boost::num_edges(m_graph); + } + + directed_graph& operator=(directed_graph const& g) { + if(&g != this) { + m_graph = g.m_graph; + m_num_vertices = g.m_num_vertices; + m_num_edges = g.m_num_edges; + m_max_vertex_index = g.m_max_vertex_index; + m_max_edge_index = g.m_max_edge_index; + } + return *this; + } + + // The impl_() methods are not part of the public interface. + graph_type& impl() + { return m_graph; } + + graph_type const& impl() const + { return m_graph; } + + // The following methods are not part of the public interface + vertices_size_type num_vertices() const + { return m_num_vertices; } + +private: + // This helper function manages the attribution of vertex indices. + vertex_descriptor make_index(vertex_descriptor v) { + boost::put(vertex_index, m_graph, v, m_max_vertex_index); + m_num_vertices++; + m_max_vertex_index++; + return v; + } +public: + vertex_descriptor add_vertex() + { return make_index(boost::add_vertex(m_graph)); } + + vertex_descriptor add_vertex(vertex_property_type const& p) + { return make_index(boost::add_vertex(vertex_property(0u, p), m_graph)); } + + void clear_vertex(vertex_descriptor v) + { + m_num_edges -= boost::degree(v, m_graph); + boost::clear_vertex(v, m_graph); + } + + void remove_vertex(vertex_descriptor v) + { + boost::remove_vertex(v, m_graph); + --m_num_vertices; + } + + edges_size_type num_edges() const + { return m_num_edges; } + +private: + // A helper fucntion for managing edge index attributes. + std::pair const& + make_index(std::pair const& x) + { + if(x.second) { + boost::put(edge_index, m_graph, x.first, m_max_edge_index); + ++m_num_edges; + ++m_max_edge_index; + } + return x; + } +public: + std::pair + add_edge(vertex_descriptor u, vertex_descriptor v) + { return make_index(boost::add_edge(u, v, m_graph)); } + + std::pair + add_edge(vertex_descriptor u, vertex_descriptor v, edge_property_type const& p) + { return make_index(boost::add_edge(u, v, edge_property(0u, p), m_graph)); } + + void remove_edge(vertex_descriptor u, vertex_descriptor v) + { + // find all edges, (u, v) + std::vector edges; + out_edge_iterator i, i_end; + for(tie(i, i_end) = boost::out_edges(u, m_graph); i != i_end; ++i) { + if(boost::target(*i, m_graph) == v) { + edges.push_back(*i); + } + } + // remove all edges, (u, v) + typename std::vector::iterator + j = edges.begin(), j_end = edges.end(); + for( ; j != j_end; ++j) { + remove_edge(*j); + } + } + + void remove_edge(edge_iterator i) + { + remove_edge(*i); + } + + void remove_edge(edge_descriptor e) + { + boost::remove_edge(e, m_graph); + --m_num_edges; + } + + vertex_index_type max_vertex_index() const + { return m_max_vertex_index; } + + void + renumber_vertex_indices() + { + vertex_iterator i, end; + tie(i, end) = vertices(m_graph); + m_max_vertex_index = renumber_vertex_indices(i, end, 0); + } + + void + remove_vertex_and_renumber_indices(vertex_iterator i) + { + vertex_iterator j = next(i), end = vertices(m_graph).second; + vertex_index_type n = get(vertex_index, m_graph, *i); + + // remove the offending vertex and renumber everything after + remove_vertex(*i); + m_max_vertex_index = renumber_vertex_indices(j, end, n); + } + + edge_index_type + max_edge_index() const + { return m_max_edge_index; } + + void + renumber_edge_indices() + { + edge_iterator i, end; + tie(i, end) = edges(m_graph); + m_max_edge_index = renumber_edge_indices(i, end, 0); + } + + void + remove_edge_and_renumber_indices(edge_iterator i) + { + edge_iterator j = next(i), end = edges(m_graph).second; + edge_index_type n = get(edge_index, m_graph, *i); + + // remove the offending edge and renumber everything after + remove_edge(*i); + m_max_edge_index = renumber_edge_indices(j, end, n); + } + + void + renumber_indices() + { + renumber_vertex_indices(); + renumber_edge_indices(); + } + + // bundled property support +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + vertex_bundled& operator[](vertex_descriptor v) + { return m_graph[v]; } + + vertex_bundled const& operator[](vertex_descriptor v) const + { return m_graph[v]; } + + edge_bundled& operator[](edge_descriptor e) + { return m_graph[e]; } + + edge_bundled const& operator[](edge_descriptor e) const + { return m_graph[e]; } +#endif + + // Graph concepts + static vertex_descriptor null_vertex() + { return graph_type::null_vertex(); } + + void clear() + { + m_graph.clear(); + m_num_vertices = m_max_vertex_index = 0; + m_num_edges = m_max_edge_index = 0; + } + + void swap(directed_graph& g) + { + m_graph.swap(g); + std::swap(m_num_vertices, g.m_num_vertices); + std::swap(m_max_vertex_index, g.m_max_vertex_index); + std::swap(m_num_edges, g.m_num_edges); + std::swap(m_max_edge_index, g.m_max_edge_index); + } + +private: + vertices_size_type + renumber_vertex_indices(vertex_iterator i, + vertex_iterator end, + vertices_size_type n) + { + typedef typename property_map::type IndexMap; + IndexMap indices = get(vertex_index, m_graph); + for( ; i != end; ++i) { + indices[*i] = n++; + } + return n; + } + + vertices_size_type + renumber_edge_indices(edge_iterator i, + edge_iterator end, + vertices_size_type n) + { + typedef typename property_map::type IndexMap; + IndexMap indices = get(edge_index, m_graph); + for( ; i != end; ++i) { + indices[*i] = n++; + } + return n; + } + + graph_type m_graph; + vertices_size_type m_num_vertices; + edges_size_type m_num_edges; + vertex_index_type m_max_vertex_index; + edge_index_type m_max_edge_index; +}; + +#define DIRECTED_GRAPH_PARAMS typename VP, typename EP, typename GP +#define DIRECTED_GRAPH directed_graph + +// IncidenceGraph concepts +template +inline typename DIRECTED_GRAPH::vertex_descriptor +source(typename DIRECTED_GRAPH::edge_descriptor e, + DIRECTED_GRAPH const& g) +{ return source(e, g.impl()); } + +template +inline typename DIRECTED_GRAPH::vertex_descriptor +target(typename DIRECTED_GRAPH::edge_descriptor e, + DIRECTED_GRAPH const& g) +{ return target(e, g.impl()); } + +template +inline typename DIRECTED_GRAPH::degree_size_type +out_degree(typename DIRECTED_GRAPH::vertex_descriptor v, DIRECTED_GRAPH const& g) +{ return out_degree(v, g.impl()); } + +template +inline std::pair< + typename DIRECTED_GRAPH::out_edge_iterator, + typename DIRECTED_GRAPH::out_edge_iterator +> +out_edges(typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH const& g) +{ return out_edges(v, g.impl()); } + +// BidirectionalGraph concepts +template +inline typename DIRECTED_GRAPH::degree_size_type +in_degree(typename DIRECTED_GRAPH::vertex_descriptor v, DIRECTED_GRAPH const& g) +{ return in_degree(v, g.impl()); } + +template +inline std::pair< + typename DIRECTED_GRAPH::in_edge_iterator, + typename DIRECTED_GRAPH::in_edge_iterator +> +in_edges(typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH const& g) +{ return in_edges(v, g.impl()); } + + +template +inline typename DIRECTED_GRAPH::degree_size_type +degree(typename DIRECTED_GRAPH::vertex_descriptor v, DIRECTED_GRAPH const& g) +{ return degree(v, g.impl()); } + +// AdjacencyGraph concepts +template +inline std::pair< + typename DIRECTED_GRAPH::adjacency_iterator, + typename DIRECTED_GRAPH::adjacency_iterator + > +adjacent_vertices(typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH const& g) +{ return adjacent_vertices(v, g.impl()); } + +template +typename DIRECTED_GRAPH::vertex_descriptor +vertex(typename DIRECTED_GRAPH::vertices_size_type n, + DIRECTED_GRAPH const& g) +{ return vertex(g.impl()); } + +template +std::pair +edge(typename DIRECTED_GRAPH::vertex_descriptor u, + typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH const& g) +{ return edge(u, v, g.impl()); } + +// VertexListGraph concepts +template +inline typename DIRECTED_GRAPH::vertices_size_type +num_vertices(DIRECTED_GRAPH const& g) +{ return g.num_vertices(); } + +template +inline std::pair< + typename DIRECTED_GRAPH::vertex_iterator, + typename DIRECTED_GRAPH::vertex_iterator +> +vertices(DIRECTED_GRAPH const& g) +{ return vertices(g.impl()); } + +// EdgeListGraph concepts +template +inline typename DIRECTED_GRAPH::edges_size_type +num_edges(DIRECTED_GRAPH const& g) +{ return g.num_edges(); } + +template +inline std::pair< + typename DIRECTED_GRAPH::edge_iterator, + typename DIRECTED_GRAPH::edge_iterator +> +edges(DIRECTED_GRAPH const& g) +{ return edges(g.impl()); } + +// MutableGraph concepts +template +inline typename DIRECTED_GRAPH::vertex_descriptor +add_vertex(DIRECTED_GRAPH& g) +{ return g.add_vertex(); } + +template +inline typename DIRECTED_GRAPH::vertex_descriptor +add_vertex(typename DIRECTED_GRAPH::vertex_property_type const& p, + DIRECTED_GRAPH& g) +{ return g.add_vertex(p); } + +template +inline void +clear_vertex(typename DIRECTED_GRAPH::vertex_descriptor v, +DIRECTED_GRAPH& g) +{ return g.clear_vertex(v); } + +template +inline void +remove_vertex(typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH& g) +{ return g.remove_vertex(v); } + +template +inline std::pair +add_edge(typename DIRECTED_GRAPH::vertex_descriptor u, + typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH& g) +{ return g.add_edge(u, v); } + +template +inline std::pair +add_edge(typename DIRECTED_GRAPH::vertex_descriptor u, + typename DIRECTED_GRAPH::vertex_descriptor v, + typename DIRECTED_GRAPH::edge_property_type const& p, + DIRECTED_GRAPH& g) +{ return g.add_edge(u, v, p); } + +template +inline void remove_edge(typename DIRECTED_GRAPH::vertex_descriptor u, + typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH& g) +{ return g.remove_edge(u, v); } + + +template +inline void remove_edge(typename DIRECTED_GRAPH::edge_descriptor e, DIRECTED_GRAPH& g) +{ return g.remove_edge(e); } + +template +inline void remove_edge(typename DIRECTED_GRAPH::edge_iterator i, DIRECTED_GRAPH& g) +{ return g.remove_edge(i); } + +template +inline void remove_edge_if(Predicate pred, DIRECTED_GRAPH& g) +{ return remove_edge_if(pred, g.impl()); } + +template +inline void +remove_out_edge_if(typename DIRECTED_GRAPH::vertex_descriptor v, + Predicate pred, + DIRECTED_GRAPH& g) +{ return remove_out_edge_if(v, pred, g.impl()); } + +template +inline void +remove_in_edge_if(typename DIRECTED_GRAPH::vertex_descriptor v, + Predicate pred, + DIRECTED_GRAPH& g) +{ return remove_in_edge_if(v, pred, g.impl()); } + +// Helper code for working with property maps +namespace detail +{ + struct directed_graph_vertex_property_selector { + template + struct bind_ { + typedef typename DirectedGraph::graph_type Graph; + typedef property_map PropertyMap; + typedef typename PropertyMap::type type; + typedef typename PropertyMap::const_type const_type; + }; + }; + + struct directed_graph_edge_property_selector { + template + struct bind_ { + typedef typename DirectedGraph::graph_type Graph; + typedef property_map PropertyMap; + typedef typename PropertyMap::type type; + typedef typename PropertyMap::const_type const_type; + }; + }; +} + +template <> +struct vertex_property_selector +{ typedef detail::directed_graph_vertex_property_selector type; }; + +template <> +struct edge_property_selector +{ typedef detail::directed_graph_edge_property_selector type; }; + +// PropertyGraph concepts +template +inline typename property_map::type +get(Property p, DIRECTED_GRAPH& g) +{ return get(p, g.impl()); } + +template +inline typename property_map::const_type +get(Property p, DIRECTED_GRAPH const& g) +{ return get(p, g.impl()); } + +template +inline typename property_traits< + typename property_map< + typename DIRECTED_GRAPH::graph_type, Property + >::const_type +>::value_type +get(Property p, DIRECTED_GRAPH const& g, Key const& k) +{ return get(p, g.impl(), k); } + +template +inline void put(Property p, DIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(p, g.impl(), k, v); } + +template +typename graph_property::type& +get_property(DIRECTED_GRAPH& g, Property p) +{ return get_property(g.impl(), p); } + +template +typename graph_property::type const& +get_property(DIRECTED_GRAPH const& g, Property p) +{ return get_property(g.impl(), p); } + +template +void +set_property(DIRECTED_GRAPH& g, Property p, Value v) +{ return set_property(g.impl(), p, v); } + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + +template +inline typename property_map::type +get(Type Bundle::* p, DIRECTED_GRAPH& g) { + typedef typename property_map< + DIRECTED_GRAPH, Type Bundle::* + >::type return_type; + return return_type(&g, p); +} + +template +inline typename property_map::const_type +get(Type Bundle::* p, DIRECTED_GRAPH const& g) { + typedef typename property_map< + DIRECTED_GRAPH, Type Bundle::* + >::const_type return_type; + return return_type(&g, p); +} + +template +inline Type get(Type Bundle::* p, DIRECTED_GRAPH const& g, Key const& k) +{ return get(p, g.impl(), k); } + +template +inline void put(Type Bundle::* p, DIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(p, g.impl(), k, v); } +#endif + +// Vertex index management + +template +inline typename DIRECTED_GRAPH::vertex_index_type +get_vertex_index(typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH const& g) +{ return get(vertex_index, g, v); } + +template +typename DIRECTED_GRAPH::vertex_index_type +max_vertex_index(DIRECTED_GRAPH const& g) +{ return g.max_vertex_index(); } + +template +inline void +renumber_vertex_indices(DIRECTED_GRAPH& g) +{ g.renumber_vertex_indices(); } + +template +inline void +remove_vertex_and_renumber_indices(typename DIRECTED_GRAPH::vertex_iterator i, + DIRECTED_GRAPH& g) +{ g.remove_vertex_and_renumber_indices(i); } + +// Edge index management +template +inline typename DIRECTED_GRAPH::edge_index_type +get_edge_index(typename DIRECTED_GRAPH::edge_descriptor v, DIRECTED_GRAPH const& g) +{ return get(edge_index, g, v); } + +template +typename DIRECTED_GRAPH::edge_index_type +max_edge_index(DIRECTED_GRAPH const& g) +{ return g.max_edge_index(); } + +template +inline void renumber_edge_indices(DIRECTED_GRAPH& g) +{ g.renumber_edge_indices(); } + +template +inline void +remove_edge_and_renumber_indices(typename DIRECTED_GRAPH::edge_iterator i, + DIRECTED_GRAPH& g) +{ g.remove_edge_and_renumber_indices(i); } + +// Index management +template +inline void +renumber_indices(DIRECTED_GRAPH& g) +{ g.renumber_indices(); } + +// Mutability Traits +template +struct graph_mutability_traits { + typedef mutable_property_graph_tag category; +}; + +#undef DIRECTED_GRAPH_PARAMS +#undef DIRECTED_GRAPH + +} /* namespace boost */ + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjacency_list.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjacency_list.hpp new file mode 100644 index 0000000000..f7dde1c44a --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjacency_list.hpp @@ -0,0 +1,3963 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. +// Copyright (C) 2007 Douglas Gregor + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine + +#ifndef BOOST_GRAPH_DISTRIBUTED_ADJACENCY_LIST_HPP +#define BOOST_GRAPH_DISTRIBUTED_ADJACENCY_LIST_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Callbacks +#include + +// Serialization +#include +#include +#include +#include + +// Named vertices +#include + +#include + +namespace boost { + + /// The type used to store an identifier that uniquely names a processor. + // NGE: I doubt we'll be running on more than 32768 procs for the time being + typedef /*int*/ short processor_id_type; + + // Tell which processor the target of an edge resides on (for + // directed graphs) or which processor the other end point of the + // edge resides on (for undirected graphs). + enum edge_target_processor_id_t { edge_target_processor_id }; + BOOST_INSTALL_PROPERTY(edge, target_processor_id); + + // For undirected graphs, tells whether the edge is locally owned. + enum edge_locally_owned_t { edge_locally_owned }; + BOOST_INSTALL_PROPERTY(edge, locally_owned); + + // For bidirectional graphs, stores the incoming edges. + enum vertex_in_edges_t { vertex_in_edges }; + BOOST_INSTALL_PROPERTY(vertex, in_edges); + + /// Tag class for directed, distributed adjacency list + struct directed_distributed_adj_list_tag + : public virtual distributed_graph_tag, + public virtual distributed_vertex_list_graph_tag, + public virtual distributed_edge_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag {}; + + /// Tag class for bidirectional, distributed adjacency list + struct bidirectional_distributed_adj_list_tag + : public virtual distributed_graph_tag, + public virtual distributed_vertex_list_graph_tag, + public virtual distributed_edge_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag, + public virtual bidirectional_graph_tag {}; + + /// Tag class for undirected, distributed adjacency list + struct undirected_distributed_adj_list_tag + : public virtual distributed_graph_tag, + public virtual distributed_vertex_list_graph_tag, + public virtual distributed_edge_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag, + public virtual bidirectional_graph_tag {}; + + namespace detail { + template + void + serialize(Archiver& ar, edge_base& e, + const unsigned int /*version*/) + { + ar & unsafe_serialize(e.m_source) + & unsafe_serialize(e.m_target); + } + + template + void + serialize(Archiver& ar, edge_desc_impl& e, + const unsigned int /*version*/) + { + ar & boost::serialization::base_object >(e) + & unsafe_serialize(e.m_eproperty); + } + } + + namespace detail { namespace parallel { + + /** + * A distributed vertex descriptor. These descriptors contain both + * the ID of the processor that owns the vertex and a local vertex + * descriptor that identifies the particular vertex for that + * processor. + */ + template + struct global_descriptor + { + typedef LocalDescriptor local_descriptor_type; + + global_descriptor() : owner(), local() { } + + global_descriptor(processor_id_type owner, LocalDescriptor local) + : owner(owner), local(local) { } + + processor_id_type owner; + LocalDescriptor local; + + /** + * A function object that, given a processor ID, generates + * distributed vertex descriptors from local vertex + * descriptors. This function object is used by the + * vertex_iterator of the distributed adjacency list. + */ + struct generator + { + typedef global_descriptor result_type; + typedef LocalDescriptor argument_type; + + generator() {} + generator(processor_id_type owner) : owner(owner) {} + + result_type operator()(argument_type v) const + { return result_type(owner, v); } + + private: + processor_id_type owner; + }; + + template + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & owner & unsafe_serialize(local); + } + }; + + /// Determine the process that owns the given descriptor + template + inline processor_id_type owner(const global_descriptor& v) + { return v.owner; } + + /// Determine the local portion of the given descriptor + template + inline LocalDescriptor local(const global_descriptor& v) + { return v.local; } + + /// Compare distributed vertex descriptors for equality + template + inline bool + operator==(const global_descriptor& u, + const global_descriptor& v) + { + return u.owner == v.owner && u.local == v.local; + } + + /// Compare distributed vertex descriptors for inequality + template + inline bool + operator!=(const global_descriptor& u, + const global_descriptor& v) + { return !(u == v); } + + template + inline bool + operator<(const global_descriptor& u, + const global_descriptor& v) + { + return (u.owner) < v.owner || (u.owner == v.owner && (u.local) < v.local); + } + + template + inline bool + operator<=(const global_descriptor& u, + const global_descriptor& v) + { + return u.owner <= v.owner || (u.owner == v.owner && u.local <= v.local); + } + + template + inline bool + operator>(const global_descriptor& u, + const global_descriptor& v) + { + return v < u; + } + + template + inline bool + operator>=(const global_descriptor& u, + const global_descriptor& v) + { + return v <= u; + } + + // DPG TBD: Add <, <=, >=, > for global descriptors + + /** + * A Readable Property Map that extracts a global descriptor pair + * from a global_descriptor. + */ + template + struct global_descriptor_property_map + { + typedef std::pair value_type; + typedef value_type reference; + typedef global_descriptor key_type; + typedef readable_property_map_tag category; + }; + + template + inline std::pair + get(global_descriptor_property_map, + global_descriptor x) + { + return std::pair(x.owner, x.local); + } + + /** + * A Readable Property Map that extracts the owner of a global + * descriptor. + */ + template + struct owner_property_map + { + typedef processor_id_type value_type; + typedef value_type reference; + typedef global_descriptor key_type; + typedef readable_property_map_tag category; + }; + + template + inline processor_id_type + get(owner_property_map, + global_descriptor x) + { + return x.owner; + } + + /** + * A Readable Property Map that extracts the local descriptor from + * a global descriptor. + */ + template + struct local_descriptor_property_map + { + typedef LocalDescriptor value_type; + typedef value_type reference; + typedef global_descriptor key_type; + typedef readable_property_map_tag category; + }; + + template + inline LocalDescriptor + get(local_descriptor_property_map, + global_descriptor x) + { + return x.local; + } + + /** + * Stores an incoming edge for a bidirectional distributed + * adjacency list. The user does not see this type directly, + * because it is just an implementation detail. + */ + template + struct stored_in_edge + { + stored_in_edge(processor_id_type sp, Edge e) + : source_processor(sp), e(e) {} + + processor_id_type source_processor; + Edge e; + }; + + /** + * A distributed edge descriptor. These descriptors contain the + * underlying edge descriptor, the processor IDs for both the + * source and the target of the edge, and a boolean flag that + * indicates which of the processors actually owns the edge. + */ + template + struct edge_descriptor + { + edge_descriptor(processor_id_type sp = processor_id_type(), + processor_id_type tp = processor_id_type(), + bool owns = false, Edge ld = Edge()) + : source_processor(sp), target_processor(tp), + source_owns_edge(owns), local(ld) {} + + processor_id_type owner() const + { + return source_owns_edge? source_processor : target_processor; + } + + /// The processor that the source vertex resides on + processor_id_type source_processor; + + /// The processor that the target vertex resides on + processor_id_type target_processor; + + /// True when the source processor owns the edge, false when the + /// target processor owns the edge. + bool source_owns_edge; + + /// The local edge descriptor. + Edge local; + + /** + * Function object that generates edge descriptors for the + * out_edge_iterator of the given distributed adjacency list + * from the edge descriptors of the underlying adjacency list. + */ + template + class out_generator + { + typedef typename Graph::directed_selector directed_selector; + + public: + typedef edge_descriptor result_type; + typedef Edge argument_type; + + out_generator() : g(0) {} + explicit out_generator(const Graph& g) : g(&g) {} + + result_type operator()(argument_type e) const + { return map(e, directed_selector()); } + + private: + result_type map(argument_type e, directedS) const + { + return result_type(g->processor(), + get(edge_target_processor_id, g->base(), e), + true, e); + } + + result_type map(argument_type e, bidirectionalS) const + { + return result_type(g->processor(), + get(edge_target_processor_id, g->base(), e), + true, e); + } + + result_type map(argument_type e, undirectedS) const + { + return result_type(g->processor(), + get(edge_target_processor_id, g->base(), e), + get(edge_locally_owned, g->base(), e), + e); + } + + const Graph* g; + }; + + /** + * Function object that generates edge descriptors for the + * in_edge_iterator of the given distributed adjacency list + * from the edge descriptors of the underlying adjacency list. + */ + template + class in_generator + { + typedef typename Graph::directed_selector DirectedS; + + public: + typedef typename ct_if<(is_same::value), + stored_in_edge, + Edge>::type argument_type; + typedef edge_descriptor result_type; + + in_generator() : g(0) {} + explicit in_generator(const Graph& g) : g(&g) {} + + result_type operator()(argument_type e) const + { return map(e, DirectedS()); } + + private: + /** + * For a bidirectional graph, we just generate the appropriate + * edge. No tricks. + */ + result_type map(argument_type e, bidirectionalS) const + { + return result_type(e.source_processor, + g->processor(), + true, + e.e); + } + + /** + * For an undirected graph, we generate descriptors for the + * incoming edges by swapping the source/target of the + * underlying edge descriptor (a hack). The target processor + * ID on the edge is actually the source processor for this + * edge, and our processor is the target processor. If the + * edge is locally owned, then it is owned by the target (us); + * otherwise it is owned by the source. + */ + result_type map(argument_type e, undirectedS) const + { + typename Graph::local_edge_descriptor local_edge(e); + // TBD: This is a very, VERY lame hack that takes advantage + // of our knowledge of the internals of the BGL + // adjacency_list. There should be a cleaner way to handle + // this... + using std::swap; + swap(local_edge.m_source, local_edge.m_target); + return result_type(get(edge_target_processor_id, g->base(), e), + g->processor(), + !get(edge_locally_owned, g->base(), e), + local_edge); + } + + const Graph* g; + }; + + private: + friend class boost::serialization::access; + + template + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar + & source_processor + & target_processor + & source_owns_edge + & local; + } + }; + + /// Determine the process that owns this edge + template + inline processor_id_type + owner(const edge_descriptor& e) + { return e.source_owns_edge? e.source_processor : e.target_processor; } + + /// Determine the local descriptor for this edge. + template + inline Edge + local(const edge_descriptor& e) + { return e.local; } + + /** + * A Readable Property Map that extracts the owner and local + * descriptor of an edge descriptor. + */ + template + struct edge_global_property_map + { + typedef std::pair value_type; + typedef value_type reference; + typedef edge_descriptor key_type; + typedef readable_property_map_tag category; + }; + + template + inline std::pair + get(edge_global_property_map, const edge_descriptor& e) + { + typedef std::pair result_type; + return result_type(e.source_owns_edge? e.source_processor + /* target owns edge*/: e.target_processor, + e.local); + } + + /** + * A Readable Property Map that extracts the owner of an edge + * descriptor. + */ + template + struct edge_owner_property_map + { + typedef processor_id_type value_type; + typedef value_type reference; + typedef edge_descriptor key_type; + typedef readable_property_map_tag category; + }; + + template + inline processor_id_type + get(edge_owner_property_map, const edge_descriptor& e) + { + return e.source_owns_edge? e.source_processor : e.target_processor; + } + + /** + * A Readable Property Map that extracts the local descriptor from + * an edge descriptor. + */ + template + struct edge_local_property_map + { + typedef Edge value_type; + typedef value_type reference; + typedef edge_descriptor key_type; + typedef readable_property_map_tag category; + }; + + template + inline Edge + get(edge_local_property_map, + const edge_descriptor& e) + { + return e.local; + } + + /** Compare distributed edge descriptors for equality. + * + * \todo need edge_descriptor to know if it is undirected so we + * can compare both ways. + */ + template + inline bool + operator==(const edge_descriptor& e1, + const edge_descriptor& e2) + { + return (e1.source_processor == e2.source_processor + && e1.target_processor == e2.target_processor + && e1.local == e2.local); + } + + /// Compare distributed edge descriptors for inequality. + template + inline bool + operator!=(const edge_descriptor& e1, + const edge_descriptor& e2) + { return !(e1 == e2); } + + /** + * Configuration for the distributed adjacency list. We use this + * parameter to store all of the configuration details for the + * implementation of the distributed adjacency list, which allows us to + * get at the distribution type in the maybe_named_graph. + */ + template + struct adjacency_list_config + { + typedef typename mpl::if_, + vecS, InVertexListS>::type + VertexListS; + + /// Introduce the target processor ID property for each edge + typedef property edge_property_with_id; + + /// For undirected graphs, introduce the locally-owned property for edges + typedef typename ct_if<(is_same::value), + property, + edge_property_with_id>::type + base_edge_property_type; + + /// The edge descriptor type for the local subgraph + typedef typename adjacency_list_traits::edge_descriptor + local_edge_descriptor; + + /// For bidirectional graphs, the type of an incoming stored edge + typedef stored_in_edge bidir_stored_edge; + + /// The container type that will store incoming edges for a + /// bidirectional graph. + typedef typename container_gen::type + in_edge_list_type; + + // Bidirectional graphs have an extra vertex property to store + // the incoming edges. + typedef typename ct_if<(is_same::value), + property, + VertexProperty>::type + base_vertex_property_type; + + // The type of the distributed adjacency list + typedef adjacency_list, + DirectedS, VertexProperty, EdgeProperty, + GraphProperty, EdgeListS> + graph_type; + + // The type of the underlying adjacency list implementation + typedef adjacency_list + inherited; + + typedef InDistribution in_distribution_type; + typedef typename inherited::vertices_size_type vertices_size_type; + + typedef typename ::boost::graph::distributed::select_distribution< + in_distribution_type, VertexProperty, vertices_size_type, + ProcessGroup>::type + base_distribution_type; + + typedef ::boost::graph::distributed::shuffled_distribution< + base_distribution_type> distribution_type; + + typedef VertexProperty vertex_property_type; + typedef EdgeProperty edge_property_type; + typedef ProcessGroup process_group_type; + + typedef VertexListS vertex_list_selector; + typedef OutEdgeListS out_edge_list_selector; + typedef DirectedS directed_selector; + typedef GraphProperty graph_property_type; + typedef EdgeListS edge_list_selector; + }; + + // Maybe initialize the indices of each vertex + template + void + maybe_initialize_vertex_indices(IteratorPair p, VertexIndexMap to_index, + read_write_property_map_tag) + { + typedef typename property_traits::value_type index_t; + index_t next_index = 0; + while (p.first != p.second) + put(to_index, *p.first++, next_index++); + } + + template + inline void + maybe_initialize_vertex_indices(IteratorPair p, VertexIndexMap to_index, + readable_property_map_tag) + { + // Do nothing + } + + template + inline void + maybe_initialize_vertex_indices(IteratorPair p, VertexIndexMap to_index) + { + typedef typename property_traits::category category; + maybe_initialize_vertex_indices(p, to_index, category()); + } + + template + inline void + maybe_initialize_vertex_indices(IteratorPair p, + ::boost::detail::error_property_not_found) + { } + + /*********************************************************************** + * Message Payloads * + ***********************************************************************/ + + /** + * Data stored with a msg_add_edge message, which requests the + * remote addition of an edge. + */ + template + struct msg_add_edge_data + { + msg_add_edge_data() { } + + msg_add_edge_data(Vertex source, Vertex target) + : source(source.local), target(target) { } + + /// The source of the edge; the processor will be the + /// receiving processor. + LocalVertex source; + + /// The target of the edge. + Vertex target; + + template + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & unsafe_serialize(source) & target; + } + }; + + /** + * Like @c msg_add_edge_data, but also includes a user-specified + * property value to be attached to the edge. + */ + template + struct msg_add_edge_with_property_data + : msg_add_edge_data, + maybe_store_property + { + private: + typedef msg_add_edge_data inherited_data; + typedef maybe_store_property inherited_property; + + public: + msg_add_edge_with_property_data() { } + + msg_add_edge_with_property_data(Vertex source, + Vertex target, + const EdgeProperty& property) + : inherited_data(source, target), + inherited_property(property) { } + + template + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & boost::serialization::base_object(*this) + & boost::serialization::base_object(*this); + } + }; + + //------------------------------------------------------------------------ + // Distributed adjacency list property map details + /** + * Metafunction that extracts the given property from the given + * distributed adjacency list type. This could be implemented much + * more cleanly, but even newer versions of GCC (e.g., 3.2.3) + * cannot properly handle partial specializations involving + * enumerator types. + */ + template + struct get_adj_list_pmap + { + template + struct apply + { + typedef Graph graph_type; + typedef typename graph_type::process_group_type process_group_type; + typedef typename graph_type::inherited base_graph_type; + typedef typename property_map::type + local_pmap; + typedef typename property_map::const_type + local_const_pmap; + + typedef graph_traits traits; + typedef typename graph_type::local_vertex_descriptor local_vertex; + typedef typename property_traits::key_type local_key_type; + + typedef typename property_traits::value_type value_type; + + typedef typename property_map::const_type + vertex_global_map; + typedef typename property_map::const_type + edge_global_map; + + typedef typename mpl::if_c<(is_same::value), + vertex_global_map, edge_global_map>::type + global_map; + + public: + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_pmap> type; + + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_const_pmap> const_type; + }; + }; + + /** + * The local vertex index property map is actually a mapping from + * the local vertex descriptors to vertex indices. + */ + template<> + struct get_adj_list_pmap + { + template + struct apply + : ::boost::property_map + { }; + }; + + /** + * The vertex index property map maps from global descriptors + * (e.g., the vertex descriptor of a distributed adjacency list) + * to the underlying local index. It is not valid to use this + * property map with nonlocal descriptors. + */ + template<> + struct get_adj_list_pmap + { + template + struct apply + { + private: + typedef typename property_map::const_type + global_map; + + typedef property_map local; + + public: + typedef local_property_map type; + typedef local_property_map const_type; + }; + }; + + /** + * The vertex owner property map maps from vertex descriptors to + * the processor that owns the vertex. + */ + template<> + struct get_adj_list_pmap + { + template + struct apply + { + private: + typedef typename Graph::local_vertex_descriptor + local_vertex_descriptor; + public: + typedef global_descriptor_property_map type; + typedef type const_type; + }; + }; + + /** + * The vertex owner property map maps from vertex descriptors to + * the processor that owns the vertex. + */ + template<> + struct get_adj_list_pmap + { + template + struct apply + { + private: + typedef typename Graph::local_vertex_descriptor + local_vertex_descriptor; + public: + typedef owner_property_map type; + typedef type const_type; + }; + }; + + /** + * The vertex local property map maps from vertex descriptors to + * the local descriptor for that vertex. + */ + template<> + struct get_adj_list_pmap + { + template + struct apply + { + private: + typedef typename Graph::local_vertex_descriptor + local_vertex_descriptor; + public: + typedef local_descriptor_property_map type; + typedef type const_type; + }; + }; + + /** + * The edge global property map maps from edge descriptors to + * a pair of the owning processor and local descriptor. + */ + template<> + struct get_adj_list_pmap + { + template + struct apply + { + private: + typedef typename Graph::local_edge_descriptor + local_edge_descriptor; + public: + typedef edge_global_property_map type; + typedef type const_type; + }; + }; + + /** + * The edge owner property map maps from edge descriptors to + * the processor that owns the edge. + */ + template<> + struct get_adj_list_pmap + { + template + struct apply + { + private: + typedef typename Graph::local_edge_descriptor + local_edge_descriptor; + public: + typedef edge_owner_property_map type; + typedef type const_type; + }; + }; + + /** + * The edge local property map maps from edge descriptors to + * the local descriptor for that edge. + */ + template<> + struct get_adj_list_pmap + { + template + struct apply + { + private: + typedef typename Graph::local_edge_descriptor + local_edge_descriptor; + public: + typedef edge_local_property_map type; + typedef type const_type; + }; + }; + //------------------------------------------------------------------------ + + // Directed graphs do not have in edges, so this is a no-op + template + inline void + remove_in_edge(typename Graph::edge_descriptor, Graph&, directedS) + { } + + // Bidirectional graphs have in edges stored in the + // vertex_in_edges property. + template + inline void + remove_in_edge(typename Graph::edge_descriptor e, Graph& g, bidirectionalS) + { + typedef typename Graph::in_edge_list_type in_edge_list_type; + in_edge_list_type& in_edges = + get(vertex_in_edges, g.base())[target(e, g).local]; + typename in_edge_list_type::iterator i = in_edges.begin(); + while (i != in_edges.end() + && !(i->source_processor == source(e, g).owner) + && i->e == e.local) + ++i; + + assert(i != in_edges.end()); + in_edges.erase(i); + } + + // Undirected graphs have in edges stored as normal edges. + template + inline void + remove_in_edge(typename Graph::edge_descriptor e, Graph& g, undirectedS) + { + typedef typename Graph::inherited base_type; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + // TBD: can we make this more efficient? + // Removing edge (v, u). v is local + base_type& bg = g.base(); + vertex_descriptor u = source(e, g); + vertex_descriptor v = target(e, g); + if (v.owner != process_id(g.process_group())) { + using std::swap; + swap(u, v); + } + + typename graph_traits::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(v.local, bg); ei != ei_end; ++ei) + { + if (target(*ei, g.base()) == u.local + // TBD: deal with parallel edges properly && *ei == e + && get(edge_target_processor_id, bg, *ei) == u.owner) { + remove_edge(ei, bg); + return; + } + } + + if (v.owner == process_id(g.process_group())) { + + } + } + + //------------------------------------------------------------------------ + // Lazy addition of edges + + // Work around the fact that an adjacency_list with vecS vertex + // storage automatically adds edges when the descriptor is + // out-of-range. + template + inline std::pair + add_local_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + const typename Config::edge_property_type& p, + vec_adj_list_impl& g_) + { + adj_list_helper& g = g_; + return add_edge(u, v, p, g); + } + + template + inline std::pair + add_local_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + const typename Config::edge_property_type& p, + boost::adj_list_impl& g) + { + return add_edge(u, v, p, g); + } + + template + struct msg_nonlocal_edge_data + : public detail::parallel::maybe_store_property + { + typedef EdgeProperty edge_property_type; + typedef EdgeDescriptor local_edge_descriptor; + typedef detail::parallel::maybe_store_property + inherited; + + msg_nonlocal_edge_data() {} + msg_nonlocal_edge_data(local_edge_descriptor e, + const edge_property_type& p) + : inherited(p), e(e) { } + + local_edge_descriptor e; + + template + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & boost::serialization::base_object(*this) & e; + } + }; + + template + struct msg_remove_edge_data + { + typedef EdgeDescriptor edge_descriptor; + msg_remove_edge_data() {} + explicit msg_remove_edge_data(edge_descriptor e) : e(e) {} + + edge_descriptor e; + + template + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & e; + } + }; + + } } // end namespace detail::parallel + + /** + * Adjacency list traits for a distributed adjacency list. Contains + * the vertex and edge descriptors, the directed-ness, and the + * parallel edges typedefs. + */ + template + struct adjacency_list_traits, + DirectedS> + { + private: + typedef typename mpl::if_, + vecS, + InVertexListS>::type VertexListS; + + typedef adjacency_list_traits + base_type; + + public: + typedef typename base_type::vertex_descriptor local_vertex_descriptor; + typedef typename base_type::edge_descriptor local_edge_descriptor; + + typedef typename boost::ct_if_t::type + >::type directed_category; + + typedef typename parallel_edge_traits::type + edge_parallel_category; + + typedef detail::parallel::global_descriptor + vertex_descriptor; + + typedef detail::parallel::edge_descriptor + edge_descriptor; + }; + +#define PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS \ + typename OutEdgeListS, typename ProcessGroup, typename InVertexListS, \ + typename InDistribution, typename DirectedS, typename VertexProperty, \ + typename EdgeProperty, typename GraphProperty, typename EdgeListS + +#define PBGL_DISTRIB_ADJLIST_TYPE \ + adjacency_list, \ + DirectedS, VertexProperty, EdgeProperty, GraphProperty, \ + EdgeListS> + +#define PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG \ + typename OutEdgeListS, typename ProcessGroup, typename InVertexListS, \ + typename InDistribution, typename VertexProperty, \ + typename EdgeProperty, typename GraphProperty, typename EdgeListS + +#define PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directed) \ + adjacency_list, \ + directed, VertexProperty, EdgeProperty, GraphProperty, \ + EdgeListS> + + /** A distributed adjacency list. + * + * This class template partial specialization defines a distributed + * (or "partitioned") adjacency list graph. The distributed + * adjacency list is similar to the standard Boost Graph Library + * adjacency list, which stores a list of vertices and for each + * verted the list of edges outgoing from the vertex (and, in some + * cases, also the edges incoming to the vertex). The distributed + * adjacency list differs in that it partitions the graph into + * several subgraphs that are then divided among different + * processors (or nodes within a cluster). The distributed adjacency + * list attempts to maintain a high degree of compatibility with the + * standard, non-distributed adjacency list. + * + * The graph is partitioned by vertex, with each processor storing + * all of the required information for a particular subset of the + * vertices, including vertex properties, outgoing edges, and (for + * bidirectional graphs) incoming edges. This information is + * accessible only on the processor that owns the vertex: for + * instance, if processor 0 owns vertex @c v, no other processor can + * directly access the properties of @c v or enumerate its outgoing + * edges. + * + * Edges in a graph may be entirely local (connecting two local + * vertices), but more often it is the case that edges are + * non-local, meaning that the two vertices they connect reside in + * different processes. Edge properties are stored with the + * originating vertex for directed and bidirectional graphs, and are + * therefore only accessible from the processor that owns the + * originating vertex. Other processors may query the source and + * target of the edge, but cannot access its properties. This is + * particularly interesting when accessing the incoming edges of a + * bidirectional graph, which are not guaranteed to be stored on the + * processor that is able to perform the iteration. For undirected + * graphs the situation is more complicated, since no vertex clearly + * owns the edges: the list of edges incident to a vertex may + * contain a mix of local and non-local edges. + * + * The distributed adjacency list is able to model several of the + * existing Graph concepts. It models the Graph concept because it + * exposes vertex and edge descriptors in the normal way; these + * descriptors model the GlobalDescriptor concept (because they have + * an owner and a local descriptor), and as such the distributed + * adjacency list models the DistributedGraph concept. The adjacency + * list also models the IncidenceGraph and AdjacencyGraph concepts, + * although this is only true so long as the domain of the valid + * expression arguments are restricted to vertices and edges stored + * locally. Likewise, bidirectional and undirected distributed + * adjacency lists model the BidirectionalGraph concept (vertex and + * edge domains must be respectived) and the distributed adjacency + * list models the MutableGraph concept (vertices and edges can only + * be added or removed locally). T he distributed adjacency list + * does not, however, model the VertexListGraph or EdgeListGraph + * concepts, because we can not efficiently enumerate all vertices + * or edges in the graph. Instead, the local subsets of vertices and + * edges can be enumerated (with the same syntax): the distributed + * adjacency list therefore models the DistributedVertexListGraph + * and DistributedEdgeListGraph concepts, because concurrent + * iteration over all of the vertices or edges stored on each + * processor will visit each vertex or edge. + * + * The distributed adjacency list is distinguished from the + * non-distributed version by the vertex list descriptor, which will + * be @c distributedS. Here, + * the VertexListS type plays the same role as the VertexListS type + * in the non-distributed adjacency list: it allows one to select + * the data structure that will be used to store the local + * vertices. The ProcessGroup type, on the other hand, is unique to + * distributed data structures: it is the type that abstracts a + * group of cooperating processes, and it used for process + * identification, communication, and synchronization, among other + * things. Different process group types represent different + * communication mediums (e.g., MPI, PVM, TCP) or different models + * of communication (LogP, CGM, BSP, synchronous, etc.). This + * distributed adjacency list assumes a model based on non-blocking + * sends. + * + * Distribution of vertices across different processors is + * accomplished in two different ways. When initially constructing + * the graph, the user may provide a distribution object (that + * models the Distribution concept), which will determine the + * distribution of vertices to each process. Additionally, the @c + * add_vertex and @c add_edge operations add vertices or edges + * stored on the local processor. For @c add_edge, this is + * accomplished by requiring that the source vertex of the new edge + * be local to the process executing @c add_edge. + * + * Internal properties of a distributed adjacency list are + * accessible in the same manner as internal properties for a + * non-distributed adjacency list for local vertices or + * edges. Access to properties for remote vertices or edges occurs + * with the same syntax, but involve communication with the owner of + * the information: for more information, refer to class template + * @ref distributed_property_map, which manages distributed + * property maps. Note that the distributed property maps created + * for internal properties determine their reduction operation via + * the metafunction @ref property_reduce, which for the vast + * majority of uses is correct behavior. + * + * Communication among the processes coordinating on a particular + * distributed graph relies on non-blocking message passing along + * with synchronization. Local portions of the distributed graph may + * be modified concurrently, including the introduction of non-local + * edges, but prior to accessing the graph it is recommended that + * the @c synchronize free function be invoked on the graph to clear + * up any pending interprocess communication and modifications. All + * processes will then be released from the synchronization barrier + * concurrently. + * + * \todo Determine precisely what we should do with nonlocal edges + * in undirected graphs. Our parallelization of certain algorithms + * relies on the ability to access edge property maps immediately + * (e.g., edge_weight_t), so it may be necessary to duplicate the + * edge properties in both processes (but then we need some form of + * coherence protocol). + * + * \todo What does the user do if @c property_reduce doesn't do the + * right thing? + */ + template + class adjacency_list, + DirectedS, VertexProperty, + EdgeProperty, GraphProperty, EdgeListS> + : // Support for named vertices + public graph::distributed::maybe_named_graph< + adjacency_list, + DirectedS, VertexProperty, + EdgeProperty, GraphProperty, EdgeListS>, + typename adjacency_list_traits, + DirectedS>::vertex_descriptor, + typename adjacency_list_traits, + DirectedS>::edge_descriptor, + detail::parallel::adjacency_list_config > + { + typedef detail::parallel::adjacency_list_config + config_type; + + typedef adjacency_list_traits, + DirectedS> + traits_type; + + typedef typename DirectedS::is_directed_t is_directed; + + typedef EdgeListS edge_list_selector; + + public: + /// The container type that will store incoming edges for a + /// bidirectional graph. + typedef typename config_type::in_edge_list_type in_edge_list_type; +// typedef typename inherited::edge_descriptor edge_descriptor; + + /// The type of the underlying adjacency list implementation + typedef typename config_type::inherited inherited; + + /// The type of properties stored in the local subgraph + /// Bidirectional graphs have an extra vertex property to store + /// the incoming edges. + typedef typename inherited::vertex_property_type + base_vertex_property_type; + + /// The type of the distributed adjacency list (this type) + typedef typename config_type::graph_type graph_type; + + /// Expose graph components and graph category + typedef typename traits_type::local_vertex_descriptor + local_vertex_descriptor; + typedef typename traits_type::local_edge_descriptor + local_edge_descriptor; + typedef typename traits_type::vertex_descriptor vertex_descriptor; + typedef typename traits_type::edge_descriptor edge_descriptor; + + typedef typename traits_type::directed_category directed_category; + typedef typename inherited::edge_parallel_category + edge_parallel_category; + typedef typename inherited::graph_tag graph_tag; + + // Current implementation requires the ability to have parallel + // edges in the underlying adjacency_list. Which processor each + // edge refers to is attached as an internal property. TBD: + // remove this restriction, which may require some rewriting. + BOOST_STATIC_ASSERT((is_same::value)); + + /** Determine the graph traversal category. + * + * A directed distributed adjacency list models the Distributed + * Graph, Incidence Graph, and Adjacency Graph + * concepts. Bidirectional and undirected graphs also model the + * Bidirectional Graph concept. Note that when modeling these + * concepts the domains of certain operations (e.g., in_edges) + * are restricted; see the distributed adjacency_list + * documentation. + */ + typedef typename ct_if< + (is_same::value), + directed_distributed_adj_list_tag, + typename ct_if<(is_same::value), + bidirectional_distributed_adj_list_tag, + undirected_distributed_adj_list_tag>::type> + ::type traversal_category; + + typedef typename inherited::degree_size_type degree_size_type; + typedef typename inherited::vertices_size_type vertices_size_type; + typedef typename inherited::edges_size_type edges_size_type; + typedef VertexProperty vertex_property_type; + typedef EdgeProperty edge_property_type; + typedef typename inherited::graph_property_type graph_property_type; + typedef typename inherited::vertex_bundled vertex_bundled; + typedef typename inherited::edge_bundled edge_bundled; + + typedef typename container_gen::type + local_edge_list_type; + + private: + typedef typename ct_if<(is_same::value), + typename in_edge_list_type::const_iterator, + typename inherited::out_edge_iterator>::type + base_in_edge_iterator; + + typedef typename inherited::out_edge_iterator base_out_edge_iterator; + typedef typename graph_traits::edge_iterator + base_edge_iterator; + typedef typename inherited::edge_property_type base_edge_property_type; + + typedef typename local_edge_list_type::const_iterator + undirected_edge_iterator; + + typedef InDistribution in_distribution_type; + + typedef parallel::trigger_receive_context trigger_receive_context; + + public: + /// Iterator over the (local) vertices of the graph + typedef transform_iterator + vertex_iterator; + + /// Helper for out_edge_iterator + typedef typename edge_descriptor::template out_generator + out_edge_generator; + + /// Iterator over the outgoing edges of a vertex + typedef transform_iterator + out_edge_iterator; + + /// Helper for in_edge_iterator + typedef typename edge_descriptor::template in_generator + in_edge_generator; + + /// Iterator over the incoming edges of a vertex + typedef transform_iterator + in_edge_iterator; + + /// Iterator over the neighbors of a vertex + typedef boost::adjacency_iterator< + adjacency_list, vertex_descriptor, out_edge_iterator, + typename detail::iterator_traits + ::difference_type> + adjacency_iterator; + + /// Iterator over the (local) edges in a graph + typedef typename ct_if<(is_same::value), + undirected_edge_iterator, + transform_iterator + >::type + edge_iterator; + + public: + /// The type of the mixin for named vertices + typedef graph::distributed::maybe_named_graph + named_graph_mixin; + + /// Process group used for communication + typedef ProcessGroup process_group_type; + + /// How to refer to a process + typedef typename process_group_type::process_id_type process_id_type; + + /// Whether this graph is directed, undirected, or bidirectional + typedef DirectedS directed_selector; + + // Structure used for the lazy addition of vertices + struct lazy_add_vertex_with_property; + friend struct lazy_add_vertex_with_property; + + // Structure used for the lazy addition of edges + struct lazy_add_edge; + friend struct lazy_add_edge; + + // Structure used for the lazy addition of edges with properties + struct lazy_add_edge_with_property; + friend struct lazy_add_edge_with_property; + + /// default_distribution_type is the type of the distribution used if the + /// user didn't specify an explicit one + typedef typename graph::distributed::select_distribution< + InDistribution, VertexProperty, vertices_size_type, + ProcessGroup>::default_type + default_distribution_type; + + /// distribution_type is the type of the distribution instance stored in + /// the maybe_named_graph base class + typedef typename graph::distributed::select_distribution< + InDistribution, VertexProperty, vertices_size_type, + ProcessGroup>::type + base_distribution_type; + + typedef graph::distributed::shuffled_distribution< + base_distribution_type> distribution_type; + + private: + // FIXME: the original adjacency_list contained this comment: + // Default copy constructor and copy assignment operators OK??? TBD + // but the adj_list_impl contained these declarations: + adjacency_list(const adjacency_list& other); + adjacency_list& operator=(const adjacency_list& other); + + public: + adjacency_list(const ProcessGroup& pg = ProcessGroup()) + : named_graph_mixin(pg, default_distribution_type(pg, 0)), + m_local_graph(GraphProperty()), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + } + + adjacency_list(const ProcessGroup& pg, + const base_distribution_type& distribution) + : named_graph_mixin(pg, distribution), + m_local_graph(GraphProperty()), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + } + + adjacency_list(const GraphProperty& g, + const ProcessGroup& pg = ProcessGroup()) + : named_graph_mixin(pg, default_distribution_type(pg, 0)), + m_local_graph(g), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + } + + adjacency_list(vertices_size_type n, + const GraphProperty& p, + const ProcessGroup& pg, + const base_distribution_type& distribution) + : named_graph_mixin(pg, distribution), + m_local_graph(distribution.block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + } + + adjacency_list(vertices_size_type n, + const ProcessGroup& pg, + const base_distribution_type& distribution) + : named_graph_mixin(pg, distribution), + m_local_graph(distribution.block_size(process_id(pg), n), GraphProperty()), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + } + + adjacency_list(vertices_size_type n, + const GraphProperty& p, + const ProcessGroup& pg = ProcessGroup()) + : named_graph_mixin(pg, default_distribution_type(pg, n)), + m_local_graph(this->distribution().block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + } + + adjacency_list(vertices_size_type n, + const ProcessGroup& pg = ProcessGroup()) + : named_graph_mixin(pg, default_distribution_type(pg, n)), + m_local_graph(this->distribution().block_size(process_id(pg), n), + GraphProperty()), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + } + + /* + * We assume that every processor sees the same list of edges, so + * they skip over any that don't originate from themselves. This + * means that programs switching between a local and a distributed + * graph will keep the same semantics. + */ + template + adjacency_list(EdgeIterator first, EdgeIterator last, + vertices_size_type n, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& p = GraphProperty()) + : named_graph_mixin(pg, default_distribution_type(pg, n)), + m_local_graph(this->distribution().block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + typedef typename config_type::VertexListS vertex_list_selector; + initialize(first, last, n, this->distribution(), vertex_list_selector()); + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + + } + + template + adjacency_list(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type n, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& p = GraphProperty()) + : named_graph_mixin(pg, default_distribution_type(pg, n)), + m_local_graph(this->distribution().block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + typedef typename config_type::VertexListS vertex_list_selector; + initialize(first, last, ep_iter, n, this->distribution(), + vertex_list_selector()); + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + + } + + template + adjacency_list(EdgeIterator first, EdgeIterator last, + vertices_size_type n, + const ProcessGroup& pg, + const base_distribution_type& distribution, + const GraphProperty& p = GraphProperty()) + : named_graph_mixin(pg, distribution), + m_local_graph(distribution.block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + typedef typename config_type::VertexListS vertex_list_selector; + initialize(first, last, n, this->distribution(), vertex_list_selector()); + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + + } + + template + adjacency_list(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type n, + const ProcessGroup& pg, + const base_distribution_type& distribution, + const GraphProperty& p = GraphProperty()) + : named_graph_mixin(pg, distribution), + m_local_graph(this->distribution().block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + typedef typename config_type::VertexListS vertex_list_selector; + initialize(first, last, ep_iter, n, distribution, + vertex_list_selector()); + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + + } + + ~adjacency_list() + { + synchronize(process_group_); + } + + void clear() + { + base().clear(); + local_edges_.clear(); + named_graph_mixin::clearing_graph(); + } + + void swap(adjacency_list& other) + { + using std::swap; + + base().swap(other); + swap(process_group_, other.process_group_); + } + + static vertex_descriptor null_vertex() + { + return vertex_descriptor(processor_id_type(0), + inherited::null_vertex()); + } + + inherited& base() { return m_local_graph; } + const inherited& base() const { return m_local_graph; } + + processor_id_type processor() const { return process_id(process_group_); } + process_group_type process_group() const { return process_group_.base(); } + + local_edge_list_type& local_edges() { return local_edges_; } + const local_edge_list_type& local_edges() const { return local_edges_; } + + // Redistribute the vertices of the graph by placing each vertex + // v on the processor get(vertex_to_processor, v). + template + void redistribute(VertexProcessorMap vertex_to_processor); + + // Directly access a vertex or edge bundle + vertex_bundled& operator[](vertex_descriptor v) + { + assert(v.owner == processor()); + return base()[v.local]; + } + + const vertex_bundled& operator[](vertex_descriptor v) const + { + assert(v.owner == processor()); + return base()[v.local]; + } + + edge_bundled& operator[](edge_descriptor e) + { + assert(e.owner() == processor()); + return base()[e.local]; + } + + const edge_bundled& operator[](edge_descriptor e) const + { + assert(e.owner() == processor()); + return base()[e.local]; + } + + template + void save(std::string const& filename) const; + + template + void load(std::string const& filename); + + // Callback that will be invoked whenever a new vertex is added locally + boost::function on_add_vertex; + + // Callback that will be invoked whenever a new edge is added locally + boost::function on_add_edge; + + private: + // Request vertex->processor mapping for neighbors + template + void + request_in_neighbors(vertex_descriptor, + VertexProcessorMap, + directedS) { } + + // Request vertex->processor mapping for neighbors + template + void + request_in_neighbors(vertex_descriptor, + VertexProcessorMap, + undirectedS) { } + + // Request vertex->processor mapping for neighbors + template + void + request_in_neighbors(vertex_descriptor v, + VertexProcessorMap vertex_to_processor, + bidirectionalS); + + // Clear the list of in-edges, but don't tell the remote processor + void clear_in_edges_local(vertex_descriptor v, directedS) {} + void clear_in_edges_local(vertex_descriptor v, undirectedS) {} + + void clear_in_edges_local(vertex_descriptor v, bidirectionalS) + { get(vertex_in_edges, base())[v.local].clear(); } + + // Remove in-edges that have migrated + template + void + remove_migrated_in_edges(vertex_descriptor, + VertexProcessorMap, + directedS) { } + + // Remove in-edges that have migrated + template + void + remove_migrated_in_edges(vertex_descriptor, + VertexProcessorMap, + undirectedS) { } + + // Remove in-edges that have migrated + template + void + remove_migrated_in_edges(vertex_descriptor v, + VertexProcessorMap vertex_to_processor, + bidirectionalS); + + // Initialize the graph with the given edge list and vertex + // distribution. This variation works only when + // VertexListS=vecS, and we know how to create remote vertex + // descriptors based solely on the distribution. + template + void + initialize(EdgeIterator first, EdgeIterator last, + vertices_size_type, const base_distribution_type& distribution, + vecS); + + // Initialize the graph with the given edge list, edge + // properties, and vertex distribution. This variation works + // only when VertexListS=vecS, and we know how to create remote + // vertex descriptors based solely on the distribution. + template + void + initialize(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type, const base_distribution_type& distribution, + vecS); + + // Initialize the graph with the given edge list, edge + // properties, and vertex distribution. + template + void + initialize(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type n, + const base_distribution_type& distribution, + VertexListS); + + // Initialize the graph with the given edge list and vertex + // distribution. This is nearly identical to the one below it, + // for which I should be flogged. However, this version does use + // slightly less memory than the version that accepts an edge + // property iterator. + template + void + initialize(EdgeIterator first, EdgeIterator last, + vertices_size_type n, + const base_distribution_type& distribution, + VertexListS); + + public: + //--------------------------------------------------------------------- + // Build a vertex property instance for the underlying adjacency + // list from the given property instance of the type exposed to + // the user. + base_vertex_property_type + build_vertex_property(const vertex_property_type& p) + { return build_vertex_property(p, directed_selector()); } + + base_vertex_property_type + build_vertex_property(const vertex_property_type& p, directedS) + { + return base_vertex_property_type(p); + } + + base_vertex_property_type + build_vertex_property(const vertex_property_type& p, bidirectionalS) + { + return base_vertex_property_type(in_edge_list_type(), p); + } + + base_vertex_property_type + build_vertex_property(const vertex_property_type& p, undirectedS) + { + return base_vertex_property_type(p); + } + //--------------------------------------------------------------------- + + //--------------------------------------------------------------------- + // Build an edge property instance for the underlying adjacency + // list from the given property instance of the type exposed to + // the user. + base_edge_property_type build_edge_property(const edge_property_type& p) + { return build_edge_property(p, directed_selector()); } + + base_edge_property_type + build_edge_property(const edge_property_type& p, directedS) + { + return base_edge_property_type(0, p); + } + + base_edge_property_type + build_edge_property(const edge_property_type& p, bidirectionalS) + { + return base_edge_property_type(0, p); + } + + base_edge_property_type + build_edge_property(const edge_property_type& p, undirectedS) + { + typedef typename base_edge_property_type::next_type + edge_property_with_id; + return base_edge_property_type(true, edge_property_with_id(0, p)); + } + //--------------------------------------------------------------------- + + /** The set of messages that can be transmitted and received by + * a distributed adjacency list. This list will eventually be + * exhaustive, but is currently quite limited. + */ + enum { + /** + * Request to add or find a vertex with the given vertex + * property. The data will be a vertex_property_type + * structure. + */ + msg_add_vertex_with_property = 0, + + /** + * Request to add or find a vertex with the given vertex + * property, and request that the remote processor return the + * descriptor for the added/found edge. The data will be a + * vertex_property_type structure. + */ + msg_add_vertex_with_property_and_reply, + + /** + * Reply to a msg_add_vertex_* message, containing the local + * vertex descriptor that was added or found. + */ + msg_add_vertex_reply, + + /** + * Request to add an edge remotely. The data will be a + * msg_add_edge_data structure. + */ + msg_add_edge, + + /** + * Request to add an edge remotely. The data will be a + * msg_add_edge_with_property_data structure. + */ + msg_add_edge_with_property, + + /** + * Request to add an edge remotely and reply back with the + * edge descriptor. The data will be a + * msg_add_edge_data structure. + */ + msg_add_edge_with_reply, + + /** + * Request to add an edge remotely and reply back with the + * edge descriptor. The data will be a + * msg_add_edge_with_property_data structure. + */ + msg_add_edge_with_property_and_reply, + + /** + * Reply message responding to an @c msg_add_edge_with_reply + * or @c msg_add_edge_with_property_and_reply messages. The + * data will be a std::pair. + */ + msg_add_edge_reply, + + /** + * Indicates that a nonlocal edge has been created that should + * be added locally. Only valid for bidirectional and + * undirected graphs. The message carries a + * msg_nonlocal_edge_data structure. + */ + msg_nonlocal_edge, + + /** + * Indicates that a remote edge should be removed. This + * message does not exist for directedS graphs but may refer + * to either in-edges or out-edges for undirectedS graphs. + */ + msg_remove_edge, + + /** + * Indicates the number of vertices and edges that will be + * relocated from the source processor to the target + * processor. The data will be a pair. + */ + msg_num_relocated + }; + + typedef detail::parallel::msg_add_edge_data + msg_add_edge_data; + + typedef detail::parallel::msg_add_edge_with_property_data + msg_add_edge_with_property_data; + + typedef boost::detail::parallel::msg_nonlocal_edge_data< + edge_property_type,local_edge_descriptor> msg_nonlocal_edge_data; + + typedef boost::detail::parallel::msg_remove_edge_data + msg_remove_edge_data; + + void send_remove_edge_request(edge_descriptor e) + { + process_id_type dest = e.target_processor; + if (e.target_processor == process_id(process_group_)) + dest = e.source_processor; + send(process_group_, dest, msg_remove_edge, msg_remove_edge_data(e)); + } + + /// Process incoming messages. + void setup_triggers(); + + void + handle_add_vertex_with_property(int source, int tag, + const vertex_property_type&, + trigger_receive_context); + + local_vertex_descriptor + handle_add_vertex_with_property_and_reply(int source, int tag, + const vertex_property_type&, + trigger_receive_context); + + void + handle_add_edge(int source, int tag, const msg_add_edge_data& data, + trigger_receive_context); + + boost::parallel::detail::untracked_pair + handle_add_edge_with_reply(int source, int tag, + const msg_add_edge_data& data, + trigger_receive_context); + + void + handle_add_edge_with_property(int source, int tag, + const msg_add_edge_with_property_data&, + trigger_receive_context); + + boost::parallel::detail::untracked_pair + handle_add_edge_with_property_and_reply + (int source, int tag, const msg_add_edge_with_property_data&, + trigger_receive_context); + + void + handle_nonlocal_edge(int source, int tag, + const msg_nonlocal_edge_data& data, + trigger_receive_context); + + void + handle_remove_edge(int source, int tag, + const msg_remove_edge_data& data, + trigger_receive_context); + + protected: + /** Add an edge (locally) that was received from another + * processor. This operation is a no-op for directed graphs, + * because all edges reside on the local processor. For + * bidirectional graphs, this routine places the edge onto the + * list of incoming edges for the target vertex. For undirected + * graphs, the edge is placed along with all of the other edges + * for the target vertex, but it is marked as a non-local edge + * descriptor. + * + * \todo There is a potential problem here, where we could + * unintentionally allow duplicate edges in undirected graphs + * because the same edge is added on two different processors + * simultaneously. It's not an issue now, because we require + * that the graph allow parallel edges. Once we do support + * containers such as setS or hash_setS that disallow parallel + * edges we will need to deal with this. + */ + void + add_remote_edge(const msg_nonlocal_edge_data&, + processor_id_type, directedS) + { } + + + /** + * \overload + */ + void + add_remote_edge(const msg_nonlocal_edge_data& data, + processor_id_type other_proc, bidirectionalS) + { + typedef detail::parallel::stored_in_edge stored_edge; + + stored_edge edge(other_proc, data.e); + local_vertex_descriptor v = target(data.e, base()); + boost::graph_detail::push(get(vertex_in_edges, base())[v], edge); + } + + /** + * \overload + */ + void + add_remote_edge(const msg_nonlocal_edge_data& data, + processor_id_type other_proc, undirectedS) + { + std::pair edge = + detail::parallel::add_local_edge(target(data.e, base()), + source(data.e, base()), + build_edge_property(data.get_property()), base()); + assert(edge.second); + put(edge_target_processor_id, base(), edge.first, other_proc); + + if (edge.second && on_add_edge) + on_add_edge(edge_descriptor(processor(), other_proc, false, + edge.first), + *this); + } + + void + remove_local_edge(const msg_remove_edge_data&, processor_id_type, + directedS) + { } + + void + remove_local_edge(const msg_remove_edge_data& data, + processor_id_type other_proc, bidirectionalS) + { + /* When the source is local, we first check if the edge still + * exists (it may have been deleted locally) and, if so, + * remove it locally. + */ + vertex_descriptor src = source(data.e, *this); + vertex_descriptor tgt = target(data.e, *this); + + if (src.owner == process_id(process_group_)) { + base_out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(src.local, base()); + ei != ei_end; ++ei) { + // TBD: can't check the descriptor here, because it could + // have changed if we're allowing the removal of + // edges. Egads! + if (tgt.local == target(*ei, base()) + && get(edge_target_processor_id, base(), *ei) == other_proc) + break; + } + + if (ei != ei_end) boost::remove_edge(ei, base()); + + remove_local_edge_from_list(src, tgt, undirectedS()); + } else { + assert(tgt.owner == process_id(process_group_)); + in_edge_list_type& in_edges = + get(vertex_in_edges, base())[tgt.local]; + typename in_edge_list_type::iterator ei; + for (ei = in_edges.begin(); ei != in_edges.end(); ++ei) { + if (src.local == source(ei->e, base()) + && src.owner == ei->source_processor) + break; + } + + if (ei != in_edges.end()) in_edges.erase(ei); + } + } + + void + remove_local_edge(const msg_remove_edge_data& data, + processor_id_type other_proc, undirectedS) + { + vertex_descriptor local_vertex = source(data.e, *this); + vertex_descriptor remote_vertex = target(data.e, *this); + if (remote_vertex.owner == process_id(process_group_)) { + using std::swap; + swap(local_vertex, remote_vertex); + } + + // Remove the edge from the out-edge list, if it is there + { + base_out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(local_vertex.local, base()); + ei != ei_end; ++ei) { + // TBD: can't check the descriptor here, because it could + // have changed if we're allowing the removal of + // edges. Egads! + if (remote_vertex.local == target(*ei, base()) + && get(edge_target_processor_id, base(), *ei) == other_proc) + break; + } + + if (ei != ei_end) boost::remove_edge(ei, base()); + } + + remove_local_edge_from_list(local_vertex, remote_vertex, undirectedS()); + } + + public: + void + remove_local_edge_from_list(vertex_descriptor, vertex_descriptor, + directedS) + { + } + + void + remove_local_edge_from_list(vertex_descriptor, vertex_descriptor, + bidirectionalS) + { + } + + void + remove_local_edge_from_list(vertex_descriptor src, vertex_descriptor tgt, + undirectedS) + { + // TBD: At some point we'll be able to improve the speed here + // because we'll know when the edge can't be in the local + // list. + { + typename local_edge_list_type::iterator ei; + for (ei = local_edges_.begin(); ei != local_edges_.end(); ++ei) { + if ((source(*ei, *this) == src + && target(*ei, *this) == tgt) + || (source(*ei, *this) == tgt + && target(*ei, *this) == src)) + break; + } + + if (ei != local_edges_.end()) local_edges_.erase(ei); + } + + } + + private: + /// The local subgraph + inherited m_local_graph; + + /// The process group through which this distributed graph + /// communicates. + process_group_type process_group_; + + // TBD: should only be available for undirected graphs, but for + // now it'll just be empty for directed and bidirectional + // graphs. + local_edge_list_type local_edges_; + }; + + //------------------------------------------------------------------------ + // Lazy addition of vertices + template + struct PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_vertex_with_property + { + /// Construct a lazy request to add a vertex + lazy_add_vertex_with_property(adjacency_list& self, + const vertex_property_type& property) + : self(self), property(property), committed(false) { } + + /// Copying a lazy_add_vertex_with_property transfers the + /// responsibility for adding the vertex to the newly-constructed + /// object. + lazy_add_vertex_with_property(const lazy_add_vertex_with_property& other) + : self(other.self), property(other.property), + committed(other.committed) + { + other.committed = true; + } + + /// If the vertex has not yet been added, add the vertex but don't + /// wait for a reply. + ~lazy_add_vertex_with_property(); + + /// Returns commit(). + operator vertex_descriptor() const { return commit(); } + + // Add the vertex. This operation will block if the vertex is + // being added remotely. + vertex_descriptor commit() const; + + protected: + adjacency_list& self; + vertex_property_type property; + mutable bool committed; + + private: + // No copy-assignment semantics + void operator=(lazy_add_vertex_with_property&); + }; + + template + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_vertex_with_property:: + ~lazy_add_vertex_with_property() + { + /// If this vertex has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the vertex now. + if (committed || std::uncaught_exception()) + return; + + committed = true; + + process_id_type owner + = static_cast(self).owner_by_property(property); + if (owner == self.processor()) { + /// Add the vertex locally. + vertex_descriptor v(owner, + add_vertex(self.build_vertex_property(property), + self.base())); + if (self.on_add_vertex) + self.on_add_vertex(v, self); + } + else + /// Ask the owner of this new vertex to add the vertex. We + /// don't need a reply. + send(self.process_group_, owner, msg_add_vertex_with_property, + property); + } + + template + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_vertex_with_property:: + commit() const + { + assert(!this->committed); + this->committed = true; + + process_id_type owner + = static_cast(self).owner_by_property(property); + local_vertex_descriptor local_v; + if (owner == self.processor()) + /// Add the vertex locally. + local_v = add_vertex(self.build_vertex_property(property), + self.base()); + else { + // Request that the remote process add the vertex immediately + send_oob_with_reply(self.process_group_, owner, + msg_add_vertex_with_property_and_reply, property, + local_v); + } + + vertex_descriptor v(owner, local_v); + if (self.on_add_vertex) + self.on_add_vertex(v, self); + + // Build the full vertex descriptor to return + return v; + } + + + /** + * Data structure returned from add_edge that will "lazily" add + * the edge, either when it is converted to a + * @c pair or when the most recent copy has + * been destroyed. + */ + template + struct PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge + { + /// Construct a lazy request to add an edge + lazy_add_edge(adjacency_list& self, + vertex_descriptor source, vertex_descriptor target) + : self(self), source(source), target(target), committed(false) { } + + /// Copying a lazy_add_edge transfers the responsibility for + /// adding the edge to the newly-constructed object. + lazy_add_edge(const lazy_add_edge& other) + : self(other.self), source(other.source), target(other.target), + committed(other.committed) + { + other.committed = true; + } + + /// If the edge has not yet been added, add the edge but don't + /// wait for a reply. + ~lazy_add_edge(); + + /// Returns commit(). + operator std::pair() const { return commit(); } + + // Add the edge. This operation will block if a remote edge is + // being added. + std::pair commit() const; + + protected: + std::pair + add_local_edge(const edge_property_type& property, directedS) const; + + std::pair + add_local_edge(const edge_property_type& property, bidirectionalS) const; + + std::pair + add_local_edge(const edge_property_type& property, undirectedS) const; + + adjacency_list& self; + vertex_descriptor source; + vertex_descriptor target; + mutable bool committed; + + private: + // No copy-assignment semantics + void operator=(lazy_add_edge&); + }; + + template + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge::~lazy_add_edge() + { + /// If this edge has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the edge now. + if (committed || std::uncaught_exception()) + return; + + committed = true; + + if (source.owner == self.processor()) + this->add_local_edge(edge_property_type(), DirectedS()); + else + // Request that the remote processor add an edge and, but + // don't wait for a reply. + send(self.process_group_, source.owner, msg_add_edge, + msg_add_edge_data(source, target)); + } + + template + std::pair + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge::commit() const + { + assert(!committed); + committed = true; + + if (source.owner == self.processor()) + return this->add_local_edge(edge_property_type(), DirectedS()); + else { + // Request that the remote processor add an edge + boost::parallel::detail::untracked_pair result; + send_oob_with_reply(self.process_group_, source.owner, + msg_add_edge_with_reply, + msg_add_edge_data(source, target), result); + return result; + } + } + + // Add a local edge into a directed graph + template + std::pair + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge:: + add_local_edge(const edge_property_type& property, directedS) const + { + // Add the edge to the local part of the graph + std::pair inserted = + detail::parallel::add_local_edge(source.local, target.local, + self.build_edge_property(property), + self.base()); + + if (inserted.second) + // Keep track of the owner of the target + put(edge_target_processor_id, self.base(), inserted.first, + target.owner); + + // Compose the edge descriptor and return the result + edge_descriptor e(source.owner, target.owner, true, inserted.first); + + // Trigger the on_add_edge event + if (inserted.second && self.on_add_edge) + self.on_add_edge(e, self); + + return std::pair(e, inserted.second); + } + + template + std::pair + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge:: + add_local_edge(const edge_property_type& property, bidirectionalS) const + { + // Add the directed edge. + std::pair result + = this->add_local_edge(property, directedS()); + + if (result.second) { + if (target.owner == self.processor()) { + // Edge is local, so add the stored edge to the in_edges list + typedef detail::parallel::stored_in_edge + stored_edge; + + stored_edge e(self.processor(), result.first.local); + boost::graph_detail::push(get(vertex_in_edges, + self.base())[target.local], e); + } + else { + // Edge is remote, so notify the target's owner that an edge + // has been added. + if (self.process_group_.trigger_context() == graph::parallel::trc_out_of_band) + send_oob(self.process_group_, target.owner, msg_nonlocal_edge, + msg_nonlocal_edge_data(result.first.local, property)); + else + send(self.process_group_, target.owner, msg_nonlocal_edge, + msg_nonlocal_edge_data(result.first.local, property)); + } + } + + return result; + } + + template + std::pair + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge:: + add_local_edge(const edge_property_type& property, undirectedS) const + { + // Add the directed edge + std::pair result + = this->add_local_edge(property, directedS()); + + typedef detail::parallel::stored_in_edge + stored_edge; + + if (result.second) { + if (target.owner == self.processor()) { + // Edge is local, so add the new edge to the list + + // TODO: This is not what we want to do for an undirected + // edge, because we haven't linked the source and target's + // representations of those edges. + local_edge_descriptor return_edge = + detail::parallel::add_local_edge(target.local, source.local, + self.build_edge_property(property), + self.base()).first; + + put(edge_target_processor_id, self.base(), return_edge, + source.owner); + } + else { + // Edge is remote, so notify the target's owner that an edge + // has been added. + if (self.process_group_.trigger_context() == graph::parallel::trc_out_of_band) + send_oob(self.process_group_, target.owner, msg_nonlocal_edge, + msg_nonlocal_edge_data(result.first.local, property)); + else + send(self.process_group_, target.owner, msg_nonlocal_edge, + msg_nonlocal_edge_data(result.first.local, property)); + + } + + // Add this edge to the list of local edges + graph_detail::push(self.local_edges(), result.first); + } + + return result; + } + + + /** + * Data structure returned from add_edge that will "lazily" add + * the edge with its property, either when it is converted to a + * pair or when the most recent copy has + * been destroyed. + */ + template + struct PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge_with_property + : lazy_add_edge + { + /// Construct a lazy request to add an edge + lazy_add_edge_with_property(adjacency_list& self, + vertex_descriptor source, + vertex_descriptor target, + const edge_property_type& property) + : lazy_add_edge(self, source, target), property(property) { } + + /// Copying a lazy_add_edge transfers the responsibility for + /// adding the edge to the newly-constructed object. + lazy_add_edge_with_property(const lazy_add_edge& other) + : lazy_add_edge(other), property(other.property) { } + + /// If the edge has not yet been added, add the edge but don't + /// wait for a reply. + ~lazy_add_edge_with_property(); + + /// Returns commit(). + operator std::pair() const { return commit(); } + + // Add the edge. This operation will block if a remote edge is + // being added. + std::pair commit() const; + + private: + // No copy-assignment semantics + void operator=(lazy_add_edge_with_property&); + + edge_property_type property; + }; + + template + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge_with_property:: + ~lazy_add_edge_with_property() + { + /// If this edge has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the edge now. + if (this->committed || std::uncaught_exception()) + return; + + this->committed = true; + + if (this->source.owner == this->self.processor()) + // Add a local edge + this->add_local_edge(property, DirectedS()); + else + // Request that the remote processor add an edge and, but + // don't wait for a reply. + send(this->self.process_group_, this->source.owner, + msg_add_edge_with_property, + msg_add_edge_with_property_data(this->source, this->target, + property)); + } + + template + std::pair + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge_with_property:: + commit() const + { + assert(!this->committed); + this->committed = true; + + if (this->source.owner == this->self.processor()) + // Add a local edge + return this->add_local_edge(property, DirectedS()); + else { + // Request that the remote processor add an edge + boost::parallel::detail::untracked_pair result; + send_oob_with_reply(this->self.process_group_, this->source.owner, + msg_add_edge_with_property_and_reply, + msg_add_edge_with_property_data(this->source, + this->target, + property), + result); + return result; + } + } + + + /** + * Returns the set of vertices local to this processor. Note that + * although this routine matches a valid expression of a + * VertexListGraph, it does not meet the semantic requirements of + * VertexListGraph because it returns only local vertices (not all + * vertices). + */ + template + std::pair + vertices(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertex_descriptor Vertex; + + typedef typename Vertex::generator generator; + + return std::make_pair(make_transform_iterator(vertices(g.base()).first, + generator(g.processor())), + make_transform_iterator(vertices(g.base()).second, + generator(g.processor()))); + } + + /** + * Returns the number of vertices local to this processor. Note that + * although this routine matches a valid expression of a + * VertexListGraph, it does not meet the semantic requirements of + * VertexListGraph because it returns only a count of local vertices + * (not all vertices). + */ + template + typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertices_size_type + num_vertices(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + return num_vertices(g.base()); + } + + /*************************************************************************** + * Implementation of Incidence Graph concept + ***************************************************************************/ + /** + * Returns the source of edge @param e in @param g. + */ + template + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + source(const detail::parallel::edge_descriptor& e, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertex_descriptor Vertex; + return Vertex(e.source_processor, source(e.local, g.base())); + } + + /** + * Returns the target of edge @param e in @param g. + */ + template + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + target(const detail::parallel::edge_descriptor& e, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertex_descriptor Vertex; + return Vertex(e.target_processor, target(e.local, g.base())); + } + + /** + * Return the set of edges outgoing from a particular vertex. The + * vertex @param v must be local to the processor executing this + * routine. + */ + template + std::pair + out_edges(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + assert(v.owner == g.processor()); + + typedef PBGL_DISTRIB_ADJLIST_TYPE impl; + typedef typename impl::out_edge_generator generator; + + return std::make_pair( + make_transform_iterator(out_edges(v.local, g.base()).first, + generator(g)), + make_transform_iterator(out_edges(v.local, g.base()).second, + generator(g))); + } + + /** + * Return the number of edges outgoing from a particular vertex. The + * vertex @param v must be local to the processor executing this + * routine. + */ + template + typename PBGL_DISTRIB_ADJLIST_TYPE::degree_size_type + out_degree(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + assert(v.owner == g.processor()); + + return out_degree(v.local, g.base()); + } + + /*************************************************************************** + * Implementation of Bidirectional Graph concept + ***************************************************************************/ + /** + * Returns the set of edges incoming to a particular vertex. The + * vertex @param v must be local to the processor executing this + * routine. + */ + template + std::pair + in_edges(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + assert(v.owner == g.processor()); + + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) impl; + typedef typename impl::inherited base_graph_type; + typedef typename impl::in_edge_generator generator; + + + typename property_map::const_type + in_edges = get(vertex_in_edges, g.base()); + + return std::make_pair(make_transform_iterator(in_edges[v.local].begin(), + generator(g)), + make_transform_iterator(in_edges[v.local].end(), + generator(g))); + } + + /** + * \overload + */ + template + std::pair + in_edges(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + assert(v.owner == g.processor()); + + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) impl; + typedef typename impl::in_edge_generator generator; + + return std::make_pair( + make_transform_iterator(out_edges(v.local, g.base()).first, + generator(g)), + make_transform_iterator(out_edges(v.local, g.base()).second, + generator(g))); + } + + /** + * Returns the number of edges incoming to a particular vertex. The + * vertex @param v must be local to the processor executing this + * routine. + */ + template + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)::degree_size_type + in_degree(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + assert(v.owner == g.processor()); + + return get(vertex_in_edges, g.base())[v.local].size(); + } + + /** + * \overload + */ + template + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)::degree_size_type + in_degree(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + assert(v.owner == g.processor()); + + return out_degree(v.local, g.base()); + } + + /** + * Returns the number of edges incident on the given vertex. The + * vertex @param v must be local to the processor executing this + * routine. + */ + template + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::degree_size_type + degree(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + assert(v.owner == g.processor()); + return out_degree(v.local, g.base()); + } + + /** + * \overload + */ + template + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::degree_size_type + degree(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + assert(v.owner == g.processor()); + return out_degree(v, g) + in_degree(v, g); + } + + template + typename PBGL_DISTRIB_ADJLIST_TYPE::edges_size_type + num_edges(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + return num_edges(g.base()); + } + + template + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)::edges_size_type + num_edges(const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + return g.local_edges().size(); + } + + template + std::pair< + typename PBGL_DISTRIB_ADJLIST_TYPE::edge_iterator, + typename PBGL_DISTRIB_ADJLIST_TYPE::edge_iterator> + edges(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE impl; + typedef typename impl::out_edge_generator generator; + + return std::make_pair(make_transform_iterator(edges(g.base()).first, + generator(g)), + make_transform_iterator(edges(g.base()).second, + generator(g))); + } + + template + std::pair< + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)::edge_iterator, + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)::edge_iterator> + edges(const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + return std::make_pair(g.local_edges().begin(), g.local_edges().end()); + } + + template + inline + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + vertex(typename PBGL_DISTRIB_ADJLIST_TYPE::vertices_size_type n, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + vertex_descriptor; + + return vertex_descriptor(g.distribution()(n), g.distribution().local(n)); + } + + /*************************************************************************** + * Access to particular edges + ***************************************************************************/ + template + std::pair< + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)::edge_descriptor, + bool + > + edge(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)::vertex_descriptor u, + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS) + ::edge_descriptor edge_descriptor; + + // For directed graphs, u must be local + assert(u.owner == process_id(g.process_group())); + + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS) + ::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { + if (target(*ei, g) == v) return std::make_pair(*ei, true); + } + return std::make_pair(edge_descriptor(), false); + } + + template + std::pair< + typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, + bool + > + edge(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::edge_descriptor edge_descriptor; + + // For bidirectional and undirected graphs, u must be local or v + // must be local + if (u.owner == process_id(g.process_group())) { + typename PBGL_DISTRIB_ADJLIST_TYPE::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { + if (target(*ei, g) == v) return std::make_pair(*ei, true); + } + return std::make_pair(edge_descriptor(), false); + } else if (v.owner == process_id(g.process_group())) { + typename PBGL_DISTRIB_ADJLIST_TYPE::in_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = in_edges(v, g); ei != ei_end; ++ei) { + if (source(*ei, g) == u) return std::make_pair(*ei, true); + } + return std::make_pair(edge_descriptor(), false); + } else { + assert(false); + exit(1); + } + } + +#if 0 + // TBD: not yet supported + std::pair + edge_range(vertex_descriptor u, vertex_descriptor v, + const adjacency_list& g); +#endif + + /*************************************************************************** + * Implementation of Adjacency Graph concept + ***************************************************************************/ + template + std::pair + adjacent_vertices(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE::adjacency_iterator iter; + return std::make_pair(iter(out_edges(v, g).first, &g), + iter(out_edges(v, g).second, &g)); + } + + /*************************************************************************** + * Implementation of Mutable Graph concept + ***************************************************************************/ + + /************************************************************************ + * add_edge + ************************************************************************/ + template + typename PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge + add_edge(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge lazy_add_edge; + + return lazy_add_edge(g, u, v); + } + + template + typename PBGL_DISTRIB_ADJLIST_TYPE + ::lazy_add_edge_with_property + add_edge(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + typename PBGL_DISTRIB_ADJLIST_TYPE::edge_property_type const& p, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::lazy_add_edge_with_property lazy_add_edge_with_property; + return lazy_add_edge_with_property(g, u, v, p); + } + + /************************************************************************ + * + * remove_edge + * + ************************************************************************/ + template + void + remove_edge(typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor e, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + assert(source(e, g).owner == g.processor() + || target(e, g).owner == g.processor()); + + if (target(e, g).owner == g.processor()) + detail::parallel::remove_in_edge(e, g, DirectedS()); + if (source(e, g).owner == g.processor()) + remove_edge(e.local, g.base()); + + g.remove_local_edge_from_list(source(e, g), target(e, g), DirectedS()); + + if (source(e, g).owner != g.processor() + || (target(e, g).owner != g.processor() + && !(is_same::value))) { + g.send_remove_edge_request(e); + } + } + + template + void + remove_edge(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertex_descriptor vertex_descriptor; + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::edge_descriptor edge_descriptor; + std::pair the_edge = edge(u, v, g); + if (the_edge.second) remove_edge(the_edge.first, g); + } + + template + inline void + remove_edge(typename PBGL_DISTRIB_ADJLIST_TYPE::out_edge_iterator ei, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + remove_edge(*ei, g); + } + + template + inline void + remove_edge(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS) + ::out_edge_iterator ei, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)& g) + { + assert(source(*ei, g).owner == g.processor()); + remove_edge(ei->local, g.base()); + } + + /************************************************************************ + * + * remove_out_edge_if + * + ************************************************************************/ + namespace parallel { namespace detail { + /** + * Function object that applies the underlying predicate to + * determine if an out-edge should be removed. If so, either + * removes the incoming edge (if it is stored locally) or sends a + * message to the owner of the target requesting that it remove + * the edge. + */ + template + struct remove_out_edge_predicate + { + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef typename Graph::local_edge_descriptor argument_type; + typedef typename Graph::directed_selector directed_selector; + typedef bool result_type; + + remove_out_edge_predicate(Graph& g, Predicate& predicate) + : g(g), predicate(predicate) { } + + bool operator()(const argument_type& le) + { + typedef typename edge_descriptor::template out_generator + generator; + + edge_descriptor e = generator(g)(le); + + if (predicate(e)) { + if (source(e, g).owner != target(e, g).owner + && !(is_same::value)) + g.send_remove_edge_request(e); + else + ::boost::detail::parallel::remove_in_edge(e, g, + directed_selector()); + + g.remove_local_edge_from_list(source(e, g), target(e, g), + directed_selector()); + return true; + } else return false; + } + + private: + Graph& g; + Predicate predicate; + }; + } } // end namespace parallel::detail + + template + inline void + remove_out_edge_if + (typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE Graph; + typedef parallel::detail::remove_out_edge_predicate + Pred; + + assert(u.owner == g.processor()); + remove_out_edge_if(u.local, Pred(g, predicate), g.base()); + } + + /************************************************************************ + * + * remove_in_edge_if + * + ************************************************************************/ + namespace parallel { namespace detail { + /** + * Function object that applies the underlying predicate to + * determine if an in-edge should be removed. If so, either + * removes the outgoing edge (if it is stored locally) or sends a + * message to the owner of the target requesting that it remove + * the edge. Only required for bidirectional graphs. + */ + template + struct remove_in_edge_predicate + { + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef bool result_type; + + remove_in_edge_predicate(Graph& g, const Predicate& predicate) + : g(g), predicate(predicate) { } + + template + bool operator()(const StoredEdge& le) + { + typedef typename edge_descriptor::template in_generator + generator; + + edge_descriptor e = generator(g)(le); + + if (predicate(e)) { + if (source(e, g).owner != target(e, g).owner) + g.send_remove_edge_request(e); + else + remove_edge(source(e, g).local, target(e, g).local, g.base()); + return true; + } else return false; + } + + private: + Graph& g; + Predicate predicate; + }; + } } // end namespace parallel::detail + + template + inline void + remove_in_edge_if + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor u, + Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) Graph; + typedef parallel::detail::remove_in_edge_predicate + Pred; + + assert(u.owner == g.processor()); + graph_detail::erase_if(get(vertex_in_edges, g.base())[u.local], + Pred(g, predicate)); + } + + template + inline void + remove_in_edge_if + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::vertex_descriptor u, + Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + remove_out_edge_if(u, predicate, g); + } + + /************************************************************************ + * + * remove_edge_if + * + ************************************************************************/ + namespace parallel { namespace detail { + /** + * Function object that applies the underlying predicate to + * determine if a directed edge can be removed. This only applies + * to directed graphs. + */ + template + struct remove_directed_edge_predicate + { + typedef typename Graph::local_edge_descriptor argument_type; + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef bool result_type; + + remove_directed_edge_predicate(Graph& g, const Predicate& predicate) + : g(g), predicate(predicate) { } + + bool operator()(const argument_type& le) + { + typedef typename edge_descriptor::template out_generator + generator; + + edge_descriptor e = generator(g)(le); + return predicate(e); + } + + private: + Graph& g; + Predicate predicate; + }; + } } // end namespace parallel::detail + + template + inline void + remove_edge_if(Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS) Graph; + typedef parallel::detail::remove_directed_edge_predicate Pred; + remove_edge_if(Pred(g, predicate), g.base()); + } + + template + inline void + remove_edge_if(Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) Graph; + typedef parallel::detail::remove_out_edge_predicate Pred; + remove_edge_if(Pred(g, predicate), g.base()); + } + + namespace parallel { namespace detail { + /** + * Function object that applies the underlying predicate to + * determine if an undirected edge should be removed. If so, + * removes the local edges associated with the edge and + * (potentially) sends a message to the remote processor that also + * is removing this edge. + */ + template + struct remove_undirected_edge_predicate + { + typedef typename graph_traits::edge_descriptor argument_type; + typedef bool result_type; + + remove_undirected_edge_predicate(Graph& g, Predicate& predicate) + : g(g), predicate(predicate) { } + + bool operator()(const argument_type& e) + { + if (predicate(e)) { + if (source(e, g).owner != target(e, g).owner) + g.send_remove_edge_request(e); + if (target(e, g).owner == g.processor()) + ::boost::detail::parallel::remove_in_edge(e, g, undirectedS()); + if (source(e, g).owner == g.processor()) + remove_edge(e.local, g.base()); + return true; + } else return false; + } + + private: + Graph& g; + Predicate predicate; + }; + } } // end namespace parallel::detail + + template + inline void + remove_edge_if(Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) Graph; + typedef parallel::detail::remove_undirected_edge_predicate Pred; + graph_detail::erase_if(g.local_edges(), Pred(g, predicate)); + } + + /************************************************************************ + * + * clear_vertex + * + ************************************************************************/ + namespace parallel { namespace detail { + struct always_true + { + typedef bool result_type; + + template bool operator()(const T&) const { return true; } + }; + } } // end namespace parallel::detail + + template + void + clear_vertex + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + clear_out_edges(u, g); + clear_in_edges(u, g); + } + + template + void + clear_vertex + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + remove_out_edge_if(u, parallel::detail::always_true(), g); + } + + /************************************************************************ + * + * clear_out_edges + * + ************************************************************************/ + template + void + clear_out_edges + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)& g) + { + assert(u.owner == g.processor()); + clear_out_edges(u.local, g.base()); + } + + template + void + clear_out_edges + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + remove_out_edge_if(u, parallel::detail::always_true(), g); + } + + /************************************************************************ + * + * clear_in_edges + * + ************************************************************************/ + template + void + clear_in_edges + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + remove_in_edge_if(u, parallel::detail::always_true(), g); + } + + /************************************************************************ + * + * add_vertex + * + ************************************************************************/ + template + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + add_vertex(PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE graph_type; + typename graph_type::vertex_property_type p; + return add_vertex(p, g); + } + + template + typename PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_vertex_with_property + add_vertex(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_property_type const& p, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::lazy_add_vertex_with_property lazy_add_vertex; + return lazy_add_vertex(g, p); + } + + /************************************************************************ + * + * remove_vertex + * + ************************************************************************/ + template + void + remove_vertex(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE::graph_type graph_type; + typedef typename graph_type::named_graph_mixin named_graph_mixin; + assert(u.owner == g.processor()); + static_cast(static_cast(g)) + .removing_vertex(u); + g.distribution().clear(); + remove_vertex(u.local, g.base()); + } + + /*************************************************************************** + * Implementation of Property Graph concept + ***************************************************************************/ + template + struct property_map + : detail::parallel::get_adj_list_pmap + ::template apply + { }; + + template + struct property_map + : boost::detail::parallel::get_adj_list_pmap +// FIXME: in the original code the following was not const + ::template apply + { }; + + template + typename property_map::type + get(Property p, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE Graph; + typedef typename property_map::type result_type; + typedef typename property_traits::value_type value_type; + typedef typename property_reduce::template apply + reduce; + + typedef typename property_traits::key_type descriptor; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + get(p, g.base()), reduce()); + } + + template + typename property_map::const_type + get(Property p, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE Graph; + typedef typename property_map::const_type result_type; + typedef typename property_traits::value_type value_type; + typedef typename property_reduce::template apply + reduce; + + typedef typename property_traits::key_type descriptor; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + get(p, g.base()), reduce()); + } + + template + typename property_map::type + get(vertex_local_index_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + return get(vertex_local_index, g.base()); + } + + template + typename property_map::const_type + get(vertex_local_index_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + return get(vertex_local_index, g.base()); + } + + template + typename property_map::const_type + get(vertex_global_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_global_t>::const_type result_type; + return result_type(); + } + + template + typename property_map::const_type + get(vertex_global_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_global_t>::const_type result_type; + return result_type(); + } + + /// Retrieve a property map mapping from a vertex descriptor to its + /// owner. + template + typename property_map::type + get(vertex_owner_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_owner_t>::type result_type; + return result_type(); + } + + /// Retrieve a property map mapping from a vertex descriptor to its + /// owner. + template + typename property_map::const_type + get(vertex_owner_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_owner_t>::const_type result_type; + return result_type(); + } + + /// Retrieve the owner of a vertex + template + inline processor_id_type + get(vertex_owner_t, PBGL_DISTRIB_ADJLIST_TYPE&, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v) + { + return v.owner; + } + + /// Retrieve the owner of a vertex + template + inline processor_id_type + get(vertex_owner_t, const PBGL_DISTRIB_ADJLIST_TYPE&, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v) + { + return v.owner; + } + + /// Retrieve a property map that maps from a vertex descriptor to + /// its local descriptor. + template + typename property_map::type + get(vertex_local_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_local_t>::type result_type; + return result_type(); + } + + /// Retrieve a property map that maps from a vertex descriptor to + /// its local descriptor. + template + typename property_map::const_type + get(vertex_local_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_local_t>::const_type result_type; + return result_type(); + } + + /// Retrieve the local descriptor of a vertex + template + inline typename PBGL_DISTRIB_ADJLIST_TYPE::local_vertex_descriptor + get(vertex_local_t, PBGL_DISTRIB_ADJLIST_TYPE&, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v) + { + return v.local; + } + + /// Retrieve the local descriptor of a vertex + template + inline typename PBGL_DISTRIB_ADJLIST_TYPE::local_vertex_descriptor + get(vertex_local_t, const PBGL_DISTRIB_ADJLIST_TYPE&, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v) + { + return v.local; + } + + + template + typename property_map::const_type + get(edge_global_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_global_t>::const_type result_type; + return result_type(); + } + + template + typename property_map::const_type + get(edge_global_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_global_t>::const_type result_type; + return result_type(); + } + + template + typename property_map::type + get(edge_owner_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_owner_t>::type result_type; + return result_type(); + } + + template + typename property_map::const_type + get(edge_owner_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_owner_t>::const_type result_type; + return result_type(); + } + + template + typename property_map::type + get(edge_local_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_local_t>::type result_type; + return result_type(); + } + + template + typename property_map::const_type + get(edge_local_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_local_t>::const_type result_type; + return result_type(); + } + + template + inline + typename property_traits::const_type + >::value_type + get(Property p, const PBGL_DISTRIB_ADJLIST_TYPE& g, const Key& key) + { + if (owner(key) == process_id(g.process_group())) + return get(p, g.base(), local(key)); + else + assert(false); + } + + template + void + put(Property p, PBGL_DISTRIB_ADJLIST_TYPE& g, const Key& key, const Value& v) + { + if (owner(key) == process_id(g.process_group())) + put(p, g.base(), local(key), v); + else + assert(false); + } + + template + typename property_map::type + get(vertex_index_t vi, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE graph_type; + typedef typename property_map::type + result_type; + return result_type(g.process_group(), get(vertex_global, g), + get(vi, g.base())); + } + + template + typename property_map::const_type + get(vertex_index_t vi, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE graph_type; + typedef typename property_map::const_type + result_type; + return result_type(g.process_group(), get(vertex_global, g), + get(vi, g.base())); + } + + /*************************************************************************** + * Implementation of bundled properties + ***************************************************************************/ + template + struct property_map + : detail::parallel::get_adj_list_pmap + ::template apply + { }; + + template + struct property_map + : detail::parallel::get_adj_list_pmap + ::template apply + { }; + + template + typename property_map::type + get(T Bundle::* p, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE Graph; + typedef typename property_map::type result_type; + typedef typename property_traits::value_type value_type; + typedef typename property_reduce::template apply + reduce; + + typedef typename property_traits::key_type descriptor; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + get(p, g.base()), reduce()); + } + + template + typename property_map::const_type + get(T Bundle::* p, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE Graph; + typedef typename property_map::const_type result_type; + typedef typename property_traits::value_type value_type; + typedef typename property_reduce::template apply + reduce; + + typedef typename property_traits::key_type descriptor; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + get(p, g.base()), reduce()); + } + + /*************************************************************************** + * Implementation of DistributedGraph concept + ***************************************************************************/ + template + void synchronize(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE graph_type; + synchronize(g.process_group()); + } + + template + ProcessGroup + process_group(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { return g.process_group(); } + + /*************************************************************************** + * Specializations of is_mpi_datatype for Serializable entities + ***************************************************************************/ + namespace mpi { + template + struct is_mpi_datatype > + : is_mpi_datatype { }; + + template + struct is_mpi_datatype > + : is_mpi_datatype > { }; + + template + struct is_mpi_datatype > + : is_mpi_datatype { }; + + template + struct is_mpi_datatype > + : is_mpi_datatype { }; + + template + struct is_mpi_datatype > + : is_mpi_datatype { }; + + template + struct is_mpi_datatype > + : mpl::and_, is_mpi_datatype > { }; + + + template + struct is_mpi_datatype > + : mpl::and_< + is_mpi_datatype >, + is_mpi_datatype > + {}; + + template + struct is_mpi_datatype< + boost::detail::parallel::msg_remove_edge_data > + : is_mpi_datatype {}; + } + + /*************************************************************************** + * Specializations of is_bitwise_serializable for Serializable entities + ***************************************************************************/ + namespace serialization { + template + struct is_bitwise_serializable > + : is_bitwise_serializable { }; + + template + struct is_bitwise_serializable > + : is_bitwise_serializable > { }; + + template + struct is_bitwise_serializable > + : is_bitwise_serializable { }; + + template + struct is_bitwise_serializable > + : is_bitwise_serializable { }; + + template + struct is_bitwise_serializable > + : is_bitwise_serializable { }; + + template + struct is_bitwise_serializable > + : mpl::and_, + is_bitwise_serializable > { }; + + template + struct is_bitwise_serializable > + : mpl::and_< + is_bitwise_serializable< + boost::detail::parallel::maybe_store_property >, + is_bitwise_serializable > + {}; + + template + struct is_bitwise_serializable< + boost::detail::parallel::msg_remove_edge_data > + : is_bitwise_serializable {}; + + template + struct implementation_level > + : mpl::int_ {}; + + template + struct implementation_level > + : mpl::int_ {}; + + template + struct implementation_level > + : mpl::int_ {}; + + template + struct implementation_level > + : mpl::int_ {}; + + template + struct implementation_level > + : mpl::int_ {}; + + template + struct implementation_level > + : mpl::int_ {}; + + template + struct implementation_level > + : mpl::int_ {}; + + template + struct implementation_level< + boost::detail::parallel::msg_remove_edge_data > + : mpl::int_ {}; + + template + struct tracking_level > + : mpl::int_ {}; + + template + struct tracking_level > + : mpl::int_ {}; + + template + struct tracking_level > + : mpl::int_ {}; + + template + struct tracking_level > + : mpl::int_ {}; + + template + struct tracking_level > + : mpl::int_ {}; + + template + struct tracking_level > + : mpl::int_ {}; + + template + struct tracking_level > + : mpl::int_ {}; + + template + struct tracking_level< + boost::detail::parallel::msg_remove_edge_data > + : mpl::int_ {}; + } + + // Hash function for global descriptors + template + struct hash > + { + typedef detail::parallel::global_descriptor argument_type; + std::size_t operator()(argument_type const& x) const + { + std::size_t hash = hash_value(x.owner); + hash_combine(hash, x.local); + return hash; + } + }; + + // Hash function for parallel edge descriptors + template + struct hash > + { + typedef detail::parallel::edge_descriptor argument_type; + + std::size_t operator()(argument_type const& x) const + { + std::size_t hash = hash_value(x.owner()); + hash_combine(hash, x.local); + return hash; + } + }; + +} // end namespace boost + +#include +#include +#include +#include + +#endif // BOOST_GRAPH_DISTRIBUTED_ADJACENCY_LIST_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/handlers.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/handlers.hpp new file mode 100644 index 0000000000..7c1e431e43 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/handlers.hpp @@ -0,0 +1,148 @@ +// Copyright (C) 2007 Douglas Gregor + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// This file contains code for the distributed adjacency list's +// message handlers. It should not be included directly by users. + +#ifndef BOOST_GRAPH_DISTRIBUTED_ADJLIST_HANDLERS_HPP +#define BOOST_GRAPH_DISTRIBUTED_ADJLIST_HANDLERS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include + +namespace boost { + +template +void +PBGL_DISTRIB_ADJLIST_TYPE:: +setup_triggers() +{ + using boost::graph::parallel::simple_trigger; + + simple_trigger(process_group_, msg_add_vertex_with_property, this, + &adjacency_list::handle_add_vertex_with_property); + simple_trigger(process_group_, msg_add_vertex_with_property_and_reply, this, + &adjacency_list::handle_add_vertex_with_property_and_reply); + simple_trigger(process_group_, msg_add_edge, this, + &adjacency_list::handle_add_edge); + simple_trigger(process_group_, msg_add_edge_with_reply, this, + &adjacency_list::handle_add_edge_with_reply); + simple_trigger(process_group_, msg_add_edge_with_property, this, + &adjacency_list::handle_add_edge_with_property); + simple_trigger(process_group_, msg_add_edge_with_property_and_reply, this, + &adjacency_list::handle_add_edge_with_property_and_reply); + simple_trigger(process_group_, msg_nonlocal_edge, this, + &adjacency_list::handle_nonlocal_edge); + simple_trigger(process_group_, msg_remove_edge, this, + &adjacency_list::handle_remove_edge); +} + +template +void +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_vertex_with_property(int source, int tag, + const vertex_property_type& data, + trigger_receive_context) +{ + vertex_descriptor v(this->processor(), + add_vertex(this->build_vertex_property(data), + this->base())); + if (on_add_vertex) + on_add_vertex(v, *this); +} + +template +typename PBGL_DISTRIB_ADJLIST_TYPE::local_vertex_descriptor +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_vertex_with_property_and_reply(int source, int tag, + const vertex_property_type& data, + trigger_receive_context) +{ + // Try to find a vertex with this name + local_vertex_descriptor local_v + = add_vertex(this->build_vertex_property(data), this->base()); + + vertex_descriptor v(processor(), local_v); + if (on_add_vertex) + on_add_vertex(v, *this); + + return local_v; +} + +template +void +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_edge(int source, int tag, const msg_add_edge_data& data, + trigger_receive_context) +{ + add_edge(vertex_descriptor(processor(), data.source), + data.target, *this); +} + +template +boost::parallel::detail::untracked_pair +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_edge_with_reply(int source, int tag, const msg_add_edge_data& data, + trigger_receive_context) +{ + std::pair p = + add_edge(vertex_descriptor(processor(), data.source),data.target, *this); + return p; +} + +template +void +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_edge_with_property(int source, int tag, + const msg_add_edge_with_property_data& data, + trigger_receive_context) +{ + add_edge(vertex_descriptor(processor(), data.source), + data.target, data.get_property(), *this); +} + +template +boost::parallel::detail::untracked_pair +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_edge_with_property_and_reply + (int source, int tag, + const msg_add_edge_with_property_data& data, + trigger_receive_context) +{ + std::pair p = + add_edge(vertex_descriptor(processor(), data.source), + data.target, data.get_property(), *this); + return p; +} + +template +void +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_nonlocal_edge(int source, int tag, + const msg_nonlocal_edge_data& data, + trigger_receive_context) +{ + add_remote_edge(data, source, directed_selector()); +} + +template +void +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_remove_edge(int source, int tag, + const msg_remove_edge_data& data, + trigger_receive_context) +{ + remove_local_edge(data, source, directed_selector()); +} + +} + +#endif // BOOST_GRAPH_DISTRIBUTED_ADJLIST_HANDLERS_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/initialize.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/initialize.hpp new file mode 100644 index 0000000000..4bb85d4ef5 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/initialize.hpp @@ -0,0 +1,319 @@ +// Copyright (C) 2007 Douglas Gregor + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// This file contains code for the distributed adjacency list's +// initializations. It should not be included directly by users. + +#ifndef BOOST_GRAPH_DISTRIBUTED_ADJLIST_INITIALIZE_HPP +#define BOOST_GRAPH_DISTRIBUTED_ADJLIST_INITIALIZE_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +namespace boost { + +template +template +void +PBGL_DISTRIB_ADJLIST_TYPE:: +initialize(EdgeIterator first, EdgeIterator last, + vertices_size_type, const base_distribution_type& distribution, + vecS) +{ + process_id_type id = process_id(process_group_); + while (first != last) { + if ((process_id_type)distribution(first->first) == id) { + vertex_descriptor source(id, distribution.local(first->first)); + vertex_descriptor target(distribution(first->second), + distribution.local(first->second)); + add_edge(source, target, *this); + } + ++first; + } + + synchronize(process_group_); +} + +template +template +void +PBGL_DISTRIB_ADJLIST_TYPE:: +initialize(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type, const base_distribution_type& distribution, + vecS) +{ + process_id_type id = process_id(process_group_); + while (first != last) { + if (static_cast(distribution(first->first)) == id) { + vertex_descriptor source(id, distribution.local(first->first)); + vertex_descriptor target(distribution(first->second), + distribution.local(first->second)); + add_edge(source, target, *ep_iter, *this); + } + ++first; + ++ep_iter; + } + + synchronize(process_group_); +} + +template +template +void +PBGL_DISTRIB_ADJLIST_TYPE:: +initialize(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type n, const base_distribution_type& distribution, + VertexListS) +{ + using boost::parallel::inplace_all_to_all; + + typedef vertices_size_type vertex_number_t; + typedef typename std::iterator_traits::value_type + edge_property_init_t; + + typedef std::pair + st_pair; + typedef std::pair delayed_edge_t; + + process_group_type pg = process_group(); + process_id_type id = process_id(pg); + + // Vertex indices + std::vector index_to_vertex; + index_to_vertex.reserve(num_vertices(*this)); + BGL_FORALL_VERTICES_T(v, base(), inherited) + index_to_vertex.push_back(v); + + // The list of edges we can't add immediately. + std::vector delayed_edges; + + std::vector > descriptor_requests; + descriptor_requests.resize(num_processes(pg)); + + // Add all of the edges we can, up to the point where we run + // into a descriptor we don't know. + while (first != last) { + if (distribution(first->first) == id) { + if (distribution(first->second) != id) break; + vertex_descriptor source + (id, index_to_vertex[distribution.local(first->first)]); + vertex_descriptor target + (distribution(first->second), + index_to_vertex[distribution.local(first->second)]); + add_edge(source, target, *ep_iter, *this); + } + ++first; + ++ep_iter; + } + + // Queue all of the remaining edges and determine the set of + // descriptors we need to know about. + while (first != last) { + if (distribution(first->first) == id) { + vertex_descriptor source + (id, index_to_vertex[distribution.local(first->first)]); + process_id_type dest = distribution(first->second); + if (dest != id) { + descriptor_requests[dest] + .push_back(distribution.local(first->second)); + // Compact request list if we need to + if (descriptor_requests[dest].size() > + distribution.block_size(dest, n)) { + std::sort(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()); + descriptor_requests[dest].erase( + std::unique(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()), + descriptor_requests[dest].end()); + } + } + + // Save the edge for later + delayed_edges.push_back + (delayed_edge_t(st_pair(source, first->second), *ep_iter)); + } + ++first; + ++ep_iter; + } + + // Compact descriptor requests + for (process_id_type dest = 0; dest < num_processes(pg); ++dest) { + std::sort(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()); + descriptor_requests[dest].erase( + std::unique(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()), + descriptor_requests[dest].end()); + } + + // Send out all of the descriptor requests + std::vector > in_descriptor_requests; + in_descriptor_requests.resize(num_processes(pg)); + inplace_all_to_all(pg, descriptor_requests, in_descriptor_requests); + + // Reply to all of the descriptor requests + std::vector > + descriptor_responses; + descriptor_responses.resize(num_processes(pg)); + for (process_id_type dest = 0; dest < num_processes(pg); ++dest) { + for (std::size_t i = 0; i < in_descriptor_requests[dest].size(); ++i) { + local_vertex_descriptor v = + index_to_vertex[in_descriptor_requests[dest][i]]; + descriptor_responses[dest].push_back(v); + } + in_descriptor_requests[dest].clear(); + } + in_descriptor_requests.clear(); + inplace_all_to_all(pg, descriptor_responses); + + // Add the queued edges + for(typename std::vector::iterator i + = delayed_edges.begin(); i != delayed_edges.end(); ++i) { + process_id_type dest = distribution(i->first.second); + local_vertex_descriptor tgt_local; + if (dest == id) { + tgt_local = index_to_vertex[distribution.local(i->first.second)]; + } else { + std::vector& requests = descriptor_requests[dest]; + typename std::vector::iterator pos = + std::lower_bound(requests.begin(), requests.end(), + distribution.local(i->first.second)); + tgt_local = descriptor_responses[dest][pos - requests.begin()]; + } + add_edge(i->first.first, vertex_descriptor(dest, tgt_local), + i->second, *this); + } + synchronize(process_group_); +} + +template +template +void +PBGL_DISTRIB_ADJLIST_TYPE:: +initialize(EdgeIterator first, EdgeIterator last, + vertices_size_type n, const base_distribution_type& distribution, + VertexListS) +{ + using boost::parallel::inplace_all_to_all; + + typedef vertices_size_type vertex_number_t; + + typedef std::pair delayed_edge_t; + + process_group_type pg = process_group(); + process_id_type id = process_id(pg); + + // Vertex indices + std::vector index_to_vertex; + index_to_vertex.reserve(num_vertices(*this)); + BGL_FORALL_VERTICES_T(v, base(), inherited) + index_to_vertex.push_back(v); + + // The list of edges we can't add immediately. + std::vector delayed_edges; + + std::vector > descriptor_requests; + descriptor_requests.resize(num_processes(pg)); + + // Add all of the edges we can, up to the point where we run + // into a descriptor we don't know. + while (first != last) { + if (distribution(first->first) == id) { + if (distribution(first->second) != id) break; + vertex_descriptor source + (id, index_to_vertex[distribution.local(first->first)]); + vertex_descriptor target + (distribution(first->second), + index_to_vertex[distribution.local(first->second)]); + add_edge(source, target, *this); + } + ++first; + } + + // Queue all of the remaining edges and determine the set of + // descriptors we need to know about. + while (first != last) { + if (distribution(first->first) == id) { + vertex_descriptor source + (id, index_to_vertex[distribution.local(first->first)]); + process_id_type dest = distribution(first->second); + if (dest != id) { + descriptor_requests[dest] + .push_back(distribution.local(first->second)); + // Compact request list if we need to + if (descriptor_requests[dest].size() > + distribution.block_size(dest, n)) { + std::sort(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()); + descriptor_requests[dest].erase( + std::unique(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()), + descriptor_requests[dest].end()); + } + } + + // Save the edge for later + delayed_edges.push_back(delayed_edge_t(source, first->second)); + } + ++first; + } + + // Compact descriptor requests + for (process_id_type dest = 0; dest < num_processes(pg); ++dest) { + std::sort(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()); + descriptor_requests[dest].erase( + std::unique(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()), + descriptor_requests[dest].end()); + } + + // Send out all of the descriptor requests + std::vector > in_descriptor_requests; + in_descriptor_requests.resize(num_processes(pg)); + inplace_all_to_all(pg, descriptor_requests, in_descriptor_requests); + + // Reply to all of the descriptor requests + std::vector > + descriptor_responses; + descriptor_responses.resize(num_processes(pg)); + for (process_id_type dest = 0; dest < num_processes(pg); ++dest) { + for (std::size_t i = 0; i < in_descriptor_requests[dest].size(); ++i) { + local_vertex_descriptor v = + index_to_vertex[in_descriptor_requests[dest][i]]; + descriptor_responses[dest].push_back(v); + } + in_descriptor_requests[dest].clear(); + } + in_descriptor_requests.clear(); + inplace_all_to_all(pg, descriptor_responses); + + // Add the queued edges + for(typename std::vector::iterator i + = delayed_edges.begin(); i != delayed_edges.end(); ++i) { + process_id_type dest = distribution(i->second); + local_vertex_descriptor tgt_local; + if (dest == id) { + tgt_local = index_to_vertex[distribution.local(i->second)]; + } else { + std::vector& requests = descriptor_requests[dest]; + typename std::vector::iterator pos = + std::lower_bound(requests.begin(), requests.end(), + distribution.local(i->second)); + tgt_local = descriptor_responses[dest][pos - requests.begin()]; + } + add_edge(i->first, vertex_descriptor(dest, tgt_local), *this); + } + synchronize(process_group_); +} + +} // end namespace boost + +#endif // BOOST_GRAPH_DISTRIBUTED_ADJLIST_INITIALIZE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/redistribute.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/redistribute.hpp new file mode 100644 index 0000000000..62e79bf467 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/redistribute.hpp @@ -0,0 +1,393 @@ +// Copyright (C) 2005-2006 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 + +// +// Implements redistribution of vertices for a distributed adjacency +// list. This file should not be included by users. It will be +// included by the distributed adjacency list header. +// + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include + +namespace boost { namespace detail { namespace parallel { + +/* This structure contains a (vertex or edge) descriptor that is being + moved from one processor to another. It contains the properties for + that descriptor (if any). + */ +template +struct redistributed_descriptor : maybe_store_property +{ + typedef maybe_store_property inherited; + + redistributed_descriptor() { } + + redistributed_descriptor(const Descriptor& v, const DescriptorProperty& p) + : inherited(p), descriptor(v) { } + + Descriptor descriptor; + +private: + friend class boost::serialization::access; + + template + void serialize(Archiver& ar, unsigned int /*version*/) + { + ar & boost::serialization::base_object(*this) + & unsafe_serialize(descriptor); + } +}; + +/* Predicate that returns true if the target has migrated. */ +template +struct target_migrated_t +{ + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + + target_migrated_t(VertexProcessorMap vertex_to_processor, const Graph& g) + : vertex_to_processor(vertex_to_processor), g(g) { } + + bool operator()(Edge e) const + { + typedef global_descriptor DVertex; + processor_id_type owner = get(edge_target_processor_id, g, e); + return get(vertex_to_processor, DVertex(owner, target(e, g))) != owner; + } + +private: + VertexProcessorMap vertex_to_processor; + const Graph& g; +}; + +template +inline target_migrated_t +target_migrated(VertexProcessorMap vertex_to_processor, const Graph& g) +{ return target_migrated_t(vertex_to_processor, g); } + +/* Predicate that returns true if the source of an in-edge has migrated. */ +template +struct source_migrated_t +{ + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + + source_migrated_t(VertexProcessorMap vertex_to_processor, const Graph& g) + : vertex_to_processor(vertex_to_processor), g(g) { } + + bool operator()(stored_in_edge e) const + { + return get(vertex_to_processor, DVertex(e.source_processor, source(e.e, g))) + != e.source_processor; + } + +private: + VertexProcessorMap vertex_to_processor; + const Graph& g; +}; + +template +inline source_migrated_t +source_migrated(VertexProcessorMap vertex_to_processor, const Graph& g) +{ return source_migrated_t(vertex_to_processor, g); } + +/* Predicate that returns true if the target has migrated. */ +template +struct source_or_target_migrated_t +{ + typedef typename graph_traits::edge_descriptor Edge; + + source_or_target_migrated_t(VertexProcessorMap vertex_to_processor, + const Graph& g) + : vertex_to_processor(vertex_to_processor), g(g) { } + + bool operator()(Edge e) const + { + return get(vertex_to_processor, source(e, g)) != source(e, g).owner + || get(vertex_to_processor, target(e, g)) != target(e, g).owner; + } + +private: + VertexProcessorMap vertex_to_processor; + const Graph& g; +}; + +template +inline source_or_target_migrated_t +source_or_target_migrated(VertexProcessorMap vertex_to_processor, +const Graph& g) +{ + typedef source_or_target_migrated_t result_type; + return result_type(vertex_to_processor, g); +} + +} } // end of namespace detail::parallel + +template +template +void +PBGL_DISTRIB_ADJLIST_TYPE +::request_in_neighbors(vertex_descriptor v, + VertexProcessorMap vertex_to_processor, + bidirectionalS) +{ + BGL_FORALL_INEDGES_T(v, e, *this, graph_type) + request(vertex_to_processor, source(e, *this)); +} + +template +template +void +PBGL_DISTRIB_ADJLIST_TYPE +::remove_migrated_in_edges(vertex_descriptor v, + VertexProcessorMap vertex_to_processor, + bidirectionalS) +{ + graph_detail::erase_if(get(vertex_in_edges, base())[v.local], + source_migrated(vertex_to_processor, base())); +} + +template +template +void +PBGL_DISTRIB_ADJLIST_TYPE +::redistribute(VertexProcessorMap vertex_to_processor) +{ + using boost::parallel::inplace_all_to_all; + + // When we have stable descriptors, we only move those descriptors + // that actually need to be moved. Otherwise, we essentially have to + // regenerate the entire graph. + const bool has_stable_descriptors = + is_same::value + || is_same::value + || is_same::value; + + typedef detail::parallel::redistributed_descriptor + redistributed_vertex; + typedef detail::parallel::redistributed_descriptor + redistributed_edge; + typedef std::pair num_relocated_pair; + + vertex_iterator vi, vi_end; + edge_iterator ei, ei_end; + + process_group_type pg = process_group(); + + // Initial synchronization makes sure that we have all of our ducks + // in a row. We don't want any outstanding add/remove messages + // coming in mid-redistribution! + synchronize(process_group_); + + // We cannot cope with eviction of ghost cells + vertex_to_processor.set_max_ghost_cells(0); + + process_id_type p = num_processes(pg); + + // Send vertices and edges to the processor where they will + // actually reside. This requires O(|V| + |E|) communication + std::vector > redistributed_vertices(p); + std::vector > redistributed_edges(p); + + // Build the sets of relocated vertices for each process and then do + // an all-to-all transfer. + for (tie(vi, vi_end) = vertices(*this); vi != vi_end; ++vi) { + if (!has_stable_descriptors + || get(vertex_to_processor, *vi) != vi->owner) { + redistributed_vertices[get(vertex_to_processor, *vi)] + .push_back(redistributed_vertex(*vi, get(vertex_all_t(), base(), + vi->local))); + } + + // When our descriptors are stable, we need to determine which + // adjacent descriptors are stable to determine which edges will + // be removed. + if (has_stable_descriptors) { + BGL_FORALL_OUTEDGES_T(*vi, e, *this, graph_type) + request(vertex_to_processor, target(e, *this)); + request_in_neighbors(*vi, vertex_to_processor, directed_selector()); + } + } + + inplace_all_to_all(pg, redistributed_vertices); + + // If we have stable descriptors, we need to know where our neighbor + // vertices are moving. + if (has_stable_descriptors) + synchronize(vertex_to_processor); + + // Build the sets of relocated edges for each process and then do + // an all-to-all transfer. + for (tie(ei, ei_end) = edges(*this); ei != ei_end; ++ei) { + vertex_descriptor src = source(*ei, *this); + vertex_descriptor tgt = target(*ei, *this); + if (!has_stable_descriptors + || get(vertex_to_processor, src) != src.owner + || get(vertex_to_processor, tgt) != tgt.owner) + redistributed_edges[get(vertex_to_processor, source(*ei, *this))] + .push_back(redistributed_edge(*ei, get(edge_all_t(), base(), + ei->local))); + } + inplace_all_to_all(pg, redistributed_edges); + + // A mapping from old vertex descriptors to new vertex + // descriptors. This is an STL map partly because I'm too lazy to + // build a real property map (which is hard in the general case) but + // also because it won't try to look in the graph itself, because + // the keys are all vertex descriptors that have been invalidated. + std::map old_to_new_vertex_map; + + if (has_stable_descriptors) { + // Clear out all vertices and edges that will have moved. There + // are several stages to this. + + // First, eliminate all outgoing edges from the (local) vertices + // that have been moved or whose targets have been moved. + BGL_FORALL_VERTICES_T(v, *this, graph_type) { + if (get(vertex_to_processor, v) != v.owner) { + clear_out_edges(v.local, base()); + clear_in_edges_local(v, directed_selector()); + } else { + remove_out_edge_if(v.local, + target_migrated(vertex_to_processor, base()), + base()); + remove_migrated_in_edges(v, vertex_to_processor, directed_selector()); + } + } + + // Next, eliminate locally-stored edges that have migrated (for + // undirected graphs). + graph_detail::erase_if(local_edges_, + source_or_target_migrated(vertex_to_processor, *this)); + + // Eliminate vertices that have migrated + for (tie(vi, vi_end) = vertices(*this); vi != vi_end; /* in loop */) { + if (get(vertex_to_processor, *vi) != vi->owner) + remove_vertex((*vi++).local, base()); + else { + // Add the identity relation for vertices that have not migrated + old_to_new_vertex_map[*vi] = *vi; + ++vi; + } + } + } else { + // Clear out the local graph: the entire graph is in transit + clear(); + } + + // Add the new vertices to the graph. When we do so, update the old + // -> new vertex mapping both locally and for the owner of the "old" + // vertex. + { + typedef std::pair mapping_pair; + std::vector > mappings(p); + + for (process_id_type src = 0; src < p; ++src) { + for (typename std::vector::iterator vi = + redistributed_vertices[src].begin(); + vi != redistributed_vertices[src].end(); ++vi) { + vertex_descriptor new_vertex = + add_vertex(vi->get_property(), *this); + old_to_new_vertex_map[vi->descriptor] = new_vertex; + mappings[vi->descriptor.owner].push_back(mapping_pair(vi->descriptor, + new_vertex)); + } + + redistributed_vertices[src].clear(); + } + + inplace_all_to_all(pg, mappings); + + // Add the mappings we were sent into the old->new map. + for (process_id_type src = 0; src < p; ++src) + old_to_new_vertex_map.insert(mappings[src].begin(), mappings[src].end()); + } + + // Get old->new vertex mappings for all of the vertices we need to + // know about. + + // TBD: An optimization here might involve sending the + // request-response pairs without an explicit request step (for + // bidirectional and undirected graphs). However, it may not matter + // all that much given the cost of redistribution. + { + std::vector > vertex_map_requests(p); + std::vector > vertex_map_responses(p); + + // We need to know about all of the vertices incident on edges + // that have been relocated to this processor. Tell each processor + // what each other processor needs to know. + for (process_id_type src = 0; src < p; ++src) + for (typename std::vector::iterator ei = + redistributed_edges[src].begin(); + ei != redistributed_edges[src].end(); ++ei) { + vertex_descriptor need_vertex = target(ei->descriptor, *this); + if (old_to_new_vertex_map.find(need_vertex) + == old_to_new_vertex_map.end()) + { + old_to_new_vertex_map[need_vertex] = need_vertex; + vertex_map_requests[need_vertex.owner].push_back(need_vertex); + } + } + inplace_all_to_all(pg, + vertex_map_requests, + vertex_map_responses); + + // Process the requests made for vertices we own. Then perform yet + // another all-to-all swap. This one matches the requests we've + // made to the responses we were given. + for (process_id_type src = 0; src < p; ++src) + for (typename std::vector::iterator vi = + vertex_map_responses[src].begin(); + vi != vertex_map_responses[src].end(); ++vi) + *vi = old_to_new_vertex_map[*vi]; + inplace_all_to_all(pg, vertex_map_responses); + + // Matching the requests to the responses, update the old->new + // vertex map for all of the vertices we will need to know. + for (process_id_type src = 0; src < p; ++src) { + typedef typename std::vector::size_type size_type; + for (size_type i = 0; i < vertex_map_requests[src].size(); ++i) { + old_to_new_vertex_map[vertex_map_requests[src][i]] = + vertex_map_responses[src][i]; + } + } + } + + // Add edges to the graph by mapping the source and target. + for (process_id_type src = 0; src < p; ++src) { + for (typename std::vector::iterator ei = + redistributed_edges[src].begin(); + ei != redistributed_edges[src].end(); ++ei) { + add_edge(old_to_new_vertex_map[source(ei->descriptor, *this)], + old_to_new_vertex_map[target(ei->descriptor, *this)], + ei->get_property(), + *this); + } + + redistributed_edges[src].clear(); + } + + // Be sure that edge-addition messages are received now, completing + // the graph. + synchronize(process_group_); + + this->distribution().clear(); + + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); +} + +} // end namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/serialization.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/serialization.hpp new file mode 100644 index 0000000000..b1685b5172 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/adjlist/serialization.hpp @@ -0,0 +1,1007 @@ +// Copyright Daniel Wallin 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) + +#ifndef BOOST_GRAPH_DISTRIBUTED_ADJLIST_SERIALIZATION_070925_HPP +#define BOOST_GRAPH_DISTRIBUTED_ADJLIST_SERIALIZATION_070925_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +# include +# include +# include +# include +# include +# include + +namespace boost { + +namespace detail { namespace parallel +{ + + // Wraps a local descriptor, making it serializable. + template + struct serializable_local_descriptor + { + serializable_local_descriptor() + {} + + serializable_local_descriptor(Local local) + : local(local) + {} + + operator Local const&() const + { + return local; + } + + bool operator==(serializable_local_descriptor const& other) const + { + return local == other.local; + } + + bool operator<(serializable_local_descriptor const& other) const + { + return local < other.local; + } + + template + void serialize(Archive& ar, const unsigned int /*version*/) + { + ar & unsafe_serialize(local); + } + + Local local; + }; + + template + struct pending_edge + { + pending_edge( + Vertex source, Vertex target + , Properties properties, void* property_ptr + ) + : source(source) + , target(target) + , properties(properties) + , property_ptr(property_ptr) + {} + + Vertex source; + Vertex target; + Properties properties; + void* property_ptr; + }; + + inline bool is_digit(char c) + { + return std::isdigit(c); + } + + inline std::vector + available_process_files(std::string const& filename) + { + if (!filesystem::exists(filename)) + return std::vector(); + + std::vector result; + + for (filesystem::directory_iterator i(filename), end; i != end; ++i) + { + if (!filesystem::is_regular(*i)) + boost::throw_exception(std::runtime_error("directory contains non-regular entries")); + +#if BOOST_VERSION >= 103600 + std::string process_name = i->path().filename(); +#else + std::string process_name = i->leaf(); +#endif + for (std::string::size_type i = 0; i < process_name.size(); ++i) + if (!is_digit(process_name[i])) + boost::throw_exception(std::runtime_error("directory contains files with invalid names")); + + result.push_back(boost::lexical_cast(process_name)); + } + + return result; + } + + template + void maybe_load_properties( + Archive& ar, char const* name, property& properties) + { + ar >> serialization::make_nvp(name, get_property_value(properties, Tag())); + maybe_load_properties(ar, name, static_cast(properties)); + } + + template + void maybe_load_properties( + Archive&, char const*, no_property&) + {} + + template + void maybe_load_properties( + Archive& ar, char const* name, Bundle& bundle) + { + ar >> serialization::make_nvp(name, bundle); + no_property prop; + maybe_load_properties(ar, name, prop); + } + + + + + + + template + struct graph_loader + { + typedef typename Graph::vertex_descriptor vertex_descriptor; + typedef typename Graph::local_vertex_descriptor local_vertex_descriptor; + typedef typename Graph::vertex_property_type vertex_property_type; + typedef typename Graph::edge_descriptor edge_descriptor; + typedef typename Graph::local_edge_descriptor local_edge_descriptor; + typedef typename Graph::edge_property_type edge_property_type; + typedef typename Graph::process_group_type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef typename Graph::directed_selector directed_selector; + typedef typename mpl::if_< + is_same, vecS, VertexListS + >::type vertex_list_selector; + typedef pending_edge + pending_edge_type; + typedef serializable_local_descriptor + serializable_vertex_descriptor; + + graph_loader(Graph& g, Archive& ar) + : m_g(g) + , m_ar(ar) + , m_pg(g.process_group()) + , m_requested_vertices(num_processes(m_pg)) + , m_remote_vertices(num_processes(m_pg)) + , m_property_ptrs(num_processes(m_pg)) + { + g.clear(); + load_prefix(); + load_vertices(); + load_edges(); + ar >> make_nvp("distribution", m_g.distribution()); + } + + private: + struct pending_in_edge + { + pending_in_edge( + vertex_descriptor u, vertex_descriptor v, void* property_ptr + ) + : u(u) + , v(v) + , property_ptr(property_ptr) + {} + + vertex_descriptor u; + vertex_descriptor v; + void* property_ptr; + }; + + bool is_root() const + { + return process_id(m_pg) == 0; + } + + template + serialization::nvp const make_nvp(char const* name, T& value) const + { + return serialization::nvp(name, value); + } + + void load_prefix(); + void load_vertices(); + + template + void maybe_load_and_store_local_vertex(Anything); + void maybe_load_and_store_local_vertex(vecS); + + void load_edges(); + void load_in_edges(bidirectionalS); + void load_in_edges(directedS); + void add_pending_in_edge( + vertex_descriptor u, vertex_descriptor v, void* property_ptr, vecS); + template + void add_pending_in_edge( + vertex_descriptor u, vertex_descriptor v, void* property_ptr, Anything); + template + void add_edge( + vertex_descriptor u, vertex_descriptor v + , edge_property_type const& property, void* property_ptr, Anything); + void add_edge( + vertex_descriptor u, vertex_descriptor v + , edge_property_type const& property, void* property_ptr, vecS); + void add_remote_vertex_request( + vertex_descriptor u, vertex_descriptor v, directedS); + void add_remote_vertex_request( + vertex_descriptor u, vertex_descriptor v, bidirectionalS); + void add_in_edge( + edge_descriptor const&, void*, directedS); + void add_in_edge( + edge_descriptor const& edge, void* old_property_ptr, bidirectionalS); + + void resolve_remote_vertices(directedS); + void resolve_remote_vertices(bidirectionalS); + vertex_descriptor resolve_remote_vertex(vertex_descriptor u) const; + vertex_descriptor resolve_remote_vertex(vertex_descriptor u, vecS) const; + template + vertex_descriptor resolve_remote_vertex(vertex_descriptor u, Anything) const; + + void resolve_property_ptrs(); + + void commit_pending_edges(vecS); + template + void commit_pending_edges(Anything); + void commit_pending_in_edges(directedS); + void commit_pending_in_edges(bidirectionalS); + + void* maybe_load_property_ptr(directedS) { return 0; } + void* maybe_load_property_ptr(bidirectionalS); + + Graph& m_g; + Archive& m_ar; + process_group_type m_pg; + + std::vector m_id_mapping; + + // Maps local vertices as loaded from the archive to + // the ones actually added to the graph. Only used + // when !vecS. + std::map m_local_vertices; + + // This is the list of remote vertex descriptors that we + // are going to receive from other processes. This is + // kept sorted so that we can determine the position of + // the matching vertex descriptor in m_remote_vertices. + std::vector > m_requested_vertices; + + // This is the list of remote vertex descriptors that + // we send and receive from other processes. + std::vector > m_remote_vertices; + + // ... + std::vector m_pending_edges; + + // The pending in-edges that will be added in the commit step, after + // the remote vertex descriptors has been resolved. Only used + // when bidirectionalS and !vecS. + std::vector m_pending_in_edges; + + std::vector > > m_property_ptrs; + }; + + template + void graph_loader::load_prefix() + { + typename process_group_type::process_size_type num_processes_; + m_ar >> make_nvp("num_processes", num_processes_); + + if (num_processes_ != num_processes(m_pg)) + boost::throw_exception(std::runtime_error("number of processes mismatch")); + + process_id_type old_id; + m_ar >> make_nvp("id", old_id); + + std::vector mapping; + m_ar >> make_nvp("mapping", mapping); + + // Fetch all the old id's from the other processes. + std::vector old_ids; + all_gather(m_pg, &old_id, &old_id+1, old_ids); + + m_id_mapping.resize(num_processes(m_pg), -1); + + for (process_id_type i = 0; i < num_processes(m_pg); ++i) + { +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << i << " used to be " << old_ids[i] << "\n"; +# endif + assert(m_id_mapping[old_ids[i]] == -1); + m_id_mapping[old_ids[i]] = i; + } + + std::vector new_mapping( + mapping.size()); + + for (int i = 0; i < num_processes(m_pg); ++i) + { + new_mapping[mapping[old_ids[i]]] = i; + } + + m_g.distribution().assign_mapping( + new_mapping.begin(), new_mapping.end()); + } + + template + void graph_loader::load_vertices() + { + int V; + m_ar >> BOOST_SERIALIZATION_NVP(V); + +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << "Loading vertices\n"; +# endif + + for (int i = 0; i < V; ++i) + { + maybe_load_and_store_local_vertex(vertex_list_selector()); + } + } + + template + template + void graph_loader::maybe_load_and_store_local_vertex(Anything) + { + // Load the original vertex descriptor + local_vertex_descriptor local; + m_ar >> make_nvp("local", unsafe_serialize(local)); + + // Load the properties + vertex_property_type property; + detail::parallel::maybe_load_properties(m_ar, "vertex_property", + property); + + // Add the vertex + vertex_descriptor v(process_id(m_pg), add_vertex(property, m_g.base())); + + if (m_g.on_add_vertex) + m_g.on_add_vertex(v, m_g); + + // Create the mapping from the "old" local descriptor to the new + // local descriptor. + m_local_vertices[local] = v.local; + } + + template + void graph_loader::maybe_load_and_store_local_vertex(vecS) + { + // Load the properties + vertex_property_type property; + detail::parallel::maybe_load_properties(m_ar, "vertex_property", + property); + + // Add the vertex + vertex_descriptor v(process_id(m_pg), + add_vertex(m_g.build_vertex_property(property), + m_g.base())); + + if (m_g.on_add_vertex) + m_g.on_add_vertex(v, m_g); + } + + template + void graph_loader::load_edges() + { + int E; + m_ar >> BOOST_SERIALIZATION_NVP(E); + +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << "Loading edges\n"; +# endif + + for (int i = 0; i < E; ++i) + { + local_vertex_descriptor local_src; + process_id_type target_owner; + local_vertex_descriptor local_tgt; + + m_ar >> make_nvp("source", unsafe_serialize(local_src)); + m_ar >> make_nvp("target_owner", target_owner); + m_ar >> make_nvp("target", unsafe_serialize(local_tgt)); + + process_id_type new_src_owner = process_id(m_pg); + process_id_type new_tgt_owner = m_id_mapping[target_owner]; + + vertex_descriptor source(new_src_owner, local_src); + vertex_descriptor target(new_tgt_owner, local_tgt); + + edge_property_type properties; + detail::parallel::maybe_load_properties(m_ar, "edge_property", properties); + + void* property_ptr = maybe_load_property_ptr(directed_selector()); + add_edge(source, target, properties, property_ptr, vertex_list_selector()); + } + + load_in_edges(directed_selector()); + commit_pending_edges(vertex_list_selector()); + } + + template + void graph_loader::load_in_edges(bidirectionalS) + { + std::size_t I; + m_ar >> BOOST_SERIALIZATION_NVP(I); + +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << "Loading in-edges\n"; +# endif + + for (int i = 0; i < I; ++i) + { + process_id_type src_owner; + local_vertex_descriptor local_src; + local_vertex_descriptor local_target; + void* property_ptr; + + m_ar >> make_nvp("src_owner", src_owner); + m_ar >> make_nvp("source", unsafe_serialize(local_src)); + m_ar >> make_nvp("target", unsafe_serialize(local_target)); + m_ar >> make_nvp("property_ptr", unsafe_serialize(property_ptr)); + + src_owner = m_id_mapping[src_owner]; + + vertex_descriptor u(src_owner, local_src); + vertex_descriptor v(process_id(m_pg), local_target); + + add_pending_in_edge(u, v, property_ptr, vertex_list_selector()); + } + } + + template + void graph_loader::load_in_edges(directedS) + {} + + template + void graph_loader::add_pending_in_edge( + vertex_descriptor u, vertex_descriptor v, void* property_ptr, vecS) + { + m_pending_in_edges.push_back(pending_in_edge(u,v,property_ptr)); + } + + template + template + void graph_loader::add_pending_in_edge( + vertex_descriptor u, vertex_descriptor v, void* property_ptr, Anything) + { + // u and v represent the out-edge here, meaning v is local + // to us, and u is always remote. + m_pending_in_edges.push_back(pending_in_edge(u,v,property_ptr)); + add_remote_vertex_request(v, u, bidirectionalS()); + } + + template + template + void graph_loader::add_edge( + vertex_descriptor u, vertex_descriptor v + , edge_property_type const& property, void* property_ptr, Anything) + { + m_pending_edges.push_back(pending_edge_type(u, v, property, property_ptr)); + add_remote_vertex_request(u, v, directed_selector()); + } + + template + void graph_loader::add_remote_vertex_request( + vertex_descriptor u, vertex_descriptor v, directedS) + { + // We have to request the remote vertex. + m_requested_vertices[owner(v)].push_back(local(v)); + } + + template + void graph_loader::add_remote_vertex_request( + vertex_descriptor u, vertex_descriptor v, bidirectionalS) + { + // If the edge spans to another process, we know + // that that process has a matching in-edge, so + // we can just send our vertex. No requests + // necessary. + if (owner(v) != m_g.processor()) + { + m_remote_vertices[owner(v)].push_back(local(u)); + m_requested_vertices[owner(v)].push_back(local(v)); + } + } + + template + void graph_loader::add_edge( + vertex_descriptor u, vertex_descriptor v + , edge_property_type const& property, void* property_ptr, vecS) + { + std::pair inserted = + detail::parallel::add_local_edge( + local(u), local(v) + , m_g.build_edge_property(property), m_g.base()); + assert(inserted.second); + put(edge_target_processor_id, m_g.base(), inserted.first, owner(v)); + + edge_descriptor e(owner(u), owner(v), true, inserted.first); + + if (inserted.second && m_g.on_add_edge) + m_g.on_add_edge(e, m_g); + + add_in_edge(e, property_ptr, directed_selector()); + } + + template + void graph_loader::add_in_edge( + edge_descriptor const&, void*, directedS) + {} + + template + void graph_loader::add_in_edge( + edge_descriptor const& edge, void* old_property_ptr, bidirectionalS) + { + if (owner(target(edge, m_g)) == m_g.processor()) + { + detail::parallel::stored_in_edge + e(m_g.processor(), local(edge)); + boost::graph_detail::push(get( + vertex_in_edges, m_g.base())[local(target(edge, m_g))], e); + } + else + { + // We send the (old,new) property pointer pair to + // the remote process. This could be optimized to + // only send the new one -- the ordering can be + // made implicit because the old pointer value is + // stored on the remote process. + // + // Doing that is a little bit more complicated, but + // in case it turns out it's important we can do it. + void* property_ptr = local(edge).get_property(); + m_property_ptrs[owner(target(edge, m_g))].push_back( + unsafe_pair(old_property_ptr, property_ptr)); + } + } + + template + void graph_loader::resolve_property_ptrs() + { +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << "Resolving property pointers\n"; +# endif + + for (int i = 0; i < num_processes(m_pg); ++i) + { + std::sort( + m_property_ptrs[i].begin(), m_property_ptrs[i].end()); + } + + boost::parallel::inplace_all_to_all(m_pg, m_property_ptrs); + } + + template + void graph_loader::resolve_remote_vertices(directedS) + { + for (int i = 0; i < num_processes(m_pg); ++i) + { + std::sort(m_requested_vertices[i].begin(), m_requested_vertices[i].end()); + } + + boost::parallel::inplace_all_to_all( + m_pg, m_requested_vertices, m_remote_vertices); + + for (int i = 0; i < num_processes(m_pg); ++i) + { + BOOST_FOREACH(serializable_vertex_descriptor& u, m_remote_vertices[i]) + { + u = m_local_vertices[u]; + } + } + + boost::parallel::inplace_all_to_all(m_pg, m_remote_vertices); + } + + template + void graph_loader::resolve_remote_vertices(bidirectionalS) + { +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << "Resolving remote vertices\n"; +# endif + + for (int i = 0; i < num_processes(m_pg); ++i) + { + std::sort(m_requested_vertices[i].begin(), m_requested_vertices[i].end()); + std::sort(m_remote_vertices[i].begin(), m_remote_vertices[i].end()); + + BOOST_FOREACH(serializable_vertex_descriptor& u, m_remote_vertices[i]) + { + u = m_local_vertices[u]; + } + } + + boost::parallel::inplace_all_to_all(m_pg, m_remote_vertices); + + for (int i = 0; i < num_processes(m_pg); ++i) + assert(m_remote_vertices[i].size() == m_requested_vertices[i].size()); + } + + template + void graph_loader::commit_pending_edges(vecS) + { + commit_pending_in_edges(directed_selector()); + } + + template + template + void graph_loader::commit_pending_edges(Anything) + { + resolve_remote_vertices(directed_selector()); + + BOOST_FOREACH(pending_edge_type const& e, m_pending_edges) + { + vertex_descriptor u = resolve_remote_vertex(e.source); + vertex_descriptor v = resolve_remote_vertex(e.target); + add_edge(u, v, e.properties, e.property_ptr, vecS()); + } + + commit_pending_in_edges(directed_selector()); + } + + template + void graph_loader::commit_pending_in_edges(directedS) + {} + + template + void graph_loader::commit_pending_in_edges(bidirectionalS) + { + resolve_property_ptrs(); + + BOOST_FOREACH(pending_in_edge const& e, m_pending_in_edges) + { + vertex_descriptor u = resolve_remote_vertex(e.u, vertex_list_selector()); + vertex_descriptor v = resolve_remote_vertex(e.v, vertex_list_selector()); + + typedef detail::parallel::stored_in_edge stored_edge; + + std::vector >::iterator i = std::lower_bound( + m_property_ptrs[owner(u)].begin() + , m_property_ptrs[owner(u)].end() + , unsafe_pair(e.property_ptr, 0) + ); + + if (i == m_property_ptrs[owner(u)].end() + || i->first != e.property_ptr) + { + assert(false); + } + + local_edge_descriptor local_edge(local(u), local(v), i->second); + stored_edge edge(owner(u), local_edge); + boost::graph_detail::push( + get(vertex_in_edges, m_g.base())[local(v)], edge); + } + } + + template + typename graph_loader::vertex_descriptor + graph_loader::resolve_remote_vertex( + vertex_descriptor u) const + { + if (owner(u) == process_id(m_pg)) + { + return vertex_descriptor( + process_id(m_pg), m_local_vertices.find(local(u))->second); + } + + typename std::vector::const_iterator + i = std::lower_bound( + m_requested_vertices[owner(u)].begin() + , m_requested_vertices[owner(u)].end() + , serializable_vertex_descriptor(local(u)) + ); + + if (i == m_requested_vertices[owner(u)].end() + || *i != local(u)) + { + assert(false); + } + + local_vertex_descriptor local = + m_remote_vertices[owner(u)][m_requested_vertices[owner(u)].end() - i]; + return vertex_descriptor(owner(u), local); + } + + template + typename graph_loader::vertex_descriptor + graph_loader::resolve_remote_vertex( + vertex_descriptor u, vecS) const + { + return u; + } + + template + template + typename graph_loader::vertex_descriptor + graph_loader::resolve_remote_vertex( + vertex_descriptor u, Anything) const + { + return resolve_remote_vertex(u); + } + + template + void* + graph_loader::maybe_load_property_ptr(bidirectionalS) + { + void* ptr; + m_ar >> make_nvp("property_ptr", unsafe_serialize(ptr)); + return ptr; + } + +template +void maybe_save_local_descriptor(Archive& ar, D const&, vecS) +{} + +template +void maybe_save_local_descriptor(Archive& ar, D const& d, NotVecS) +{ + ar << serialization::make_nvp( + "local", unsafe_serialize(const_cast(d))); +} + +template +void maybe_save_properties( + Archive&, char const*, no_property const&) +{} + +template +void maybe_save_properties( + Archive& ar, char const* name, property const& properties) +{ + ar & serialization::make_nvp(name, get_property_value(properties, Tag())); + maybe_save_properties(ar, name, static_cast(properties)); +} + +template +void save_in_edges(Archive& ar, Graph const& g, directedS) +{} + +// We need to save the edges in the base edge +// list, and the in_edges that are stored in the +// vertex_in_edges vertex property. +template +void save_in_edges(Archive& ar, Graph const& g, bidirectionalS) +{ + typedef typename Graph::process_group_type + process_group_type; + typedef typename process_group_type::process_id_type + process_id_type; + typedef typename graph_traits< + Graph>::vertex_descriptor vertex_descriptor; + typedef typename vertex_descriptor::local_descriptor_type + local_vertex_descriptor; + typedef typename graph_traits< + Graph>::edge_descriptor edge_descriptor; + + process_id_type id = g.processor(); + + typedef std::pair in_edge; + std::vector saved_in_edges; + + BGL_FORALL_VERTICES_T(v, g, Graph) + { + BOOST_FOREACH(edge_descriptor const& e, in_edges(v, g)) + { + // Only save the in_edges that isn't owned by this process. + if (owner(e) == id) + continue; + + saved_in_edges.push_back(e); + } + } + + std::size_t I = saved_in_edges.size(); + ar << BOOST_SERIALIZATION_NVP(I); + + BOOST_FOREACH(edge_descriptor const& e, saved_in_edges) + { + process_id_type src_owner = owner(source(e,g)); + local_vertex_descriptor local_src = local(source(e,g)); + local_vertex_descriptor local_target = local(target(e,g)); + void* property_ptr = local(e).get_property(); + + using serialization::make_nvp; + + ar << make_nvp("src_owner", src_owner); + ar << make_nvp("source", unsafe_serialize(local_src)); + ar << make_nvp("target", unsafe_serialize(local_target)); + ar << make_nvp("property_ptr", unsafe_serialize(property_ptr)); + } +} + +template +void maybe_save_property_ptr(Archive&, Edge const&, directedS) +{} + +template +void maybe_save_property_ptr(Archive& ar, Edge const& e, bidirectionalS) +{ + void* ptr = local(e).get_property(); + ar << serialization::make_nvp("property_ptr", unsafe_serialize(ptr)); +} + +template +void save_edges(Archive& ar, Graph const& g, DirectedS) +{ + typedef typename Graph::process_group_type + process_group_type; + typedef typename process_group_type::process_id_type + process_id_type; + typedef typename graph_traits< + Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits< + Graph>::edge_descriptor edge_descriptor; + + // We retag the property list here so that bundled properties are + // properly placed into property. + typedef typename boost::detail::retag_property_list< + edge_bundle_t, + typename Graph::edge_property_type>::type + edge_property_type; + + int E = num_edges(g); + ar << BOOST_SERIALIZATION_NVP(E); + + // For *directed* graphs, we can just save + // the edge list and be done. + // + // For *bidirectional* graphs, we need to also + // save the "vertex_in_edges" property map, + // because it might contain in-edges that + // are not locally owned. + BGL_FORALL_EDGES_T(e, g, Graph) + { + vertex_descriptor src(source(e, g)); + vertex_descriptor tgt(target(e, g)); + + typename vertex_descriptor::local_descriptor_type + local_u(local(src)); + typename vertex_descriptor::local_descriptor_type + local_v(local(tgt)); + + process_id_type target_owner = owner(tgt); + + using serialization::make_nvp; + + ar << make_nvp("source", unsafe_serialize(local_u)); + ar << make_nvp("target_owner", target_owner); + ar << make_nvp("target", unsafe_serialize(local_v)); + + maybe_save_properties( + ar, "edge_property" + , static_cast(get(edge_all_t(), g, e)) + ); + + maybe_save_property_ptr(ar, e, DirectedS()); + } + + save_in_edges(ar, g, DirectedS()); +} + +}} // namespace detail::parallel + +template +template +void PBGL_DISTRIB_ADJLIST_TYPE::load(std::string const& filename) +{ + typedef typename config_type::VertexListS vertex_list_selector; + + process_group_type pg = process_group(); + process_id_type id = process_id(pg); + + synchronize(pg); + + std::vector disk_files = detail::parallel::available_process_files(filename); + std::sort(disk_files.begin(), disk_files.end()); + + // Negotiate which process gets which file. Serialized. + std::vector consumed_files; + int picked_file = -1; + + if (id > 0) + receive_oob(pg, id-1, 0, consumed_files); + + std::sort(consumed_files.begin(), consumed_files.end()); + std::vector available_files; + std::set_difference( + disk_files.begin(), disk_files.end() + , consumed_files.begin(), consumed_files.end() + , std::back_inserter(available_files) + ); + + if (available_files.empty()) + boost::throw_exception(std::runtime_error("no file available")); + + // back() used for debug purposes. Making sure the + // ranks are shuffled. + picked_file = available_files.back(); + +# ifdef PBGL_SERIALIZE_DEBUG + std::cout << id << " picked " << picked_file << "\n"; +# endif + + consumed_files.push_back(picked_file); + + if (id < num_processes(pg) - 1) + send_oob(pg, id+1, 0, consumed_files); + + std::string local_filename = filename + "/" + + lexical_cast(picked_file); + + std::ifstream in(local_filename.c_str(), std::ios_base::binary); + IStreamConstructibleArchive ar(in); + + detail::parallel::graph_loader< + graph_type, IStreamConstructibleArchive, InVertexListS + > loader(*this, ar); + +# ifdef PBGL_SERIALIZE_DEBUG + std::cout << "Process " << id << " done loading.\n"; +# endif + + synchronize(pg); +} + +template +template +void PBGL_DISTRIB_ADJLIST_TYPE::save(std::string const& filename) const +{ + // We retag the property list here so that bundled properties are + // properly placed into property. + typedef typename boost::detail::retag_property_list< + vertex_bundle_t, vertex_property_type + >::type vertex_property_type; + + typedef typename config_type::VertexListS vertex_list_selector; + + process_group_type pg = process_group(); + process_id_type id = process_id(pg); + + if (filesystem::exists(filename) && !filesystem::is_directory(filename)) + boost::throw_exception(std::runtime_error("entry exists, but is not a directory")); + + filesystem::remove_all(filename); + filesystem::create_directory(filename); + + synchronize(pg); + + std::string local_filename = filename + "/" + + lexical_cast(id); + + std::ofstream out(local_filename.c_str(), std::ios_base::binary); + OStreamConstructibleArchive ar(out); + + using serialization::make_nvp; + + typename process_group_type::process_size_type num_processes_ = num_processes(pg); + ar << make_nvp("num_processes", num_processes_); + ar << BOOST_SERIALIZATION_NVP(id); + ar << make_nvp("mapping", this->distribution().mapping()); + + int V = num_vertices(*this); + ar << BOOST_SERIALIZATION_NVP(V); + + BGL_FORALL_VERTICES_T(v, *this, graph_type) + { + local_vertex_descriptor local_descriptor(local(v)); + detail::parallel::maybe_save_local_descriptor( + ar, local_descriptor, vertex_list_selector()); + detail::parallel::maybe_save_properties( + ar, "vertex_property" + , static_cast(get(vertex_all_t(), *this, v)) + ); + } + + detail::parallel::save_edges(ar, *this, directed_selector()); + + ar << make_nvp("distribution", this->distribution()); +} + +} // namespace boost + +#endif // BOOST_GRAPH_DISTRIBUTED_ADJLIST_SERIALIZATION_070925_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/betweenness_centrality.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/betweenness_centrality.hpp new file mode 100644 index 0000000000..134cc02e8e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/betweenness_centrality.hpp @@ -0,0 +1,1724 @@ +// 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_PARALLEL_BRANDES_BETWEENNESS_CENTRALITY_HPP +#define BOOST_GRAPH_PARALLEL_BRANDES_BETWEENNESS_CENTRALITY_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +// #define COMPUTE_PATH_COUNTS_INLINE + +#include +#include +#include +#include +#include + +// For additive_reducer +#include +#include +#include +#include +#include + +#include +#include +#include + +// NGE - Needed for minstd_rand at L807, should pass vertex list +// or generator instead +#include + +#include +#include +#include + +// Appending reducer +template +struct append_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template + T operator()(const K&) const { return T(); } + + template + T operator()(const K&, const T& x, const T& y) const + { + T z(x.begin(), x.end()); + for (typename T::const_iterator iter = y.begin(); iter != y.end(); ++iter) + if (std::find(z.begin(), z.end(), *iter) == z.end()) + z.push_back(*iter); + + return z; + } +}; + +namespace boost { + + namespace serialization { + + // TODO(nge): Write generalized serialization for tuples + template + void serialize(Archive & ar, + boost::tuple& t, + const unsigned int) + { + ar & get<0>(t); + ar & get<1>(t); + ar & get<2>(t); + ar & get<3>(t); + } + + } // serialization + + template + class get_owner_of_first_tuple_element { + + public: + typedef typename property_traits::value_type owner_type; + + get_owner_of_first_tuple_element(OwnerMap owner) : owner(owner) { } + + owner_type get_owner(Tuple t) { return get(owner, get<0>(t)); } + + private: + OwnerMap owner; + }; + + template + typename get_owner_of_first_tuple_element::owner_type + get(get_owner_of_first_tuple_element o, Tuple t) + { return o.get_owner(t); } + + template + class get_owner_of_first_pair_element { + + public: + typedef typename property_traits::value_type owner_type; + + get_owner_of_first_pair_element(OwnerMap owner) : owner(owner) { } + + template + owner_type get_owner(std::pair p) { return get(owner, p.first); } + + private: + OwnerMap owner; + }; + + template + typename get_owner_of_first_pair_element::owner_type + get(get_owner_of_first_pair_element o, std::pair p) + { return o.get_owner(p); } + + namespace graph { namespace parallel { namespace detail { + + template + class betweenness_centrality_msg_value + { + typedef typename property_traits::value_type distance_type; + typedef typename property_traits::value_type incoming_type; + typedef typename incoming_type::value_type incoming_value_type; + + public: + typedef std::pair type; + + static type create(distance_type dist, incoming_value_type source) + { return std::make_pair(dist, source); } + }; + + + /************************************************************************/ + /* Delta-stepping Betweenness Centrality */ + /************************************************************************/ + + template + class betweenness_centrality_delta_stepping_impl { + // Could inherit from delta_stepping_impl to get run() method + // but for the time being it's just reproduced here + + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::degree_size_type Degree; + typedef typename property_traits::value_type Dist; + typedef typename property_traits::value_type IncomingType; + typedef typename boost::graph::parallel::process_group_type::type + ProcessGroup; + + typedef std::list Bucket; + typedef typename Bucket::iterator BucketIterator; + typedef typename std::vector::size_type BucketIndex; + + typedef betweenness_centrality_msg_value + MessageValue; + + enum { + // Relax a remote vertex. The message contains a pair, the first part of which is the vertex whose + // tentative distance is being relaxed and the second part + // contains either the new distance (if there is no predecessor + // map) or a pair with the distance and predecessor. + msg_relax + }; + + public: + + // Must supply delta, ctor that guesses delta removed + betweenness_centrality_delta_stepping_impl(const Graph& g, + DistanceMap distance, + IncomingMap incoming, + EdgeWeightMap weight, + PathCountMap path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + IsSettledMap is_settled, + VertexIndexMap vertex_index, +#endif + Dist delta); + + void run(Vertex s); + + private: + // Relax the edge (u, v), creating a new best path of distance x. + void relax(Vertex u, Vertex v, Dist x); + + // Synchronize all of the processes, by receiving all messages that + // have not yet been received. + void synchronize() + { + using boost::graph::parallel::synchronize; + synchronize(pg); + } + + // Setup triggers for msg_relax messages + void setup_triggers() + { + using boost::graph::parallel::simple_trigger; + simple_trigger(pg, msg_relax, this, + &betweenness_centrality_delta_stepping_impl::handle_msg_relax); + } + + void handle_msg_relax(int /*source*/, int /*tag*/, + const std::pair& data, + trigger_receive_context) + { relax(data.second.second, data.first, data.second.first); } + + const Graph& g; + IncomingMap incoming; + DistanceMap distance; + EdgeWeightMap weight; + PathCountMap path_count; +#ifdef COMPUTE_PATH_COUNTS_INLINE + IsSettledMap is_settled; + VertexIndexMap vertex_index; +#endif + Dist delta; + ProcessGroup pg; + typename property_map::const_type owner; + typename property_map::const_type local; + + // A "property map" that contains the position of each vertex in + // whatever bucket it resides in. + std::vector position_in_bucket; + + // Bucket data structure. The ith bucket contains all local vertices + // with (tentative) distance in the range [i*delta, + // (i+1)*delta). + std::vector buckets; + + // This "dummy" list is used only so that we can initialize the + // position_in_bucket property map with non-singular iterators. This + // won't matter for most implementations of the C++ Standard + // Library, but it avoids undefined behavior and allows us to run + // with library "debug modes". + std::list dummy_list; + + // A "property map" that states which vertices have been deleted + // from the bucket in this iteration. + std::vector vertex_was_deleted; + }; + + template + betweenness_centrality_delta_stepping_impl< + Graph, DistanceMap, IncomingMap, EdgeWeightMap, PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , IsSettledMap, VertexIndexMap +#endif + >:: + betweenness_centrality_delta_stepping_impl(const Graph& g, + DistanceMap distance, + IncomingMap incoming, + EdgeWeightMap weight, + PathCountMap path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + IsSettledMap is_settled, + VertexIndexMap vertex_index, +#endif + Dist delta) + : g(g), + incoming(incoming), + distance(distance), + weight(weight), + path_count(path_count), +#ifdef COMPUTE_PATH_COUNTS_INLINE + is_settled(is_settled), + vertex_index(vertex_index), +#endif + delta(delta), + pg(boost::graph::parallel::process_group_adl(g), attach_distributed_object()), + owner(get(vertex_owner, g)), + local(get(vertex_local, g)) + + { setup_triggers(); } + + template + void + betweenness_centrality_delta_stepping_impl< + Graph, DistanceMap, IncomingMap, EdgeWeightMap, PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , IsSettledMap, VertexIndexMap +#endif + >:: + run(Vertex s) + { + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + typename process_group_type::process_id_type id = process_id(pg); + + Dist inf = (std::numeric_limits::max)(); + + // None of the vertices are stored in the bucket. + position_in_bucket.clear(); + position_in_bucket.resize(num_vertices(g), dummy_list.end()); + + // None of the vertices have been deleted + vertex_was_deleted.clear(); + vertex_was_deleted.resize(num_vertices(g), false); + + // No path from s to any other vertex, yet + BGL_FORALL_VERTICES_T(v, g, Graph) + put(distance, v, inf); + + // The distance to the starting node is zero + if (get(owner, s) == id) + // Put "s" into its bucket (bucket 0) + relax(s, s, 0); + else + // Note that we know the distance to s is zero + cache(distance, s, 0); + +#ifdef COMPUTE_PATH_COUNTS_INLINE + // Synchronize here to deliver initial relaxation since we don't + // synchronize at the beginning of the inner loop any more + synchronize(); + + // Incoming edge count map is an implementation detail and should + // be freed as soon as possible so build it here + typedef typename graph_traits::edges_size_type edges_size_type; + + std::vector incoming_edge_countS(num_vertices(g)); + iterator_property_map::iterator, VertexIndexMap> + incoming_edge_count(incoming_edge_countS.begin(), vertex_index); +#endif + + BucketIndex max_bucket = (std::numeric_limits::max)(); + BucketIndex current_bucket = 0; + do { +#ifdef COMPUTE_PATH_COUNTS_INLINE + // We need to clear the outgoing map after every bucket so just build it here + std::vector outgoingS(num_vertices(g)); + IncomingMap outgoing(outgoingS.begin(), vertex_index); + + outgoing.set_reduce(append_reducer()); +#else + // Synchronize with all of the other processes. + synchronize(); +#endif + + // Find the next bucket that has something in it. + while (current_bucket < buckets.size() + && (!buckets[current_bucket] || buckets[current_bucket]->empty())) + ++current_bucket; + if (current_bucket >= buckets.size()) + current_bucket = max_bucket; + + // Find the smallest bucket (over all processes) that has vertices + // that need to be processed. + using boost::parallel::all_reduce; + using boost::parallel::minimum; + current_bucket = all_reduce(pg, current_bucket, minimum()); + + if (current_bucket == max_bucket) + // There are no non-empty buckets in any process; exit. + break; + + // Contains the set of vertices that have been deleted in the + // relaxation of "light" edges. Note that we keep track of which + // vertices were deleted with the property map + // "vertex_was_deleted". + std::vector deleted_vertices; + + // Repeatedly relax light edges + bool nonempty_bucket; + do { + // Someone has work to do in this bucket. + + if (current_bucket < buckets.size() && buckets[current_bucket]) { + Bucket& bucket = *buckets[current_bucket]; + // For each element in the bucket + while (!bucket.empty()) { + Vertex u = bucket.front(); + + // Remove u from the front of the bucket + bucket.pop_front(); + + // Insert u into the set of deleted vertices, if it hasn't + // been done already. + if (!vertex_was_deleted[get(local, u)]) { + vertex_was_deleted[get(local, u)] = true; + deleted_vertices.push_back(u); + } + + // Relax each light edge. + Dist u_dist = get(distance, u); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + if (get(weight, e) <= delta) // light edge + relax(u, target(e, g), u_dist + get(weight, e)); + } + } + + // Synchronize with all of the other processes. + synchronize(); + + // Is the bucket empty now? + nonempty_bucket = (current_bucket < buckets.size() + && buckets[current_bucket] + && !buckets[current_bucket]->empty()); + } while (all_reduce(pg, nonempty_bucket, std::logical_or())); + + // Relax heavy edges for each of the vertices that we previously + // deleted. + for (typename std::vector::iterator iter = deleted_vertices.begin(); + iter != deleted_vertices.end(); ++iter) { + // Relax each heavy edge. + Vertex u = *iter; + Dist u_dist = get(distance, u); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + if (get(weight, e) > delta) // heavy edge + relax(u, target(e, g), u_dist + get(weight, e)); + +#ifdef COMPUTE_PATH_COUNTS_INLINE + // Set outgoing paths + IncomingType in = get(incoming, u); + for (typename IncomingType::iterator pred = in.begin(); pred != in.end(); ++pred) + if (get(owner, *pred) == id) { + IncomingType x = get(outgoing, *pred); + if (std::find(x.begin(), x.end(), u) == x.end()) + x.push_back(u); + put(outgoing, *pred, x); + } else { + IncomingType in; + in.push_back(u); + put(outgoing, *pred, in); + } + + // Set incoming edge counts + put(incoming_edge_count, u, in.size()); +#endif + } + +#ifdef COMPUTE_PATH_COUNTS_INLINE + synchronize(); // Deliver heavy edge relaxations and outgoing paths + + // Build Queue + typedef typename property_traits::value_type PathCountType; + typedef std::pair queue_value_type; + typedef typename property_map::const_type OwnerMap; + typedef typename get_owner_of_first_pair_element IndirectOwnerMap; + + typedef boost::queue local_queue_type; + typedef boost::graph::distributed::distributed_queue dist_queue_type; + + IndirectOwnerMap indirect_owner(owner); + dist_queue_type Q(pg, indirect_owner); + + // Find sources to initialize queue + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (get(is_settled, v) && !(get(outgoing, v).empty())) { + put(incoming_edge_count, v, 1); + Q.push(std::make_pair(v, 0)); // Push this vertex with no additional path count + } + } + + // Set path counts for vertices in this bucket + while (!Q.empty()) { + queue_value_type t = Q.top(); Q.pop(); + Vertex v = t.first; + PathCountType p = t.second; + + put(path_count, v, get(path_count, v) + p); + put(incoming_edge_count, v, get(incoming_edge_count, v) - 1); + + if (get(incoming_edge_count, v) == 0) { + IncomingType out = get(outgoing, v); + for (typename IncomingType::iterator iter = out.begin(); iter != out.end(); ++iter) + Q.push(std::make_pair(*iter, get(path_count, v))); + } + } + + // Mark the vertices in this bucket settled + for (typename std::vector::iterator iter = deleted_vertices.begin(); + iter != deleted_vertices.end(); ++iter) + put(is_settled, *iter, true); + + // No need to clear path count map as it is never read/written remotely + // No need to clear outgoing map as it is re-alloced every bucket +#endif + + // Go to the next bucket: the current bucket must already be empty. + ++current_bucket; + } while (true); + + // Delete all of the buckets. + for (typename std::vector::iterator iter = buckets.begin(); + iter != buckets.end(); ++iter) { + if (*iter) { + delete *iter; + *iter = 0; + } + } + } + + template + void + betweenness_centrality_delta_stepping_impl< + Graph, DistanceMap, IncomingMap, EdgeWeightMap, PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , IsSettledMap, VertexIndexMap +#endif + >:: + relax(Vertex u, Vertex v, Dist x) + { + + if (x <= get(distance, v)) { + + // We're relaxing the edge to vertex v. + if (get(owner, v) == process_id(pg)) { + if (x < get(distance, v)) { + // Compute the new bucket index for v + BucketIndex new_index = static_cast(x / delta); + + // Make sure there is enough room in the buckets data structure. + if (new_index >= buckets.size()) buckets.resize(new_index + 1, 0); + + // Make sure that we have allocated the bucket itself. + if (!buckets[new_index]) buckets[new_index] = new Bucket; + + if (get(distance, v) != (std::numeric_limits::max)() + && !vertex_was_deleted[get(local, v)]) { + // We're moving v from an old bucket into a new one. Compute + // the old index, then splice it in. + BucketIndex old_index + = static_cast(get(distance, v) / delta); + buckets[new_index]->splice(buckets[new_index]->end(), + *buckets[old_index], + position_in_bucket[get(local, v)]); + } else { + // We're inserting v into a bucket for the first time. Put it + // at the end. + buckets[new_index]->push_back(v); + } + + // v is now at the last position in the new bucket + position_in_bucket[get(local, v)] = buckets[new_index]->end(); + --position_in_bucket[get(local, v)]; + + // Update tentative distance information and incoming, path_count + if (u != v) put(incoming, v, IncomingType(1, u)); + put(distance, v, x); + } // u != v covers initial source relaxation and self-loops + else if (x == get(distance, v) && u != v) { + + // Add incoming edge if it's not already in the list + IncomingType in = get(incoming, v); + if (std::find(in.begin(), in.end(), u) == in.end()) { + in.push_back(u); + put(incoming, v, in); + } + } + } else { + // The vertex is remote: send a request to the vertex's owner + send(pg, get(owner, v), msg_relax, + std::make_pair(v, MessageValue::create(x, u))); + + // Cache tentative distance information + cache(distance, v, x); + } + } + } + + /************************************************************************/ + /* Shortest Paths function object for betweenness centrality */ + /************************************************************************/ + + template + struct brandes_shortest_paths { + typedef typename property_traits::value_type weight_type; + + brandes_shortest_paths() + : weight(1), delta(0) { } + brandes_shortest_paths(weight_type delta) + : weight(1), delta(delta) { } + brandes_shortest_paths(WeightMap w) + : weight(w), delta(0) { } + brandes_shortest_paths(WeightMap w, weight_type delta) + : weight(w), delta(delta) { } + + template + void + operator()(Graph& g, + typename graph_traits::vertex_descriptor s, + IncomingMap incoming, + DistanceMap distance, + PathCountMap path_count +#ifdef COMPUTE_PATH_COUNTS_INLINE + , IsSettledMap is_settled, + VertexIndexMap vertex_index +#endif + ) + { + typedef typename property_traits::value_type + distance_type; + + typedef std::plus Combine; + typedef std::less Compare; + + // The "distance" map needs to act like one, retrieving the default + // value of infinity. + set_property_map_role(vertex_distance, distance); + + // Only calculate delta the first time operator() is called + // This presumes g is the same every time, but so does the fact + // that we're reusing the weight map + if (delta == 0) + set_delta(g); + + // TODO (NGE): Restructure the code so we don't have to construct + // impl every time? + betweenness_centrality_delta_stepping_impl< + Graph, DistanceMap, IncomingMap, WeightMap, PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , IsSettledMap, VertexIndexMap +#endif + > + impl(g, distance, incoming, weight, path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + is_settled, vertex_index, +#endif + delta); + + impl.run(s); + } + + private: + + template + void + set_delta(const Graph& g) + { + using boost::parallel::all_reduce; + using boost::parallel::maximum; + using std::max; + + typedef typename graph_traits::degree_size_type Degree; + typedef weight_type Dist; + + // Compute the maximum edge weight and degree + Dist max_edge_weight = 0; + Degree max_degree = 0; + BGL_FORALL_VERTICES_T(u, g, Graph) { + max_degree = max BOOST_PREVENT_MACRO_SUBSTITUTION (max_degree, out_degree(u, g)); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + max_edge_weight = max BOOST_PREVENT_MACRO_SUBSTITUTION (max_edge_weight, get(weight, e)); + } + + max_edge_weight = all_reduce(process_group(g), max_edge_weight, maximum()); + max_degree = all_reduce(process_group(g), max_degree, maximum()); + + // Take a guess at delta, based on what works well for random + // graphs. + delta = max_edge_weight / max_degree; + if (delta == 0) + delta = 1; + } + + WeightMap weight; + weight_type delta; + }; + + // Perform a single SSSP from the specified vertex and update the centrality map(s) + template + void + do_brandes_sssp(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + IsSettledMap is_settled, +#endif + VertexIndexMap vertex_index, + ShortestPaths shortest_paths, + typename graph_traits::vertex_descriptor s) + { + using boost::detail::graph::update_centrality; + using boost::graph::parallel::process_group; + + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::edges_size_type edges_size_type; + + typedef typename property_traits::value_type incoming_type; + typedef typename property_traits::value_type distance_type; + typedef typename property_traits::value_type dependency_type; + typedef typename property_traits::value_type path_count_type; + + typedef typename incoming_type::iterator incoming_iterator; + + typedef typename property_map::const_type OwnerMap; + OwnerMap owner = get(vertex_owner, g); + + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + process_group_type pg = process_group(g); + typename process_group_type::process_id_type id = process_id(pg); + + // TODO: Is it faster not to clear some of these maps? + // Initialize for this iteration + distance.clear(); + incoming.clear(); + path_count.clear(); + dependency.clear(); + BGL_FORALL_VERTICES_T(v, g, Graph) { + put(path_count, v, 0); + put(dependency, v, 0); + } + + if (get(owner, s) == id) { + put(incoming, s, incoming_type()); +#ifdef COMPUTE_PATH_COUNTS_INLINE + put(path_count, s, 1); + put(is_settled, s, true); +#endif + } + + // Execute the shortest paths algorithm. This will be either + // a weighted or unweighted customized breadth-first search, + shortest_paths(g, s, incoming, distance, path_count +#ifdef COMPUTE_PATH_COUNTS_INLINE + , is_settled, vertex_index +#endif + ); + +#ifndef COMPUTE_PATH_COUNTS_INLINE + + // + // TODO: Optimize case where source has no out-edges + // + + // Count of incoming edges to tell when all incoming edges have been relaxed in + // the induced shortest paths DAG + std::vector incoming_edge_countS(num_vertices(g)); + iterator_property_map::iterator, VertexIndexMap> + incoming_edge_count(incoming_edge_countS.begin(), vertex_index); + + BGL_FORALL_VERTICES_T(v, g, Graph) { + put(incoming_edge_count, v, get(incoming, v).size()); + } + + if (get(owner, s) == id) { + put(incoming_edge_count, s, 1); + put(incoming, s, incoming_type()); + } + + std::vector outgoingS(num_vertices(g)); + iterator_property_map::iterator, VertexIndexMap> + outgoing(outgoingS.begin(), vertex_index); + + outgoing.set_reduce(append_reducer()); + + // Mark forward adjacencies in DAG of shortest paths + + // TODO: It's possible to do this using edge flags but it's not currently done this way + // because during traversal of the DAG we would have to examine all out edges + // which would lead to more memory accesses and a larger cache footprint. + // + // In the bidirectional graph case edge flags would be an excellent way of marking + // edges in the DAG of shortest paths + BGL_FORALL_VERTICES_T(v, g, Graph) { + incoming_type i = get(incoming, v); + for (typename incoming_type::iterator iter = i.begin(); iter != i.end(); ++iter) { + if (get(owner, *iter) == id) { + incoming_type x = get(outgoing, *iter); + if (std::find(x.begin(), x.end(), v) == x.end()) + x.push_back(v); + put(outgoing, *iter, x); + } else { + incoming_type in; + in.push_back(v); + put(outgoing, *iter, in); + } + } + } + + synchronize(pg); + + // Traverse DAG induced by forward edges in dependency order and compute path counts + { + typedef std::pair queue_value_type; + typedef get_owner_of_first_pair_element IndirectOwnerMap; + + typedef boost::queue local_queue_type; + typedef boost::graph::distributed::distributed_queue dist_queue_type; + + IndirectOwnerMap indirect_owner(owner); + dist_queue_type Q(pg, indirect_owner); + + if (get(owner, s) == id) + Q.push(std::make_pair(s, 1)); + + while (!Q.empty()) { + queue_value_type t = Q.top(); Q.pop(); + vertex_descriptor v = t.first; + path_count_type p = t.second; + + put(path_count, v, get(path_count, v) + p); + put(incoming_edge_count, v, get(incoming_edge_count, v) - 1); + + if (get(incoming_edge_count, v) == 0) { + incoming_type out = get(outgoing, v); + for (typename incoming_type::iterator iter = out.begin(); iter != out.end(); ++iter) + Q.push(std::make_pair(*iter, get(path_count, v))); + } + } + } + +#endif // COMPUTE_PATH_COUNTS_INLINE + + // + // Compute dependencies + // + + + // Build the distributed_queue + // Value type consists of 1) target of update 2) source of update + // 3) dependency of source 4) path count of source + typedef boost::tuple + queue_value_type; + typedef get_owner_of_first_tuple_element IndirectOwnerMap; + + typedef boost::queue local_queue_type; + typedef boost::graph::distributed::distributed_queue dist_queue_type; + + IndirectOwnerMap indirect_owner(owner); + dist_queue_type Q(pg, indirect_owner); + + // Calculate number of vertices each vertex depends on, when a vertex has been pushed + // that number of times then we will update it + // AND Request path counts of sources of incoming edges + std::vector dependency_countS(num_vertices(g), 0); + iterator_property_map::iterator, VertexIndexMap> + dependency_count(dependency_countS.begin(), vertex_index); + + dependency_count.set_reduce(boost::graph::distributed::additive_reducer()); + + path_count.set_max_ghost_cells(0); + + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (get(distance, v) < (std::numeric_limits::max)()) { + incoming_type el = get(incoming, v); + for (incoming_iterator vw = el.begin(); vw != el.end(); ++vw) { + if (get(owner, *vw) == id) + put(dependency_count, *vw, get(dependency_count, *vw) + 1); + else { + put(dependency_count, *vw, 1); + + // Request path counts + get(path_count, *vw); + } + + // request() doesn't work here, perhaps because we don't have a copy of this + // ghost cell already? + } + } + } + + synchronize(pg); + + // Push vertices with non-zero distance/path count and zero dependency count + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (get(distance, v) < (std::numeric_limits::max)() + && get(dependency_count, v) == 0) + Q.push(boost::make_tuple(v, v, get(dependency, v), get(path_count, v))); + } + + dependency.set_max_ghost_cells(0); + while(!Q.empty()) { + + queue_value_type x = Q.top(); Q.pop(); + vertex_descriptor w = get<0>(x); + vertex_descriptor source = get<1>(x); + dependency_type dep = get<2>(x); + path_count_type pc = get<3>(x); + + cache(dependency, source, dep); + cache(path_count, source, pc); + + if (get(dependency_count, w) != 0) + put(dependency_count, w, get(dependency_count, w) - 1); + + if (get(dependency_count, w) == 0) { + + // Update dependency and centrality of sources of incoming edges + incoming_type el = get(incoming, w); + for (incoming_iterator vw = el.begin(); vw != el.end(); ++vw) { + vertex_descriptor v = *vw; + + assert(get(path_count, w) != 0); + + dependency_type factor = dependency_type(get(path_count, v)) + / dependency_type(get(path_count, w)); + factor *= (dependency_type(1) + get(dependency, w)); + + if (get(owner, v) == id) + put(dependency, v, get(dependency, v) + factor); + else + put(dependency, v, factor); + + update_centrality(edge_centrality_map, v, factor); + } + + if (w != s) + update_centrality(centrality, w, get(dependency, w)); + + // Push sources of edges in incoming edge list + for (incoming_iterator vw = el.begin(); vw != el.end(); ++vw) + Q.push(boost::make_tuple(*vw, w, get(dependency, w), get(path_count, w))); + } + } + } + + template + void + brandes_betweenness_centrality_impl(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + ShortestPaths shortest_paths, + Buffer sources) + { + using boost::detail::graph::init_centrality_map; + using boost::detail::graph::divide_centrality_by_two; + using boost::graph::parallel::process_group; + + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::edge_iterator edge_iterator; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::vertices_size_type vertices_size_type; + + typedef typename property_traits::value_type distance_type; + typedef typename property_traits::value_type dependency_type; + + // Initialize centrality + init_centrality_map(vertices(g), centrality); + init_centrality_map(edges(g), edge_centrality_map); + + // Set the reduction operation on the dependency map to be addition + dependency.set_reduce(boost::graph::distributed::additive_reducer()); + distance.set_reduce(boost::graph::distributed::choose_min_reducer()); + + // Don't allow remote procs to write incoming or path_count maps + // updating them is handled inside the betweenness_centrality_queue + incoming.set_consistency_model(0); + path_count.set_consistency_model(0); + + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + process_group_type pg = process_group(g); + +#ifdef COMPUTE_PATH_COUNTS_INLINE + // Build is_settled maps + std::vector is_settledS(num_vertices(g)); + typedef iterator_property_map::iterator, VertexIndexMap> + IsSettledMap; + + IsSettledMap is_settled(is_settledS.begin(), vertex_index); +#endif + + if (!sources.empty()) { + // DO SSSPs + while (!sources.empty()) { + do_brandes_sssp(g, centrality, edge_centrality_map, incoming, distance, + dependency, path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + is_settled, +#endif + vertex_index, shortest_paths, sources.top()); + sources.pop(); + } + } else { // Exact Betweenness Centrality + typedef typename graph_traits::vertices_size_type vertices_size_type; + vertices_size_type n = num_vertices(g); + n = boost::parallel::all_reduce(pg, n, std::plus()); + + for (vertices_size_type i = 0; i < n; ++i) { + vertex_descriptor v = vertex(i, g); + + do_brandes_sssp(g, centrality, edge_centrality_map, incoming, distance, + dependency, path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + is_settled, +#endif + vertex_index, shortest_paths, v); + } + } + + 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); + } + } + + template + void + do_sequential_brandes_sssp(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + ShortestPaths shortest_paths, + Stack& ordered_vertices, + typename graph_traits::vertex_descriptor v) + { + using boost::detail::graph::update_centrality; + + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + typedef typename property_traits::value_type incoming_type; + + // Initialize for this iteration + BGL_FORALL_VERTICES_T(w, g, Graph) { + // put(path_count, w, 0); + incoming[w].clear(); + put(dependency, w, 0); + } + + put(path_count, v, 1); + incoming[v].clear(); + + // 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, v, 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 != v) { + update_centrality(centrality, w, get(dependency, w)); + } + } + } + + // Betweenness Centrality variant that duplicates graph across processors + // and parallizes SSSPs + // This function expects a non-distributed graph and property-maps + template + void + non_distributed_brandes_betweenness_centrality_impl(const ProcessGroup& pg, + const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, // P + DistanceMap distance, // d + DependencyMap dependency, // delta + PathCountMap path_count, // sigma + VertexIndexMap vertex_index, + ShortestPaths shortest_paths, + Buffer sources) + { + using boost::detail::graph::init_centrality_map; + using boost::detail::graph::divide_centrality_by_two; + using boost::graph::parallel::process_group; + + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::edge_iterator edge_iterator; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::vertices_size_type vertices_size_type; + + typedef typename property_traits::value_type distance_type; + + typedef ProcessGroup process_group_type; + + typename process_group_type::process_id_type id = process_id(pg); + typename process_group_type::process_size_type p = num_processes(pg); + + // Initialize centrality + init_centrality_map(vertices(g), centrality); + init_centrality_map(edges(g), edge_centrality_map); + + std::stack ordered_vertices; + + if (!sources.empty()) { + std::vector local_sources; + + for (int i = 0; i < id; ++i) if (!sources.empty()) sources.pop(); + while (!sources.empty()) { + local_sources.push_back(sources.top()); + + for (int i = 0; i < p; ++i) if (!sources.empty()) sources.pop(); + } + + // DO SSSPs + for(size_t i = 0; i < local_sources.size(); ++i) + do_sequential_brandes_sssp(g, centrality, edge_centrality_map, incoming, + distance, dependency, path_count, vertex_index, + shortest_paths, ordered_vertices, local_sources[i]); + + } else { // Exact Betweenness Centrality + typedef typename graph_traits::vertices_size_type vertices_size_type; + vertices_size_type n = num_vertices(g); + + for (vertices_size_type i = id; i < n; i += p) { + vertex_descriptor v = vertex(i, g); + + do_sequential_brandes_sssp(g, centrality, edge_centrality_map, incoming, + distance, dependency, path_count, vertex_index, + shortest_paths, ordered_vertices, v); + } + } + + 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); + } + + // Merge the centrality maps by summing the values at each vertex) + // TODO(nge): this copy-out, reduce, copy-in is lame + typedef typename property_traits::value_type centrality_type; + typedef typename property_traits::value_type edge_centrality_type; + + std::vector centrality_v(num_vertices(g)); + std::vector edge_centrality_v; + edge_centrality_v.reserve(num_edges(g)); + + BGL_FORALL_VERTICES_T(v, g, Graph) { + centrality_v[get(vertex_index, v)] = get(centrality, v); + } + + // Skip when EdgeCentralityMap is a dummy_property_map + if (!is_same::value) { + BGL_FORALL_EDGES_T(e, g, Graph) { + edge_centrality_v.push_back(get(edge_centrality_map, e)); + } + // NGE: If we trust that the order of elements in the vector isn't changed in the + // all_reduce below then this method avoids the need for an edge index map + } + + using boost::parallel::all_reduce; + + all_reduce(pg, ¢rality_v[0], ¢rality_v[centrality_v.size()], + ¢rality_v[0], std::plus()); + + if (edge_centrality_v.size()) + all_reduce(pg, &edge_centrality_v[0], &edge_centrality_v[edge_centrality_v.size()], + &edge_centrality_v[0], std::plus()); + + BGL_FORALL_VERTICES_T(v, g, Graph) { + put(centrality, v, centrality_v[get(vertex_index, v)]); + } + + // Skip when EdgeCentralityMap is a dummy_property_map + if (!is_same::value) { + int i = 0; + BGL_FORALL_EDGES_T(e, g, Graph) { + put(edge_centrality_map, e, edge_centrality_v[i]); + ++i; + } + } + } + +} } } // end namespace graph::parallel::detail + +template +void +brandes_betweenness_centrality(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + Buffer sources, + typename property_traits::value_type delta + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + typedef typename property_traits::value_type distance_type; + typedef static_property_map WeightMap; + + graph::parallel::detail::brandes_shortest_paths + shortest_paths(delta); + + graph::parallel::detail::brandes_betweenness_centrality_impl(g, centrality, + edge_centrality_map, + incoming, distance, + dependency, path_count, + vertex_index, + shortest_paths, + sources); +} + +template +void +brandes_betweenness_centrality(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + Buffer sources, + typename property_traits::value_type delta, + WeightMap weight_map + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + graph::parallel::detail::brandes_shortest_paths shortest_paths(weight_map, delta); + + graph::parallel::detail::brandes_betweenness_centrality_impl(g, centrality, + edge_centrality_map, + incoming, distance, + dependency, path_count, + vertex_index, + shortest_paths, + sources); +} + +namespace graph { namespace parallel { namespace detail { + template + void + brandes_betweenness_centrality_dispatch2(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + WeightMap weight_map, + VertexIndexMap vertex_index, + Buffer sources, + typename property_traits::value_type delta) + { + typedef typename graph_traits::degree_size_type degree_size_type; + typedef typename graph_traits::vertex_descriptor vertex_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, unwrap_ref(sources), delta, + weight_map); + } + + // TODO: Should the type of the distance and dependency map depend on the + // value type of the centrality map? + template + void + brandes_betweenness_centrality_dispatch2(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + VertexIndexMap vertex_index, + Buffer sources, + typename graph_traits::edges_size_type delta) + { + typedef typename graph_traits::degree_size_type degree_size_type; + typedef typename graph_traits::edges_size_type edges_size_type; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_c<(is_same::value), + EdgeCentralityMap, + CentralityMap>::type a_centrality_map; + + 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, unwrap_ref(sources), delta); + } + + template + struct brandes_betweenness_centrality_dispatch1 + { + template + static void + run(const Graph& g, CentralityMap centrality, EdgeCentralityMap edge_centrality_map, + VertexIndexMap vertex_index, Buffer sources, + typename property_traits::value_type delta, WeightMap weight_map) + { + boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2( + g, centrality, edge_centrality_map, weight_map, vertex_index, sources, delta); + } + }; + + template<> + struct brandes_betweenness_centrality_dispatch1 + { + template + static void + run(const Graph& g, CentralityMap centrality, EdgeCentralityMap edge_centrality_map, + VertexIndexMap vertex_index, Buffer sources, + typename graph_traits::edges_size_type delta, + boost::detail::error_property_not_found) + { + boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2( + g, centrality, edge_centrality_map, vertex_index, sources, delta); + } + }; + +} } } // end namespace graph::parallel::detail + +template +void +brandes_betweenness_centrality(const Graph& g, + const bgl_named_params& params + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + typedef bgl_named_params named_params; + + typedef queue::vertex_descriptor> queue_t; + queue_t q; + + typedef typename property_value::type ew; + graph::parallel::detail::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), + choose_param(get_param(params, buffer_param_t()), boost::ref(q)), + choose_param(get_param(params, lookahead_t()), 0), + get_param(params, edge_weight)); +} + +template +void +brandes_betweenness_centrality(const Graph& g, CentralityMap centrality + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + typedef queue::vertex_descriptor> queue_t; + queue_t q; + + boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2( + g, centrality, dummy_property_map(), get(vertex_index, g), boost::ref(q), 0); +} + +template +void +brandes_betweenness_centrality(const Graph& g, CentralityMap centrality, + EdgeCentralityMap edge_centrality_map + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + typedef queue queue_t; + queue_t q; + + boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2( + g, centrality, edge_centrality_map, get(vertex_index, g), boost::ref(q), 0); +} + +template +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, + const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + Buffer sources) +{ + typedef typename property_traits::value_type distance_type; + typedef static_property_map WeightMap; + + detail::graph::brandes_unweighted_shortest_paths shortest_paths; + + graph::parallel::detail::non_distributed_brandes_betweenness_centrality_impl(pg, g, centrality, + edge_centrality_map, + incoming, distance, + dependency, path_count, + vertex_index, + shortest_paths, + sources); +} + +template +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, + const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + WeightMap weight_map, + Buffer sources) +{ + detail::graph::brandes_dijkstra_shortest_paths shortest_paths(weight_map); + + graph::parallel::detail::non_distributed_brandes_betweenness_centrality_impl(pg, g, centrality, + edge_centrality_map, + incoming, distance, + dependency, path_count, + vertex_index, + shortest_paths, + sources); +} + +namespace detail { namespace graph { + template + void + non_distributed_brandes_betweenness_centrality_dispatch2(const ProcessGroup& pg, + const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + WeightMap weight_map, + VertexIndexMap vertex_index, + Buffer sources) + { + typedef typename graph_traits::degree_size_type degree_size_type; + 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); + + non_distributed_brandes_betweenness_centrality( + pg, 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, unwrap_ref(sources)); + } + + + template + void + non_distributed_brandes_betweenness_centrality_dispatch2(const ProcessGroup& pg, + const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + VertexIndexMap vertex_index, + Buffer sources) + { + typedef typename graph_traits::degree_size_type degree_size_type; + 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); + + non_distributed_brandes_betweenness_centrality( + pg, 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, unwrap_ref(sources)); + } + + template + struct non_distributed_brandes_betweenness_centrality_dispatch1 + { + template + static void + run(const ProcessGroup& pg, const Graph& g, CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, + Buffer sources, WeightMap weight_map) + { + non_distributed_brandes_betweenness_centrality_dispatch2(pg, g, centrality, edge_centrality_map, + weight_map, vertex_index, sources); + } + }; + + template<> + struct non_distributed_brandes_betweenness_centrality_dispatch1 + { + template + static void + run(const ProcessGroup& pg, const Graph& g, CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, + Buffer sources, detail::error_property_not_found) + { + non_distributed_brandes_betweenness_centrality_dispatch2(pg, g, centrality, edge_centrality_map, + vertex_index, sources); + } + }; + +} } // end namespace detail::graph + +template +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Graph& g, + const bgl_named_params& params) +{ + typedef bgl_named_params named_params; + + typedef queue queue_t; + queue_t q; + + typedef typename property_value::type ew; + detail::graph::non_distributed_brandes_betweenness_centrality_dispatch1::run( + pg, 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), + choose_param(get_param(params, buffer_param_t()), boost::ref(q)), + get_param(params, edge_weight)); +} + +template +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Graph& g, + CentralityMap centrality) +{ + typedef queue queue_t; + queue_t q; + + detail::graph::non_distributed_brandes_betweenness_centrality_dispatch2( + pg, g, centrality, dummy_property_map(), get(vertex_index, g), boost::ref(q)); +} + +template +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Graph& g, + CentralityMap centrality, Buffer sources) +{ + detail::graph::non_distributed_brandes_betweenness_centrality_dispatch2( + pg, g, centrality, dummy_property_map(), get(vertex_index, g), sources); +} + +template +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + Buffer sources) +{ + detail::graph::non_distributed_brandes_betweenness_centrality_dispatch2( + pg, g, centrality, edge_centrality_map, get(vertex_index, g), sources); +} + +// Compute the central point dominance of a graph. +// TODO: Make sure central point dominance works in parallel case +template +typename property_traits::value_type +central_point_dominance(const Graph& g, CentralityMap centrality + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + using std::max; + + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename property_traits::value_type centrality_type; + typedef typename graph_traits::vertices_size_type vertices_size_type; + + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + process_group_type pg = boost::graph::parallel::process_group(g); + + vertices_size_type n = num_vertices(g); + + using boost::parallel::all_reduce; + n = all_reduce(pg, n, std::plus()); + + // 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)); + } + + // All reduce to get global max centrality + max_centrality = all_reduce(pg, max_centrality, boost::parallel::maximum()); + + // 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)); + } + + sum = all_reduce(pg, sum, std::plus()); + + return sum/(n-1); +} + +} // end namespace boost + +#endif // BOOST_GRAPH_PARALLEL_BRANDES_BETWEENNESS_CENTRALITY_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/boman_et_al_graph_coloring.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/boman_et_al_graph_coloring.hpp new file mode 100644 index 0000000000..c65f80fa61 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/boman_et_al_graph_coloring.hpp @@ -0,0 +1,372 @@ +// Copyright (C) 2005-2008 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_BOMAN_ET_AL_GRAPH_COLORING_HPP +#define BOOST_GRAPH_DISTRIBUTED_BOMAN_ET_AL_GRAPH_COLORING_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef PBGL_ACCOUNTING +# include +#endif // PBGL_ACCOUNTING + +namespace boost { namespace graph { namespace distributed { + +/************************************************************************** + * This source file implements the distributed graph coloring algorithm * + * by Boman et al in: * + * * + * Erik G. Boman, Doruk Bozdag, Umit Catalyurek, Assefaw H. Gebremedhin,* + * and Fredrik Manne. A Scalable Parallel Graph Coloring Algorithm for * + * Distributed Memory Computers. [unpublished preprint?] * + * * + **************************************************************************/ + +#ifdef PBGL_ACCOUNTING +struct boman_et_al_graph_coloring_stats_t +{ + /* The size of the blocks to step through (i.e., the parameter s). */ + std::size_t block_size; + + /* Total wall-clock time used by the algorithm.*/ + accounting::time_type execution_time; + + /* The number of conflicts that occurred during execution. */ + std::size_t conflicts; + + /* The number of supersteps. */ + std::size_t supersteps; + + /* The number of colors used. */ + std::size_t num_colors; + + template + void print(OutputStream& out) + { + out << "Problem = \"Coloring\"\n" + << "Algorithm = \"Boman et al\"\n" + << "Function = boman_et_al_graph_coloring\n" + << "(P) Block size = " << block_size << "\n" + << "Wall clock time = " << accounting::print_time(execution_time) + << "\nConflicts = " << conflicts << "\n" + << "Supersteps = " << supersteps << "\n" + << "(R) Colors = " << num_colors << "\n"; + } +}; + +static boman_et_al_graph_coloring_stats_t boman_et_al_graph_coloring_stats; +#endif + +namespace detail { + template + struct graph_coloring_reduce + { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template + T operator()(const Key&) const { return (std::numeric_limits::max)(); } + + template T operator()(const Key&, T, T y) const { return y; } + }; +} + +template +struct first_fit_color +{ + template + Color operator()(const std::vector& marked, T marked_true) + { + Color k = 0; + while (k < (Color)marked.size() && marked[k] == marked_true) + ++k; + return k; + } +}; + +template +typename property_traits::value_type +boman_et_al_graph_coloring + (const DistributedGraph& g, + ColorMap color, + typename graph_traits::vertices_size_type s, + ChooseColor choose_color, + VertexOrdering ordering, VertexIndexMap vertex_index) +{ + using namespace boost::graph::parallel; + using boost::parallel::all_reduce; + + typename property_map::const_type + owner = get(vertex_owner, g); + + typedef typename process_group_type::type + process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + typedef typename graph_traits::vertices_size_type + vertices_size_type; + typedef typename property_traits::value_type color_type; + typedef unsigned long long iterations_type; + typedef typename std::vector::iterator vertex_set_iterator; + typedef std::pair message_type; + +#ifdef PBGL_ACCOUNTING + boman_et_al_graph_coloring_stats.block_size = s; + boman_et_al_graph_coloring_stats.execution_time = accounting::get_time(); + boman_et_al_graph_coloring_stats.conflicts = 0; + boman_et_al_graph_coloring_stats.supersteps = 0; +#endif + + // Initialize color map + color_type no_color = (std::numeric_limits::max)(); + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) + put(color, v, no_color); + color.set_reduce(detail::graph_coloring_reduce()); + + // Determine if we'll be using synchronous or asynchronous communication. + typedef typename process_group_type::communication_category + communication_category; + static const bool asynchronous = + is_convertible::value; + process_group_type pg = process_group(g); + + // U_i <- V_i + std::vector vertices_to_color(vertices(g).first, vertices(g).second); + + iterations_type iter_num = 1, outer_iter_num = 1; + std::vector marked; + std::vector marked_conflicting(num_vertices(g), 0); + std::vector sent_to_processors; + + std::size_t rounds = vertices_to_color.size() / s + + (vertices_to_color.size() % s == 0? 0 : 1); + rounds = all_reduce(pg, rounds, boost::parallel::maximum()); + +#ifdef PBGL_GRAPH_COLORING_DEBUG + std::cerr << "Number of rounds = " << rounds << std::endl; +#endif + + while (rounds > 0) { + if (!vertices_to_color.empty()) { + // Set of conflicting vertices + std::vector conflicting_vertices; + + vertex_set_iterator first = vertices_to_color.begin(); + while (first != vertices_to_color.end()) { + // For each subset of size s (or smaller for the last subset) + vertex_set_iterator start = first; + for (vertices_size_type counter = s; + first != vertices_to_color.end() && counter > 0; + ++first, --counter) { + // This vertex hasn't been sent to anyone yet + sent_to_processors.assign(num_processes(pg), false); + sent_to_processors[process_id(pg)] = true; + + // Mark all of the colors that we see + BGL_FORALL_OUTEDGES_T(*first, e, g, DistributedGraph) { + color_type k = get(color, target(e, g)); + if (k != no_color) { + if (k >= (color_type)marked.size()) marked.resize(k + 1, 0); + marked[k] = iter_num; + } + } + + // Find a color for this vertex + put(color, *first, choose_color(marked, iter_num)); + +#ifdef PBGL_GRAPH_COLORING_DEBUG + std::cerr << "Chose color " << get(color, *first) << " for vertex " + << *first << std::endl; +#endif + + // Send this vertex's color to the owner of the edge target. + BGL_FORALL_OUTEDGES_T(*first, e, g, DistributedGraph) { + if (!sent_to_processors[get(owner, target(e, g))]) { + send(pg, get(owner, target(e, g)), 17, + message_type(source(e, g), get(color, source(e, g)))); + sent_to_processors[get(owner, target(e, g))] = true; + } + } + + ++iter_num; + } + + // Synchronize for non-immediate process groups. + if (!asynchronous) { + --rounds; + synchronize(pg); + } + + // Receive boundary colors from other processors + while (optional > stp = probe(pg)) { + assert(stp->second == 17); + message_type msg; + receive(pg, stp->first, stp->second, msg); + cache(color, msg.first, msg.second); +#ifdef PBGL_GRAPH_COLORING_DEBUG + std::cerr << "Cached color " << msg.second << " for vertex " + << msg.first << std::endl; +#endif + } + + // Compute the set of conflicting vertices + // [start, first) contains all vertices in this subset + for (vertex_set_iterator vi = start; vi != first; ++vi) { + Vertex v = *vi; + BGL_FORALL_OUTEDGES_T(v, e, g, DistributedGraph) { + Vertex w = target(e, g); + if (get(owner, w) != process_id(pg) // boundary vertex + && marked_conflicting[get(vertex_index, v)] != outer_iter_num + && get(color, v) == get(color, w) + && ordering(v, w)) { + conflicting_vertices.push_back(v); + marked_conflicting[get(vertex_index, v)] = outer_iter_num; + put(color, v, no_color); +#ifdef PBGL_GRAPH_COLORING_DEBUG + std::cerr << "Vertex " << v << " has a conflict with vertex " + << w << std::endl; +#endif + break; + } + } + } + +#ifdef PBGL_ACCOUNTING + boman_et_al_graph_coloring_stats.conflicts += + conflicting_vertices.size(); +#endif + } + + if (asynchronous) synchronize(pg); + else { + while (rounds > 0) { + synchronize(pg); + --rounds; + } + } + conflicting_vertices.swap(vertices_to_color); + ++outer_iter_num; + } else { + if (asynchronous) synchronize(pg); + else { + while (rounds > 0) { + synchronize(pg); + --rounds; + } + } + } + + // Receive boundary colors from other processors + while (optional > stp = probe(pg)) { + assert(stp->second == 17); + message_type msg; + receive(pg, stp->first, stp->second, msg); + cache(color, msg.first, msg.second); + } + + rounds = vertices_to_color.size() / s + + (vertices_to_color.size() % s == 0? 0 : 1); + rounds = all_reduce(pg, rounds, boost::parallel::maximum()); + +#ifdef PBGL_ACCOUNTING + ++boman_et_al_graph_coloring_stats.supersteps; +#endif + } + + // Determine the number of colors used. + color_type num_colors = 0; + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + color_type k = get(color, v); + assert(k != no_color); + if (k != no_color) { + if (k >= (color_type)marked.size()) marked.resize(k + 1, 0); // TBD: perf? + if (marked[k] != iter_num) { + marked[k] = iter_num; + ++num_colors; + } + } + } + + num_colors = + all_reduce(pg, num_colors, boost::parallel::maximum()); + + +#ifdef PBGL_ACCOUNTING + boman_et_al_graph_coloring_stats.execution_time = + accounting::get_time() - boman_et_al_graph_coloring_stats.execution_time; + + boman_et_al_graph_coloring_stats.conflicts = + all_reduce(pg, boman_et_al_graph_coloring_stats.conflicts, + std::plus()); + boman_et_al_graph_coloring_stats.num_colors = num_colors; +#endif + + return num_colors; +} + + +template +inline typename property_traits::value_type +boman_et_al_graph_coloring + (const DistributedGraph& g, ColorMap color, + typename graph_traits::vertices_size_type s, + ChooseColor choose_color, VertexOrdering ordering) +{ + return boman_et_al_graph_coloring(g, color, s, choose_color, ordering, + get(vertex_index, g)); +} + +template +inline typename property_traits::value_type +boman_et_al_graph_coloring + (const DistributedGraph& g, + ColorMap color, + typename graph_traits::vertices_size_type s, + ChooseColor choose_color) +{ + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + return boman_et_al_graph_coloring(g, color, s, choose_color, + std::less()); +} + +template +inline typename property_traits::value_type +boman_et_al_graph_coloring + (const DistributedGraph& g, + ColorMap color, + typename graph_traits::vertices_size_type s = 100) +{ + typedef typename property_traits::value_type Color; + return boman_et_al_graph_coloring(g, color, s, first_fit_color()); +} + +} } } // end namespace boost::graph::distributed + +namespace boost { namespace graph { +using distributed::boman_et_al_graph_coloring; +} } // end namespace boost::graph + +#endif // BOOST_GRAPH_DISTRIBUTED_BOMAN_ET_AL_GRAPH_COLORING_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/breadth_first_search.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/breadth_first_search.hpp new file mode 100644 index 0000000000..c987585f5f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/breadth_first_search.hpp @@ -0,0 +1,164 @@ +// Copyright 2004 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_BFS_HPP +#define BOOST_GRAPH_PARALLEL_BFS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + namespace detail { + /** @brief A unary predicate that decides when to push into a + * breadth-first search queue. + * + * This predicate stores a color map that is used to determine + * when to push. If it is provided with a key for which the color + * is white, it darkens the color to gray and returns true (so + * that the value will be pushed appropriately); if the color is + * not white, it returns false so that the vertex will be + * ignored. + */ + template + struct darken_and_push + { + typedef typename property_traits::key_type argument_type; + typedef bool result_type; + + explicit darken_and_push(const ColorMap& color) : color(color) { } + + bool operator()(const argument_type& value) const + { + typedef color_traits::value_type> + Color; + if (get(color, value) == Color::white()) { + put(color, value, Color::gray()); + return true; + } else { + return false; + } + } + + ColorMap color; + }; + + template + struct has_not_been_seen + { + typedef bool result_type; + + has_not_been_seen() { } + + has_not_been_seen(std::size_t n, IndexMap index_map) + : seen(n), index_map(index_map) {} + + template + result_type operator()(Key key) + { + bool result = seen[get(index_map, key)]; + seen[get(index_map, key)] = true; + return !result; + } + + void swap(has_not_been_seen& other) + { + using std::swap; + swap(seen, other.seen); + swap(index_map, other.index_map); + } + + private: + dynamic_bitset<> seen; + IndexMap index_map; + }; + + template + inline void + swap(has_not_been_seen& x, has_not_been_seen& y) + { + x.swap(y); + } + + template + inline void + parallel_bfs_helper + (DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + ColorMap color, + BFSVisitor vis, + BufferRef Q, + VertexIndexMap) + { + set_property_map_role(vertex_color, color); + color.set_consistency_model(0); + breadth_first_search(g, s, Q.ref, vis, color); + } + + template + void parallel_bfs_helper + (DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + ColorMap color, + BFSVisitor vis, + error_property_not_found, + VertexIndexMap vertex_index) + { + using boost::graph::parallel::process_group; + + typedef graph_traits Traits; + typedef typename Traits::vertex_descriptor Vertex; + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + + set_property_map_role(vertex_color, color); + color.set_consistency_model(0); + + // Buffer default + typedef typename property_map + ::const_type vertex_owner_map; + typedef boost::graph::distributed::distributed_queue< + process_group_type, vertex_owner_map, queue, + detail::darken_and_push > queue_t; + queue_t Q(process_group(g), + get(vertex_owner, g), + detail::darken_and_push(color)); + breadth_first_search(g, s, Q, vis, color); + } + + template + void bfs_helper + (DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + ColorMap color, + BFSVisitor vis, + const bgl_named_params& params, + BOOST_GRAPH_ENABLE_IF_MODELS(DistributedGraph, distributed_graph_tag, + void)*) + { + parallel_bfs_helper + (g, s, color, vis, get_param(params, buffer_param_t()), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index)); + } + } +} + +#endif // BOOST_GRAPH_PARALLEL_BFS_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/compressed_sparse_row_graph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/compressed_sparse_row_graph.hpp new file mode 100644 index 0000000000..edbf16785e --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/compressed_sparse_row_graph.hpp @@ -0,0 +1,2168 @@ +// Copyright (C) 2006 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 +// Jeremiah Willcock +// Andrew Lumsdaine + +// Distributed compressed sparse row graph type + +#ifndef BOOST_GRAPH_DISTRIBUTED_CSR_HPP +#define BOOST_GRAPH_DISTRIBUTED_CSR_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#define BOOST_GRAPH_USE_NEW_CSR_INTERFACE + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + +// Distributed and sequential inplace ctors have the same signature so +// we need a separate tag for distributed inplace ctors +enum distributed_construct_inplace_from_sources_and_targets_t + {distributed_construct_inplace_from_sources_and_targets}; + +// The number of bits we reserve for the processor ID. +// DPG TBD: This is a hack. It will eventually be a run-time quantity. +static const int processor_bits = 8; + +// Tag class for a distributed CSR graph +struct distributed_csr_tag + : public virtual distributed_graph_tag, + public virtual distributed_vertex_list_graph_tag, + public virtual distributed_edge_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag {}; + +template +class compressed_sparse_row_graph< + directedS, VertexProperty, EdgeProperty, GraphProperty, + distributedS, + InEdgeIndex> +{ + typedef compressed_sparse_row_graph self_type; + + private: + /** + * Determine the type used to represent vertices in the graph. If + * the user has overridden the default, use the user's + * parameter. Otherwise, fall back to std::size_t. + */ + typedef typename mpl::if_, + std::size_t, + InVertex>::type Vertex; + + /** + * Determine the type used to represent edges in the graph. If + * the user has overridden the default (which is to be the same as + * the distributed vertex selector type), use the user's + * parameter. Otherwise, fall back to the value of @c Vertex. + */ + typedef typename mpl::if_ >, + Vertex, + InEdgeIndex>::type EdgeIndex; + + public: + /** + * The type of the CSR graph that will be stored locally. + */ + typedef compressed_sparse_row_graph + base_type; + + // ----------------------------------------------------------------- + // Graph concept requirements + typedef Vertex vertex_descriptor; + typedef typename graph_traits::edge_descriptor edge_descriptor; + typedef directed_tag directed_category; + typedef allow_parallel_edge_tag edge_parallel_category; + typedef distributed_csr_tag traversal_category; + static vertex_descriptor null_vertex(); + + // ----------------------------------------------------------------- + // Distributed Vertex List Graph concept requirements + typedef Vertex vertices_size_type; + class vertex_iterator; + + // ----------------------------------------------------------------- + // Distributed Edge List Graph concept requirements + typedef EdgeIndex edges_size_type; + class edge_iterator; + + // ----------------------------------------------------------------- + // Incidence Graph concept requirements + typedef typename graph_traits::out_edge_iterator + out_edge_iterator; + typedef typename graph_traits::degree_size_type + degree_size_type; + + // ----------------------------------------------------------------- + // Adjacency Graph concept requirements + typedef typename graph_traits::adjacency_iterator + adjacency_iterator; + + // Note: This graph type does not model Bidirectional Graph. + // However, this typedef is required to satisfy graph_traits. + typedef void in_edge_iterator; + + // ----------------------------------------------------------------- + // Distributed Container concept requirements + typedef ProcessGroup process_group_type; + typedef boost::parallel::variant_distribution + distribution_type; + + // ----------------------------------------------------------------- + // Workarounds + typedef no_property vertex_property_type; + typedef no_property edge_property_type; + typedef typename mpl::if_, + void****, + VertexProperty>::type vertex_bundled; + typedef typename mpl::if_, + void****, + EdgeProperty>::type edge_bundled; + + // ----------------------------------------------------------------- + // Useful types + typedef typename ProcessGroup::process_id_type process_id_type; + + // ----------------------------------------------------------------- + // Graph constructors + compressed_sparse_row_graph(const ProcessGroup& pg = ProcessGroup()) + : m_process_group(pg), m_distribution(parallel::block(pg, 0)) {} + + compressed_sparse_row_graph(const GraphProperty& prop, + const ProcessGroup& pg = ProcessGroup()) + : m_process_group(pg), m_distribution(parallel::block(pg, 0)) {} + + compressed_sparse_row_graph(vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup()) + : m_process_group(pg), m_distribution(parallel::block(pg, 0)), + m_base(numverts) + {} + + compressed_sparse_row_graph(vertices_size_type numverts, + const GraphProperty& prop, + const ProcessGroup& pg = ProcessGroup()) + : m_process_group(pg), m_distribution(parallel::block(pg, 0)), + m_base(numverts) + {} + + template + compressed_sparse_row_graph(vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist) + : m_process_group(pg), m_distribution(dist), m_base(numverts) {} + + template + compressed_sparse_row_graph(vertices_size_type numverts, + const GraphProperty& prop, + const ProcessGroup& pg, + const Distribution& dist) + : m_process_group(pg), m_distribution(dist), m_base(numverts) {} + +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + + template + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + edges_size_type numedges = 0, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + edges_size_type numedges = 0, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector& sources, + std::vector& targets, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector& sources, + std::vector& targets, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector& sources, + std::vector& targets, + std::vector& edge_props, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector& sources, + std::vector& targets, + std::vector& edge_props, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + +#endif + + template + compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template + compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + base_type& base() { return m_base; } + const base_type& base() const { return m_base; } + + process_group_type process_group() const { return m_process_group.base(); } + + distribution_type& distribution() { return m_distribution; } + const distribution_type& distribution() const { return m_distribution; } + + // Directly access a vertex or edge bundle + vertex_bundled& operator[](vertex_descriptor v) + { + std::pair locator + = get(vertex_global, *this, v); + assert(locator.first == process_id(m_process_group)); + return base().m_vertex_properties[locator.second]; + } + + const vertex_bundled& operator[](vertex_descriptor v) const + { + std::pair locator + = get(vertex_global, *this, v); + assert(locator.first == process_id(m_process_group)); + return base().m_process_group[locator.second]; + } + + edge_bundled& operator[](edge_descriptor e) + { + assert(get(vertex_owner, *this, e.src) == process_id(m_process_group)); + return base().m_edge_properties[e.idx]; + } + + const edge_bundled& operator[](edge_descriptor e) const + { + assert(get(vertex_owner, *this, e.src) == process_id(m_process_group)); + return base().m_edge_properties[e.idx]; + } + + // Create a vertex descriptor from a process ID and a local index. + vertex_descriptor + make_vertex_descriptor(process_id_type p, vertex_descriptor v) const + { + vertex_descriptor vertex_local_index_bits = + sizeof(vertex_descriptor) * CHAR_BIT - processor_bits; + return v | ((vertex_descriptor)p << vertex_local_index_bits); + } + + // Convert a local vertex descriptor into a global vertex descriptor + vertex_descriptor local_to_global_vertex(vertex_descriptor v) const + { + return make_vertex_descriptor(process_id(m_process_group), v); + } + + // Structural modification + vertex_descriptor add_vertex() + { + typename graph_traits::vertex_descriptor v + = boost::add_vertex(m_base); + + return make_vertex_descriptor(process_id(m_process_group), v); + } + + vertex_descriptor add_vertex(const vertex_bundled& p) + { + typename graph_traits::vertex_descriptor v + = boost::add_vertex(m_base, p); + + return make_vertex_descriptor(process_id(m_process_group), v); + } + + vertex_descriptor add_vertices(vertices_size_type count) + { + typename graph_traits::vertex_descriptor v + = boost::add_vertices(count, m_base); + + return make_vertex_descriptor(process_id(m_process_group), v); + } + + template + void + add_edges(InputIterator first, InputIterator last) + { boost::add_edges_global(first, last, get(vertex_local, *this), m_base); } + + template + void + add_edges(InputIterator first, InputIterator last, + EdgePropertyIterator ep_iter, + EdgePropertyIterator ep_iter_end) + { boost::add_edges_global(first, last, ep_iter, ep_iter_end, + get(vertex_local, *this), m_base); } + + template + void + add_edges_sorted(InputIterator first, InputIterator last) + { boost::add_edges_sorted_global(first, last, + get(vertex_local, *this), m_base); } + + template + void + add_edges_sorted(InputIterator first_sorted, InputIterator last_sorted, + EdgePropertyIterator ep_iter_sorted) + { boost::add_edges_sorted_global(first_sorted, last_sorted, ep_iter_sorted, + get(vertex_local, *this), m_base); } + + protected: + ProcessGroup m_process_group; + distribution_type m_distribution; + base_type m_base; +}; + +/** @brief Helper macro containing the template parameters for the + * distributed CSR graph. + * + * This macro contains all of the template parameters needed for the + * distributed compressed_sparse_row graph type. It is used to reduce + * the amount of typing required to declare free functions for this + * graph type. + */ +#define BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS \ + typename VertexProperty, typename EdgeProperty, \ + typename GraphProperty, typename ProcessGroup, typename InVertex, \ + typename InDistribution, typename InEdgeIndex + +/** @brief Helper macro containing the typical instantiation of the + * distributed CSR graph. + * + * This macro contains an instantiation of the distributed CSR graph + * type using the typical template parameters names (e.g., those + * provided by the macro @c + * BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS). It is used to reduce + * the amount of typing required to declare free functions for this + * graph type. + */ +#define BOOST_DISTRIB_CSR_GRAPH_TYPE \ + compressed_sparse_row_graph< \ + directedS, VertexProperty, EdgeProperty, GraphProperty, \ + distributedS, \ + InEdgeIndex> + +// ----------------------------------------------------------------- +// Graph concept operations +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +BOOST_DISTRIB_CSR_GRAPH_TYPE::null_vertex() +{ + return graph_traits::null_vertex(); +} + +// ----------------------------------------------------------------- +// Incidence Graph concept operations +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +source(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor e, + const BOOST_DISTRIB_CSR_GRAPH_TYPE&) +{ return e.src; } + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +target(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor e, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return target(e, g.base()); } + +template +inline std::pair +out_edges(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor u, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type + edges_size_type; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor ed; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::out_edge_iterator it; + edges_size_type u_local = get(vertex_local, g, u); + edges_size_type u_row_start = g.base().m_forward.m_rowstart[u_local]; + edges_size_type next_row_start = g.base().m_forward.m_rowstart[u_local + 1]; + return std::make_pair(it(ed(u, u_row_start)), + it(ed(u, (std::max)(u_row_start, next_row_start)))); +} + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::degree_size_type +out_degree(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor u, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return out_degree(get(vertex_local, g, u), g.base()); +} + +// ----------------------------------------------------------------- +// DistributedGraph concept requirements +template +void synchronize(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE graph_type; + synchronize(g.process_group()); +} + +template +ProcessGroup +process_group(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.process_group(); } + + +// ----------------------------------------------------------------- +// Adjacency Graph concept requirements +template +inline std::pair +adjacent_vertices(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor u, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return adjacent_vertices(get(vertex_local, g, u), g.base()); +} + +// ----------------------------------------------------------------- +// Distributed Vertex List Graph concept operations +template +class BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_iterator + : public iterator_adaptor, + Vertex, + random_access_traversal_tag, + Vertex> +{ + typedef iterator_adaptor, + Vertex, + random_access_traversal_tag, + Vertex> inherited; + public: + vertex_iterator() {} + + explicit vertex_iterator(Vertex v, const self_type* graph) + : inherited(counting_iterator(v)), graph(graph) { } + + Vertex dereference() const + { + return graph->local_to_global_vertex(*(this->base_reference())); + } + + friend class iterator_core_access; + + private: + const self_type* graph; +}; + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::degree_size_type +num_vertices(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return num_vertices(g.base()); +} + +template +inline std::pair +vertices(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_iterator + vertex_iterator; + return std::make_pair(vertex_iterator(0, &g), + vertex_iterator(num_vertices(g), &g)); +} + +// ----------------------------------------------------------------- +// Distributed Edge List Graph concept operations +template +class BOOST_DISTRIB_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() : graph(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) + : graph(&graph), local_src(current_edge.src), current_edge(current_edge), + end_of_this_vertex(end_of_this_vertex) + { + // The edge that comes in has a local source vertex. Make it global. + current_edge.src = graph.local_to_global_vertex(current_edge.src); + } + + // 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 && local_src < num_vertices(*graph)-1) { + ++local_src; + current_edge.src = graph->local_to_global_vertex(local_src); + end_of_this_vertex = graph->base().m_forward.m_rowstart[local_src + 1]; + } + return *this; + } + + edge_iterator operator++(int) { + edge_iterator temp = *this; + ++*this; + return temp; + } + + private: + const compressed_sparse_row_graph* graph; + EdgeIndex local_src; + edge_descriptor current_edge; + EdgeIndex end_of_this_vertex; +}; + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type +num_edges(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return g.base().m_forward.m_column.size(); +} + +template +std::pair +edges(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor Vertex; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_iterator ei; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor edgedesc; + if (g.base().m_forward.m_rowstart.size() == 1 || + g.base().m_forward.m_column.empty()) { + return std::make_pair(ei(), ei()); + } else { + // Find the first vertex that has outgoing edges + Vertex src = 0; + while (g.base().m_forward.m_rowstart[src + 1] == 0) ++src; + return std::make_pair(ei(g, edgedesc(src, 0), g.base().m_forward.m_rowstart[src + 1]), + ei(g, edgedesc(num_vertices(g), g.base().m_forward.m_column.size()), 0)); + } +} + +// ----------------------------------------------------------------- +// Graph constructors + +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE +// Returns true if a vertex belongs to a process according to a distribution +template +struct local_vertex { + + local_vertex(OwnerMap owner, ProcessId id) + : owner(owner), id(id) {} + + template + bool operator()(Vertex x) + { return get(owner, x) == id; } + + template + bool operator()(Vertex x) const + { return get(owner, x) == id; } + +private: + OwnerMap owner; + ProcessId id; +}; + +// Returns true if a vertex belongs to a process according to a distribution +template +struct local_edge { + + local_edge(OwnerMap owner, ProcessId id) + : owner(owner), id(id) {} + + template + bool operator()(std::pair& x) + { return get(owner, x.first) == id; } + + template + bool operator()(const std::pair& x) const + { return get(owner, x.first) == id; } + +private: + OwnerMap owner; + ProcessId id; +}; + +// Turns an index iterator into a vertex iterator +template +class index_to_vertex_iterator { + +public: + typedef std::input_iterator_tag iterator_category; + typedef typename graph_traits::vertex_descriptor Vertex; + typedef std::pair value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + index_to_vertex_iterator(IndexIterator index, + const Graph& g) + : index(index), g(g), current(to_edge(*index)) {} + + reference operator*() { current = to_edge(*index); return current; } + pointer operator->() { current = to_edge(*index); return ¤t; } + + index_to_vertex_iterator& operator++() + { + ++index; + return *this; + } + + index_to_vertex_iterator operator++(int) + { + index_to_vertex_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const index_to_vertex_iterator& other) const + { return index == other.index; } + + bool operator!=(const index_to_vertex_iterator& other) const + { return !(*this == other); } + +private: + value_type to_edge(const typename std::iterator_traits::value_type& x) + { return std::make_pair(vertex(x.first, g), vertex(x.second, g)); } + + IndexIterator index; + const Graph& g; + value_type current; +}; + +template +struct index_to_vertex_func { + + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef typename boost::graph_traits::vertices_size_type vertices_size_type; + typedef std::pair result_type; + typedef std::pair base_iterator_type; + + index_to_vertex_func(const Distribution& dist, const Graph& g) + : dist(dist), g(g) {} + + + result_type operator()(const base_iterator_type& p) const + { + return std::make_pair(vertex(p.first, g), vertex(p.second, g)); + } + +private: + const Distribution& dist; + const Graph& g; +}; + +// NGE: This method only works with iterators that have a difference_type, +// the index_to_vertex_iterator class above is retained for compatibility +// with BGL generators which have no difference_type +template +boost::transform_iterator, IndexIterator> +make_index_to_vertex_iterator(IndexIterator it, const Distribution& dist, + const Graph& g) { + return boost::make_transform_iterator( + it, index_to_vertex_func(dist, g)); +} +#endif + +// Forward declaration of csr_vertex_owner_map +template class csr_vertex_owner_map; + +#ifdef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + ep_iter, + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + ep_iter, + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + edges_size_type numedges, // This is not used as there is no appropriate BGL ctor + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_sorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + m_distribution.block_size(process_id(m_process_group), numverts), + prop) +{ } + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_sorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + m_distribution.block_size(process_id(m_process_group), numverts), + prop) +{ } + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + edges_size_type numedges, // This is not used as there is no appropriate BGL ctor + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_sorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + ep_iter, + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + m_distribution.block_size(process_id(m_process_group), numverts), + prop) +{ } + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_sorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + ep_iter, + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + m_distribution.block_size(process_id(m_process_group), numverts), + prop) +{ } + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_unsorted_multi_pass_global, + make_index_to_vertex_iterator(edge_begin, parallel::block(m_process_group, numverts), *this), + make_index_to_vertex_iterator(edge_end, parallel::block(m_process_group, numverts), *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_unsorted_multi_pass_global, + make_index_to_vertex_iterator(edge_begin, parallel::block(m_process_group, numverts), *this), + make_index_to_vertex_iterator(edge_end, parallel::block(m_process_group, numverts), *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_unsorted_multi_pass_global, + make_index_to_vertex_iterator(edge_begin, parallel::block(m_process_group, numverts), *this), + make_index_to_vertex_iterator(edge_end, parallel::block(m_process_group, numverts), *this), + ep_iter, + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_unsorted_multi_pass_global, + make_index_to_vertex_iterator(edge_begin, parallel::block(m_process_group, numverts), *this), + make_index_to_vertex_iterator(edge_end, parallel::block(m_process_group, numverts), *this), + ep_iter, + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector& sources, + std::vector& targets, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(m_distribution.block_size(process_id(m_process_group), numverts)) +{ + // Convert linear indices to global indices + for (edges_size_type i = 0; i < sources.size(); ++i) { + sources[i] = m_distribution.local(sources[i]); + targets[i] = make_vertex_descriptor(m_distribution(targets[i]), + m_distribution.local(targets[i])); + } + + m_base.assign_sources_and_targets_global( + sources, targets, m_distribution.block_size(process_id(m_process_group), numverts), + identity_property_map()); + + // TODO: set property on m_base? +} + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector& sources, + std::vector& targets, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(m_distribution.block_size(process_id(m_process_group), numverts)) +{ + // Convert linear indices to global indices + for (edges_size_type i = 0; i < sources.size(); ++i) { + sources[i] = m_distribution.local(sources[i]); + targets[i] = make_vertex_descriptor(m_distribution(targets[i]), + m_distribution.local(targets[i])); + } + + m_base.assign_sources_and_targets_global( + sources, targets, m_distribution.block_size(process_id(m_process_group), numverts), + identity_property_map()); + + // TODO: set property on m_base? +} + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector& sources, + std::vector& targets, + std::vector& edge_props, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(m_distribution.block_size(process_id(m_process_group), numverts)) +{ + // Convert linear indices to global indices + for (edges_size_type i = 0; i < sources.size(); ++i) { + sources[i] = m_distribution.local(sources[i]); + targets[i] = make_vertex_descriptor(m_distribution(targets[i]), + m_distribution.local(targets[i])); + } + + m_base.assign_sources_and_targets_global( + sources, targets, edge_props, + m_distribution.block_size(process_id(m_process_group), numverts), + identity_property_map()); + + // TODO: set property on m_base? +} + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector& sources, + std::vector& targets, + std::vector& edge_props, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(m_distribution.block_size(process_id(m_process_group), numverts)) +{ + // Convert linear indices to global indices + for (edges_size_type i = 0; i < sources.size(); ++i) { + sources[i] = m_distribution.local(sources[i]); + targets[i] = make_vertex_descriptor(m_distribution(targets[i]), + m_distribution.local(targets[i])); + } + + m_base.assign_sources_and_targets_global( + sources, targets, edge_props, + m_distribution.block_size(process_id(m_process_group), numverts), + identity_property_map()); + + // TODO: set property on m_base? +} + +#endif + +// +// Old (untagged) ctors, these default to the unsorted sequential ctors +// +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), +#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + m_base(m_distribution.block_size(process_id(m_process_group), numverts)) +#else + m_base(edges_are_unsorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +#endif + +{ +#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + parallel::block dist(m_process_group, numverts); + + // Allows us to add edges + m_base.m_last_source = 0; + + typename ProcessGroup::process_id_type id = process_id(m_process_group); + + while (edge_begin != edge_end) { + vertex_descriptor src = edge_begin->first; + if (static_cast(dist(src)) == id) { + vertex_descriptor tgt = + make_vertex_descriptor(dist(edge_begin->second), + dist.local(edge_begin->second)); + add_edge(dist.local(src), tgt, m_base); + } + ++edge_begin; + } +#endif +} + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + + m_distribution(parallel::block(m_process_group, numverts)), +#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + m_base(m_distribution.block_size(process_id(m_process_group), numverts)) +#else + m_base(edges_are_unsorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + ep_iter, + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +#endif +{ +#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + parallel::block dist(m_process_group, numverts); + + // Allows us to add edges + m_base.m_last_source = 0; + + typename ProcessGroup::process_id_type id = process_id(m_process_group); + + while (edge_begin != edge_end) { + EdgeIndex src = edge_begin->first; + if (static_cast(dist(src)) == id) { + EdgeIndex tgt = + make_vertex_descriptor(dist(edge_begin->second), + dist.local(edge_begin->second)); + add_edge(dist.local(src), tgt, *ep_iter, m_base); + } + ++edge_begin; + ++ep_iter; + } +#endif +} + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), +#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + m_base(dist.block_size(process_id(m_process_group), numverts)) +#else + m_base(edges_are_unsorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +#endif +{ +#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + // Allows us to add edges + m_base.m_last_source = 0; + + typename ProcessGroup::process_id_type id = process_id(m_process_group); + + while (edge_begin != edge_end) { + vertex_descriptor src = edge_begin->first; + if (static_cast(dist(src)) == id) { + vertex_descriptor tgt = + make_vertex_descriptor(dist(edge_begin->second), + dist.local(edge_begin->second)); + assert(get(vertex_owner, *this, tgt) == dist(edge_begin->second)); + assert(get(vertex_local, *this, tgt) == dist.local(edge_begin->second)); + add_edge(dist.local(src), tgt, m_base); + } + ++edge_begin; + } +#endif +} + +template +template +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), +#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + m_base(dist.block_size(process_id(m_process_group), numverts)) +#else + m_base(edges_are_unsorted_global, + index_to_vertex_iterator(edge_begin, *this), + index_to_vertex_iterator(edge_end, *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +#endif +{ +#ifndef BOOST_GRAPH_USE_NEW_CSR_INTERFACE + // Allows us to add edges + m_base.m_last_source = 0; + + typename ProcessGroup::process_id_type id = process_id(m_process_group); + + while (edge_begin != edge_end) { + EdgeIndex src = edge_begin->first; + if (static_cast(dist(src)) == id) { + EdgeIndex tgt = + make_vertex_descriptor(dist(edge_begin->second), + dist.local(edge_begin->second)); + add_edge(dist.local(src), tgt, *ep_iter, m_base); + } + ++edge_begin; + ++ep_iter; + } +#endif +} + +// ----------------------------------------------------------------- +// Vertex Global Property Map +template +class csr_vertex_global_map +{ + public: + // ----------------------------------------------------------------- + // Readable Property Map concept requirements + typedef std::pair value_type; + typedef value_type reference; + typedef Key key_type; + typedef readable_property_map_tag category; +}; + +template +inline std::pair +get(csr_vertex_global_map, + typename csr_vertex_global_map::key_type k) +{ + const int local_index_bits = sizeof(Key) * CHAR_BIT - processor_bits; + const Key local_index_mask = Key(-1) >> processor_bits; + + return std::pair(k >> local_index_bits, + k & local_index_mask); +} + +template +class property_map +{ + public: + typedef csr_vertex_global_map< + typename ProcessGroup::process_id_type, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor> type; + typedef type const_type; +}; + +template +inline +typename property_map::type +get(vertex_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::type result_type; + return result_type(); +} + +template +inline +std::pair +get(vertex_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_global, + const_cast(g), + k); +} + +template +inline +typename property_map::const_type +get(vertex_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::const_type result_type; + return result_type(); +} + +template +inline +std::pair +get(vertex_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor + vertex_descriptor; + typedef std::pair + result_type; + const int local_index_bits = + sizeof(vertex_descriptor) * CHAR_BIT - processor_bits; + const vertex_descriptor local_index_mask = + vertex_descriptor(-1) >> processor_bits; + + return result_type(k >> local_index_bits, k & local_index_mask); +} + +// ----------------------------------------------------------------- +// Extra, common functions +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +vertex(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type i, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return g.make_vertex_descriptor(g.distribution()(i), + g.distribution().local(i)); +} + +// Unlike for an adjacency_matrix, edge_range and edge take lg(out_degree(i)) +// time +template +inline std::pair +edge_range(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor i, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor j, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor Vertex; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type EdgeIndex; + typedef typename std::vector::const_iterator adj_iter; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::out_edge_iterator out_edge_iter; + typedef typename BOOST_DISTRIB_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.base().m_forward.m_column.begin(); + EdgeIndex idx_end = adjacencies.second - g.base().m_forward.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(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor i, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor j, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_DISTRIB_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_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor(), + false); + else + return std::make_pair(*range.first, true); +} + +// A helper that turns requests for property maps for const graphs +// into property maps for non-const graphs. +template +class property_map +{ + public: + typedef typename property_map + ::const_type type; + typedef type const_type; +}; + +// ----------------------------------------------------------------- +// Structural modifiers + +#if 0 +template +typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +add_vertex(BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.add_vertex(); } + +template +typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +add_vertex(const typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_bundled& p, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.add_vertex(p); } + +template +typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +add_vertices(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type count, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.add_vertices(count); } + +template +void +add_edges(InputIterator first, InputIterator last, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ g.add_edges(first, last); } + +template +void +add_edges(InputIterator first, InputIterator last, + EdgePropertyIterator ep_iter, + EdgePropertyIterator ep_iter_end, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.add_edges(first, last, ep_iter, ep_iter_end); } + +template +void +add_edges_sorted(InputIterator first, InputIterator last, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.add_edges_sorted(first, last); } + +template +void +add_edges_sorted(InputIterator first_sorted, InputIterator last_sorted, + EdgePropertyIterator ep_iter_sorted, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ g.add_edges_sorted(first_sorted, last_sorted, ep_iter_sorted); } +#endif + +// ----------------------------------------------------------------- +// Vertex Owner Property Map +template +class csr_vertex_owner_map +{ + public: + // ----------------------------------------------------------------- + // Readable Property Map concept requirements + typedef ProcessID value_type; + typedef value_type reference; + typedef Key key_type; + typedef readable_property_map_tag category; +}; + +template +inline ProcessID +get(csr_vertex_owner_map pm, + typename csr_vertex_owner_map::key_type k) +{ + const int local_index_bits = sizeof(Key) * CHAR_BIT - processor_bits; + return k >> local_index_bits; +} + +template +class property_map +{ + public: + typedef csr_vertex_owner_map< + typename ProcessGroup::process_id_type, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor> type; + typedef type const_type; +}; + +template +inline +typename property_map::type +get(vertex_owner_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::type result_type; + return result_type(); +} + +template +inline typename ProcessGroup::process_id_type +get(vertex_owner_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_owner, + const_cast(g), + k); +} + +template +inline +typename property_map::const_type +get(vertex_owner_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::const_type result_type; + return result_type(); +} + +template +inline typename ProcessGroup::process_id_type +get(vertex_owner_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor + vertex_descriptor; + const int local_index_bits = + sizeof(vertex_descriptor) * CHAR_BIT - processor_bits; + return k >> local_index_bits; +} + +// ----------------------------------------------------------------- +// Vertex Local Property Map +template +class csr_vertex_local_map +{ + public: + // ----------------------------------------------------------------- + // Readable Property Map concept requirements + typedef Key value_type; + typedef value_type reference; + typedef Key key_type; + typedef readable_property_map_tag category; +}; + +template +inline Key +get(csr_vertex_local_map pm, + typename csr_vertex_local_map::key_type k) +{ + const Key local_index_mask = Key(-1) >> processor_bits; + return k & local_index_mask; +} + +template +class property_map +{ + public: + typedef csr_vertex_local_map< + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor> type; + typedef type const_type; +}; + +template +inline +typename property_map::type +get(vertex_local_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::type result_type; + return result_type(); +} + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +get(vertex_local_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_local, + const_cast(g), + k); +} + +template +inline +typename property_map::const_type +get(vertex_local_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::const_type result_type; + return result_type(); +} + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +get(vertex_local_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor + vertex_descriptor; + const vertex_descriptor local_index_mask = + vertex_descriptor(-1) >> processor_bits; + return k & local_index_mask; +} + +// ----------------------------------------------------------------- +// Vertex Index Property Map +template +class property_map +{ + typedef typename property_map::const_type + global_map; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::process_group_type + process_group_type; + + typedef property_map local; + +public: + typedef local_property_map type; + typedef local_property_map const_type; +}; + +template +inline +typename property_map::type +get(vertex_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::type result_type; + + return result_type(g.process_group(), get(vertex_global, g), + get(vertex_local, g)); +} + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type +get(vertex_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_local, g, k); +} + +template +inline +typename property_map::const_type +get(vertex_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::const_type result_type; + return result_type(g.process_group(), get(vertex_global, g), + get(vertex_local, g)); +} + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type +get(vertex_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_local, g, k); +} + +// ----------------------------------------------------------------- +// Vertex Local Index Property Map +template +class property_map + : public property_map { }; + +template +inline +typename property_map::type +get(vertex_local_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return get(vertex_local, g); +} + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type +get(vertex_local_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_local, g, k); +} + +template +inline +typename property_map::const_type +get(vertex_local_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return get(vertex_local, g); +} + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type +get(vertex_local_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_local, g, k); +} + +// ----------------------------------------------------------------- +// Edge Global Property Map +template +class csr_edge_global_map +{ + public: + // ----------------------------------------------------------------- + // Readable Property Map concept requirements + typedef std::pair value_type; + typedef value_type reference; + typedef detail::csr_edge_descriptor key_type; + typedef readable_property_map_tag category; +}; + +template +inline std::pair +get(csr_edge_global_map pm, + typename csr_edge_global_map::key_type k) +{ + const int local_index_bits = sizeof(Vertex) * CHAR_BIT - processor_bits; + return std::pair(k.src >> local_index_bits, k.idx); +} + +template +class property_map +{ + public: + typedef csr_edge_global_map< + typename ProcessGroup::process_id_type, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type> type; + typedef type const_type; +}; + +template +inline +typename property_map::type +get(edge_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::type result_type; + return result_type(); +} + +template +inline +std::pair +get(edge_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) +{ + return get(edge_global, + const_cast(g), + k); +} + +template +inline +typename property_map::const_type +get(edge_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::const_type result_type; + return result_type(); +} + +template +inline +std::pair +get(edge_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor + vertex_descriptor; + + const int local_index_bits = + sizeof(vertex_descriptor) * CHAR_BIT - processor_bits; + + typedef std::pair + result_type; + + return result_type(k.src >> local_index_bits, k.idx); +} + +// ----------------------------------------------------------------- +// Edge Index Property Map +template +class property_map +{ + typedef typename property_map + ::type global_map; + + public: + typedef local_property_map< + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::process_group_type, + global_map, + identity_property_map> type; + typedef type const_type; +}; + +template +inline +typename property_map::type +get(edge_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::type result_type; + return result_type(g.process_group(), get(edge_global, g), + identity_property_map()); +} + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type +get(edge_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) +{ + return k.idx; +} + +template +inline +typename property_map::const_type +get(edge_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map + ::const_type result_type; + return result_type(g.process_group(), get(edge_global, g), + identity_property_map()); +} + +template +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type +get(edge_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) +{ + return k.idx; +} + +// ----------------------------------------------------------------- +// Bundled Properties +template +class property_map +{ + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; + typedef typename Graph::process_group_type process_group_type; + + // Determine which locator map to use (vertex or edge) + typedef typename mpl::if_, + vertex_global_t, edge_global_t>::type global_t; + + // Extract the global property map for our key type. + typedef typename property_map::const_type global_map; + typedef typename property_traits::value_type locator; + + // Determine which bundle type we are using + typedef typename mpl::if_, + VertexProperty, EdgeProperty>::type bundle_t; + +public: + // Build the local property map + typedef bundle_property_map, + typename locator::second_type, + bundle_t, + T> local_pmap; + + // Build the local const property map + typedef bundle_property_map, + typename locator::second_type, + bundle_t, + const T> local_const_pmap; + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_pmap> type; + + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_const_pmap> const_type; +}; + +namespace detail { + // Retrieve the local bundle_property_map corresponding to a + // non-const vertex property. + template + inline bundle_property_map, + typename Graph::vertex_descriptor, + typename Graph::vertex_bundled, T> + get_distrib_csr_bundle(T Bundle::* p, Graph& g, mpl::true_) + { + typedef bundle_property_map, + typename Graph::vertex_descriptor, + typename Graph::vertex_bundled, T> result_type; + return result_type(&g.base().vertex_properties().m_vertex_properties, p); + } + + // Retrieve the local bundle_property_map corresponding to a + // const vertex property. + template + inline bundle_property_map, + typename Graph::vertex_descriptor, + typename Graph::vertex_bundled, const T> + get_distrib_csr_bundle(T Bundle::* p, const Graph& g, mpl::true_) + { + typedef bundle_property_map< + const std::vector, + typename Graph::vertex_descriptor, + typename Graph::vertex_bundled, const T> result_type; + return result_type(&g.base().vertex_properties().m_vertex_properties, p); + } + + // Retrieve the local bundle_property_map corresponding to a + // non-const edge property. + template + inline bundle_property_map, + typename Graph::edges_size_type, + typename Graph::edge_bundled, T> + get_distrib_csr_bundle(T Bundle::* p, Graph& g, mpl::false_) + { + typedef bundle_property_map, + typename Graph::edges_size_type, + typename Graph::edge_bundled, T> result_type; + return result_type(&g.base().edge_properties().m_edge_properties, p); + } + + // Retrieve the local bundle_property_map corresponding to a + // const edge property. + template + inline bundle_property_map, + typename Graph::edges_size_type, + typename Graph::edge_bundled, const T> + get_distrib_csr_bundle(T Bundle::* p, const Graph& g, mpl::false_) + { + typedef bundle_property_map< + const std::vector, + typename Graph::edges_size_type, + typename Graph::edge_bundled, const T> result_type; + return result_type(&g.base().edge_properties().m_edge_properties, p); + } +} + +template +typename property_map::type +get(T Bundle::* p, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; + typedef typename property_map::type result_type; + typedef typename property_map::local_pmap local_pmap; + + // Resolver + typedef typename property_traits::value_type value_type; + typedef typename property_reduce::template apply + reduce; + + typedef typename property_traits::key_type descriptor; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + detail::get_distrib_csr_bundle + (p, g, mpl::bool_::value>()), + reduce()); +} + +template +typename property_map::const_type +get(T Bundle::* p, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; + typedef typename property_map::const_type result_type; + typedef typename property_map::local_const_pmap + local_pmap; + + // Resolver + typedef typename property_traits::value_type value_type; + typedef typename property_reduce::template apply + reduce; + + typedef typename property_traits::key_type descriptor; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + detail::get_distrib_csr_bundle + (p, g, mpl::bool_::value>()), + reduce()); +} + +namespace mpi { + template + struct is_mpi_datatype > + : mpl::true_ { }; +} + +namespace serialization { + template + struct is_bitwise_serializable > + : mpl::true_ { }; + + template + struct implementation_level > + : mpl::int_ {} ; + + template + struct tracking_level > + : mpl::int_ {} ; + +} + +} // end namespace boost + +#endif // BOOST_GRAPH_DISTRIBUTED_CSR_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/concepts.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/concepts.hpp new file mode 100644 index 0000000000..ae1a6951c8 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/concepts.hpp @@ -0,0 +1,216 @@ +// Copyright (C) 2004-2006 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 + +// +// Distributed graph concepts and helpers +// + +#ifndef BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP +#define BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include + +#if BOOST_VERSION >= 103500 +# include +#endif + +namespace boost { + +class distributed_graph_tag { }; +class distributed_vertex_list_graph_tag { }; +class distributed_edge_list_graph_tag { }; + +#if BOOST_VERSION >= 103500 + namespace concepts { +#endif + +#if BOOST_VERSION < 103500 + +template +struct DistributedVertexListGraphConcept +{ + 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; + void constraints() { + function_requires< GraphConcept >(); + function_requires< MultiPassInputIteratorConcept >(); + function_requires< ConvertibleConcept >(); + +#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; +}; + +template +struct DistributedEdgeListGraphConcept +{ + 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; + void constraints() { + function_requires< GraphConcept >(); + function_requires< MultiPassInputIteratorConcept >(); + function_requires< DefaultConstructibleConcept >(); + function_requires< EqualityComparableConcept >(); + function_requires< AssignableConcept >(); + function_requires< ConvertibleConcept >(); + + 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; +}; +#else + BOOST_concept(DistributedVertexListGraph,(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; + ~DistributedVertexListGraph() { + 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(DistributedEdgeListGraph,(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; + ~DistributedEdgeListGraph() { + 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; + }; +#endif + +#if BOOST_VERSION >= 103500 + } // end namespace concepts + + using concepts::DistributedVertexListGraphConcept; + using concepts::DistributedEdgeListGraphConcept; +#endif +} // end namespace boost + +#if BOOST_VERSION >= 103500 +# include +#endif + +#endif // BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/connected_components.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/connected_components.hpp new file mode 100644 index 0000000000..f62e29a26f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/connected_components.hpp @@ -0,0 +1,766 @@ +// Copyright (C) 2004-2006 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: Nick Edmonds +// Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_CC_HPP +#define BOOST_GRAPH_PARALLEL_CC_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PBGL_IN_PLACE_MERGE /* In place merge instead of sorting */ +//#define PBGL_SORT_ASSERT /* Assert sorted for in place merge */ + +/* Explicit sychronization in pointer doubling step? */ +#define PBGL_EXPLICIT_SYNCH +//#define PBGL_CONSTRUCT_METAGRAPH +#ifdef PBGL_CONSTRUCT_METAGRAPH +# define MAX_VERTICES_IN_METAGRAPH 10000 +#endif + +namespace boost { namespace graph { namespace distributed { + namespace cc_detail { + enum connected_components_message { + edges_msg, req_parents_msg, parents_msg, root_adj_msg + }; + + template + struct metaVertex { + metaVertex() {} + metaVertex(const Vertex& v) : name(v) {} + + template + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & name; + } + + Vertex name; + }; + +#ifdef PBGL_CONSTRUCT_METAGRAPH + // Build meta-graph on result of local connected components + template + void + build_local_metagraph(const Graph& g, ParentMap p, RootIterator r, + RootIterator r_end, AdjacencyMap& adj) + { + // TODO: Static assert that AdjacencyMap::value_type is std::vector + + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + BOOST_STATIC_ASSERT((is_same >::value)); + + using boost::graph::parallel::process_group; + + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + + if (id != 0) { + + // Send component roots and their associated edges to P0 + for ( ; r != r_end; ++r ) { + std::vector adjs(1, *r); // Root + adjs.reserve(adjs.size() + adj[*r].size()); + for (typename std::vector::iterator iter = adj[*r].begin(); + iter != adj[*r].end(); ++iter) + adjs.push_back(get(p, *iter)); // Adjacencies + + send(pg, 0, root_adj_msg, adjs); + } + } + + synchronize(pg); + + if (id == 0) { + typedef metaVertex VertexProperties; + + typedef boost::adjacency_list metaGraph; + typedef typename graph_traits::vertex_descriptor + meta_vertex_descriptor; + + std::map vertex_map; + std::vector > edges; + + // Receive remote roots and edges + while (optional > m = probe(pg)) { + assert(m->second == root_adj_msg); + + std::vector adjs; + receive(pg, m->first, m->second, adjs); + + vertex_map[adjs[0]] = graph_traits::null_vertex(); + for (typename std::vector::iterator iter + = ++adjs.begin(); iter != adjs.end(); ++iter) + edges.push_back(std::make_pair(adjs[0], *iter)); + } + + // Add local roots and edges + for ( ; r != r_end; ++r ) { + vertex_map[*r] = graph_traits::null_vertex(); + edges.reserve(edges.size() + adj[*r].size()); + for (typename std::vector::iterator iter = adj[*r].begin(); + iter != adj[*r].end(); ++iter) + edges.push_back(std::make_pair(*r, get(p, *iter))); + } + + // Build local meta-graph + metaGraph mg; + + // Add vertices with property to map back to distributed graph vertex + for (typename std::map::iterator + iter = vertex_map.begin(); iter != vertex_map.end(); ++iter) + vertex_map[iter->first] + = add_vertex(metaVertex(iter->first), mg); + + // Build meta-vertex map + typename property_map::type + metaVertexMap = get(&VertexProperties::name, mg); + + typename std::vector > + ::iterator edge_iter = edges.begin(); + for ( ; edge_iter != edges.end(); ++edge_iter) + add_edge(vertex_map[edge_iter->first], vertex_map[edge_iter->second], mg); + + edges.clear(); + + // Call connected_components on it + typedef typename property_map::type + meta_index_map_type; + meta_index_map_type meta_index = get(vertex_index, mg); + + std::vector mg_component_vec(num_vertices(mg)); + typedef iterator_property_map::iterator, + meta_index_map_type> + meta_components_map_type; + meta_components_map_type mg_component(mg_component_vec.begin(), + meta_index); + std::size_t num_comp = connected_components(mg, mg_component); + + // Update Parent pointers + std::vector roots(num_comp, graph_traits::null_vertex()); + + BGL_FORALL_VERTICES_T(v, mg, metaGraph) { + size_t component = get(mg_component, v); + if (roots[component] == graph_traits::null_vertex() || + get(meta_index, v) < get(meta_index, roots[component])) + roots[component] = v; + } + + // Set all the local parent pointers + BGL_FORALL_VERTICES_T(v, mg, metaGraph) { + // Problem in value being put (3rd parameter) + put(p, get(metaVertexMap, v), get(metaVertexMap, roots[get(mg_component, v)])); + } + } + + synchronize(p); + } +#endif + + /* Function object used to remove internal vertices and vertices > + the current vertex from the adjacent vertex lists at each + root */ + template + class cull_adjacency_list + { + public: + cull_adjacency_list(const Vertex v, const ParentMap p) : v(v), p(p) {} + bool operator() (const Vertex x) { return (get(p, x) == v || x == v); } + + private: + const Vertex v; + const ParentMap p; + }; + + /* Comparison operator used to choose targets for hooking s.t. vertices + that are hooked to are evenly distributed across processors */ + template + class hashed_vertex_compare + { + public: + hashed_vertex_compare (const OwnerMap& o, const LocalMap& l) + : owner(o), local(l) { } + + template + bool operator() (const Vertex x, const Vertex y) + { + if (get(local, x) < get(local, y)) + return true; + else if (get(local, x) == get(local, y)) + return (get(owner, x) < get(owner, y)); + return false; + } + + private: + OwnerMap owner; + LocalMap local; + }; + +#ifdef PBGL_EXPLICIT_SYNCH + template + void + request_parent_map_entries(const Graph& g, ParentMap p, + std::vector& parent_requests) + { + typedef typename boost::graph::parallel::process_group_type + ::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + + process_group_type pg = process_group(g); + + /* + This should probably be send_oob_with_reply, especially when Dave + finishes prefetch-batching + */ + + // Send root requests + for (process_id_type i = 0; i < num_processes(pg); ++i) { + if (!parent_requests[i].empty()) { + std::vector reqs(parent_requests[i].begin(), + parent_requests[i].end()); + send(pg, i, req_parents_msg, reqs); + } + } + + synchronize(pg); + + // Receive root requests and reply to them + while (optional > m = probe(pg)) { + std::vector requests; + receive(pg, m->first, m->second, requests); + for (std::size_t i = 0; i < requests.size(); ++i) + requests[i] = get(p, requests[i]); + send(pg, m->first, parents_msg, requests); + } + + synchronize(pg); + + // Receive requested parents + std::vector responses; + for (process_id_type i = 0; i < num_processes(pg); ++i) { + if (!parent_requests[i].empty()) { + receive(pg, i, parents_msg, responses); + std::size_t parent_idx = 0; + for (typename VertexList::iterator v = parent_requests[i].begin(); + v != parent_requests[i].end(); ++v, ++parent_idx) + put(p, *v, responses[parent_idx]); + } + } + } +#endif + + template + void + parallel_connected_components(DistributedGraph& g, ParentMap p) + { + using boost::connected_components; + + typedef typename graph_traits::adjacency_iterator + adjacency_iterator; + typedef typename graph_traits::out_edge_iterator + out_edge_iterator; + typedef typename graph_traits::edge_iterator + edge_iterator; + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + typedef typename graph_traits::edge_descriptor + edge_descriptor; + + typedef typename boost::graph::parallel::process_group_type + ::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + + using boost::graph::parallel::process_group; + + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + + // TODO (NGE): Should old_roots, roots, and completed_roots be std::list + adjacency_iterator av1, av2; + std::vector old_roots; + typename std::vector::iterator liter; + typename std::vector::iterator aliter; + typename std::map > adj; + + typedef typename property_map::const_type + OwnerMap; + OwnerMap owner = get(vertex_owner, g); + typedef typename property_map::const_type + LocalMap; + LocalMap local = get(vertex_local, g); + + // We need to hold on to all of the parent pointers + p.set_max_ghost_cells(0); + + // + // STAGE 1 : Compute local components + // + local_subgraph ls(g); + typedef typename property_map, + vertex_index_t>::type local_index_map_type; + local_index_map_type local_index = get(vertex_index, ls); + + // Compute local connected components + std::vector ls_components_vec(num_vertices(ls)); + typedef iterator_property_map::iterator, + local_index_map_type> + ls_components_map_type; + ls_components_map_type ls_component(ls_components_vec.begin(), + local_index); + std::size_t num_comp = connected_components(ls, ls_component); + + std::vector + roots(num_comp, graph_traits::null_vertex()); + + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + size_t component = get(ls_component, v); + if (roots[component] == graph_traits::null_vertex() || + get(local_index, v) < get(local_index, roots[component])) + roots[component] = v; + } + + // Set all the local parent pointers + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + put(p, v, roots[get(ls_component, v)]); + } + + if (num_processes(pg) == 1) return; + + // Build adjacency list for all roots + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + std::vector& my_adj = adj[get(p, v)]; + for (tie(av1, av2) = adjacent_vertices(v, g); + av1 != av2; ++av1) { + if (get(owner, *av1) != id) my_adj.push_back(*av1); + } + } + + // For all vertices adjacent to a local vertex get p(v) + for ( liter = roots.begin(); liter != roots.end(); ++liter ) { + std::vector& my_adj = adj[*liter]; + for ( aliter = my_adj.begin(); aliter != my_adj.end(); ++aliter ) + request(p, *aliter); + } + synchronize(p); + + // Update adjacency list at root to make sure all adjacent + // vertices are roots of remote components + for ( liter = roots.begin(); liter != roots.end(); ++liter ) + { + std::vector& my_adj = adj[*liter]; + for ( aliter = my_adj.begin(); aliter != my_adj.end(); ++aliter ) + *aliter = get(p, *aliter); + + my_adj.erase + (remove_if(my_adj.begin(), my_adj.end(), + cull_adjacency_list(*liter, p) ), + my_adj.end()); + // This sort needs to be here to make sure the initial + // adjacency list is sorted + sort(my_adj.begin(), my_adj.end(), std::less()); + my_adj.erase(unique(my_adj.begin(), my_adj.end()), my_adj.end()); + } + + // Get p(v) for the new adjacent roots + p.clear(); + for ( liter = roots.begin(); liter != roots.end(); ++liter ) { + std::vector& my_adj = adj[*liter]; + for ( aliter = my_adj.begin(); aliter != my_adj.end(); ++aliter ) + request(p, *aliter); + } +#ifdef PBGL_EXPLICIT_SYNCH + synchronize(p); +#endif + + // Lastly, remove roots with no adjacent vertices, this is + // unnecessary but will speed up sparse graphs + for ( liter = roots.begin(); liter != roots.end(); /*in loop*/) + { + if ( adj[*liter].empty() ) + liter = roots.erase(liter); + else + ++liter; + } + +#ifdef PBGL_CONSTRUCT_METAGRAPH + /* TODO: If the number of roots is sufficiently small, we can + use a 'problem folding' approach like we do in MST + to gather all the roots and their adjacencies on one proc + and solve for the connected components of the meta-graph */ + using boost::parallel::all_reduce; + std::size_t num_roots = all_reduce(pg, roots.size(), std::plus()); + if (num_roots < MAX_VERTICES_IN_METAGRAPH) { + build_local_metagraph(g, p, roots.begin(), roots.end(), adj); + + // For each vertex in g, p(v) = p(p(v)), assign parent of leaf + // vertices from first step to final parent + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + put(p, v, get(p, get(p, v))); + } + + synchronize(p); + + return; + } +#endif + + // + // Parallel Phase + // + + std::vector completed_roots; + hashed_vertex_compare v_compare(owner, local); + bool any_hooked; + vertex_descriptor new_root; + + std::size_t steps = 0; + + do { + ++steps; + + // Pull in new parents for hooking phase + synchronize(p); + + // + // Hooking + // + bool hooked = false; + completed_roots.clear(); + for ( liter = roots.begin(); liter != roots.end(); ) + { + new_root = graph_traits::null_vertex(); + std::vector& my_adj = adj[*liter]; + for ( aliter = my_adj.begin(); aliter != my_adj.end(); ++aliter ) + // try to hook to better adjacent vertex + if ( v_compare( get(p, *aliter), *liter ) ) + new_root = get(p, *aliter); + + if ( new_root != graph_traits::null_vertex() ) + { + hooked = true; + put(p, *liter, new_root); + old_roots.push_back(*liter); + completed_roots.push_back(*liter); + liter = roots.erase(liter); + } + else + ++liter; + } + + // + // Pointer jumping, perform until new roots determined + // + + // TODO: Implement cycle reduction rules to reduce this from + // O(n) to O(log n) [n = cycle length] + bool all_done; + std::size_t parent_root_count; + + std::size_t double_steps = 0; + + do { + ++double_steps; +#ifndef PBGL_EXPLICIT_SYNCH + // Get p(p(v)) for all old roots, and p(v) for all current roots + for ( liter = old_roots.begin(); liter != old_roots.end(); ++liter ) + request(p, get(p, *liter)); + + synchronize(p); +#else + // Build root requests + typedef std::set VertexSet; + std::vector parent_requests(num_processes(pg)); + for ( liter = old_roots.begin(); liter != old_roots.end(); ++liter ) + { + vertex_descriptor p1 = *liter; + if (get(owner, p1) != id) parent_requests[get(owner, p1)].insert(p1); + vertex_descriptor p2 = get(p, p1); + if (get(owner, p2) != id) parent_requests[get(owner, p2)].insert(p2); + } + + request_parent_map_entries(g, p, parent_requests); +#endif + // Perform a pointer jumping step on all old roots + for ( liter = old_roots.begin(); liter != old_roots.end(); ++liter ) + put(p, *liter, get(p, get(p, *liter))); + + // make sure the parent of all old roots is itself a root + parent_root_count = 0; + for ( liter = old_roots.begin(); liter != old_roots.end(); ++liter ) + if ( get(p, *liter) == get(p, get(p, *liter)) ) + parent_root_count++; + + bool done = parent_root_count == old_roots.size(); + + all_reduce(pg, &done, &done+1, &all_done, + std::logical_and()); + } while ( !all_done ); +#ifdef PARALLEL_BGL_DEBUG + if (id == 0) std::cerr << double_steps << " doubling steps.\n"; +#endif + // + // Add adjacent vertices of just completed roots to adjacent + // vertex list at new parent + // + typename std::vector outgoing_edges; + for ( liter = completed_roots.begin(); liter != completed_roots.end(); + ++liter ) + { + vertex_descriptor new_parent = get(p, *liter); + + if ( get(owner, new_parent) == id ) + { + std::vector& my_adj = adj[new_parent]; + my_adj.reserve(my_adj.size() + adj[*liter].size()); + my_adj.insert( my_adj.end(), + adj[*liter].begin(), adj[*liter].end() ); +#ifdef PBGL_IN_PLACE_MERGE +#ifdef PBGL_SORT_ASSERT + assert(__gnu_cxx::is_sorted(my_adj.begin(), + my_adj.end() - adj[*liter].size(), + std::less())); + assert(__gnu_cxx::is_sorted(my_adj.end() - adj[*liter].size(), + my_adj.end(), + std::less())); +#endif + std::inplace_merge(my_adj.begin(), + my_adj.end() - adj[*liter].size(), + my_adj.end(), + std::less()); +#endif + + + } + else if ( adj[*liter].begin() != adj[*liter].end() ) + { + outgoing_edges.clear(); + outgoing_edges.reserve(adj[*liter].size() + 1); + // First element is the destination of the adjacency list + outgoing_edges.push_back(new_parent); + outgoing_edges.insert(outgoing_edges.end(), + adj[*liter].begin(), adj[*liter].end() ); + send(pg, get(owner, new_parent), edges_msg, outgoing_edges); + adj[*liter].clear(); + } + } + synchronize(pg); + + // Receive edges sent by remote nodes and add them to the + // indicated vertex's adjacency list + while (optional > m + = probe(pg)) + { + std::vector incoming_edges; + receive(pg, m->first, edges_msg, incoming_edges); + typename std::vector::iterator aviter + = incoming_edges.begin(); + ++aviter; + + std::vector& my_adj = adj[incoming_edges[0]]; + + my_adj.reserve(my_adj.size() + incoming_edges.size() - 1); + my_adj.insert( my_adj.end(), aviter, incoming_edges.end() ); + +#ifdef PBGL_IN_PLACE_MERGE + std::size_t num_incoming_edges = incoming_edges.size(); +#ifdef PBGL_SORT_ASSERT + assert(__gnu_cxx::is_sorted(my_adj.begin(), + my_adj.end() - (num_incoming_edges-1), + std::less())); + assert(__gnu_cxx::is_sorted(my_adj.end() - (num_incoming_edges-1), + my_adj.end(), + std::less())); +#endif + std::inplace_merge(my_adj.begin(), + my_adj.end() - (num_incoming_edges - 1), + my_adj.end(), + std::less()); +#endif + + } + + + // Remove any adjacent vertices that are in the same component + // as a root from that root's list + for ( liter = roots.begin(); liter != roots.end(); ++liter ) + { + // We can probably get away without sorting and removing + // duplicates Though sorting *may* cause root + // determination to occur faster by choosing the root with + // the most potential to hook to at each step + std::vector& my_adj = adj[*liter]; + my_adj.erase + (remove_if(my_adj.begin(), my_adj.end(), + cull_adjacency_list(*liter, p) ), + my_adj.end()); +#ifndef PBGL_IN_PLACE_MERGE + sort(my_adj.begin(), my_adj.end(), + std::less() ); +#endif + my_adj.erase(unique(my_adj.begin(), my_adj.end()), my_adj.end()); + } + + // Reduce result of empty root list test + all_reduce(pg, &hooked, &hooked+1, &any_hooked, + std::logical_or()); + } while ( any_hooked ); +#ifdef PARALLEL_BGL_DEBUG + if (id == 0) std::cerr << steps << " iterations.\n"; +#endif + // + // Finalize + // + + // For each vertex in g, p(v) = p(p(v)), assign parent of leaf + // vertices from first step to final parent + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + put(p, v, get(p, get(p, v))); + } + + synchronize(p); + } + + } // end namespace cc_detail + + template + typename property_traits::value_type + number_components_from_parents(const Graph& g, ParentMap p, ComponentMap c) + { + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + typedef typename property_traits::value_type + ComponentMapType; + + process_group_type pg = process_group(g); + + /* Build list of roots */ + std::vector my_roots, all_roots; + + BGL_FORALL_VERTICES_T(v, g, Graph) { + if( find( my_roots.begin(), my_roots.end(), get(p, v) ) + == my_roots.end() ) + my_roots.push_back( get(p, v) ); + } + + all_gather(pg, my_roots.begin(), my_roots.end(), all_roots); + + /* Number components */ + std::map comp_numbers; + ComponentMapType c_num = 0; + + // Compute component numbers + for (std::size_t i = 0; i < all_roots.size(); i++ ) + if ( comp_numbers.count(all_roots[i]) == 0 ) + comp_numbers[all_roots[i]] = c_num++; + + // Broadcast component numbers + BGL_FORALL_VERTICES_T(v, g, Graph) { + put( c, v, comp_numbers[get(p, v)] ); + } + + // Broadcast number of components + if (process_id(pg) == 0) { + typedef typename process_group_type::process_size_type + process_size_type; + for (process_size_type dest = 1, n = num_processes(pg); + dest != n; ++dest) + send(pg, dest, 0, c_num); + } + synchronize(pg); + + if (process_id(pg) != 0) receive(pg, 0, 0, c_num); + + synchronize(c); + + return c_num; + } + + template + int + number_components_from_parents(const Graph& g, ParentMap p, + dummy_property_map) + { + using boost::parallel::all_reduce; + + // Count local roots. + int num_roots = 0; + BGL_FORALL_VERTICES_T(v, g, Graph) + if (get(p, v) == v) ++num_roots; + return all_reduce(g.process_group(), num_roots, std::plus()); + } + + template + typename property_traits::value_type + connected_components + (const Graph& g, ComponentMap c, ParentMap p + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, distributed_graph_tag)) + { + cc_detail::parallel_connected_components(g, p); + return number_components_from_parents(g, p, c); + } + + /* Construct ParentMap by default */ + template + typename property_traits::value_type + connected_components + ( const Graph& g, ComponentMap c + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, distributed_graph_tag) ) + { + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + std::vector x(num_vertices(g)); + + return connected_components + (g, c, + make_iterator_property_map(x.begin(), get(vertex_index, g))); + } +} // end namespace distributed + +using distributed::connected_components; +} // end namespace graph + +using graph::distributed::connected_components; +} // end namespace boost + +#endif // BOOST_GRAPH_PARALLEL_CC_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/connected_components_parallel_search.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/connected_components_parallel_search.hpp new file mode 100644 index 0000000000..815e3a3221 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/connected_components_parallel_search.hpp @@ -0,0 +1,408 @@ +// Copyright (C) 2004-2006 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: Brian Barrett +// Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_CC_PS_HPP +#define BOOST_GRAPH_PARALLEL_CC_PS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// Connected components algorithm based on a parallel search. +// +// Every N nodes starts a parallel search from the first vertex in +// their local vertex list during the first superstep (the other nodes +// remain idle during the first superstep to reduce the number of +// conflicts in numbering the components). At each superstep, all new +// component mappings from remote nodes are handled. If there is no +// work from remote updates, a new vertex is removed from the local +// list and added to the work queue. +// +// Components are allocated from the component_value_allocator object, +// which ensures that a given component number is unique in the +// system, currently by using the rank and number of processes to +// stride allocations. +// +// When two components are discovered to actually be the same +// component, a mapping is created in the collisions object. The +// lower component number is prefered in the resolution, so component +// numbering resolution is consistent. After the search has exhausted +// all vertices in the graph, the mapping is shared with all +// processes, and they independently resolve the comonent mapping (so +// O((N * NP) + (V * NP)) work, in O(N + V) time, where N is the +// number of mappings and V is the number of local vertices). This +// phase can likely be significantly sped up if a clever algorithm for +// the reduction can be found. +namespace boost { namespace graph { namespace distributed { + namespace cc_ps_detail { + // Local object for allocating component numbers. There are two + // places this happens in the code, and I was getting sick of them + // getting out of sync. Components are not tightly packed in + // numbering, but are numbered to ensure each rank has its own + // independent sets of numberings. + template + class component_value_allocator { + public: + component_value_allocator(int num, int size) : + last(0), num(num), size(size) + { + } + + component_value_type allocate(void) + { + component_value_type ret = num + (last * size); + last++; + return ret; + } + + private: + component_value_type last; + int num; + int size; + }; + + + // Map of the "collisions" between component names in the global + // component mapping. TO make cleanup easier, component numbers + // are added, pointing to themselves, when a new component is + // found. In order to make the results deterministic, the lower + // component number is always taken. The resolver will drill + // through the map until it finds a component entry that points to + // itself as the next value, allowing some cleanup to happen at + // update() time. Attempts are also made to update the mapping + // when new entries are created. + // + // Note that there's an assumption that the entire mapping is + // shared during the end of the algorithm, but before component + // name resolution. + template + class collision_map { + public: + collision_map() : num_unique(0) + { + } + + // add new component mapping first time component is used. Own + // function only so that we can sanity check there isn't already + // a mapping for that component number (which would be bad) + void add(const component_value_type &a) + { + assert(collisions.count(a) == 0); + collisions[a] = a; + } + + // add a mapping between component values saying they're the + // same component + void add(const component_value_type &a, const component_value_type &b) + { + component_value_type high, low, tmp; + if (a > b) { + high = a; + low = b; + } else { + high = b; + low = a; + } + + if (collisions.count(high) != 0 && collisions[high] != low) { + tmp = collisions[high]; + if (tmp > low) { + collisions[tmp] = low; + collisions[high] = low; + } else { + collisions[low] = tmp; + collisions[high] = tmp; + } + } else { + collisions[high] = low; + } + + } + + // get the "real" component number for the given component. + // Used to resolve mapping at end of run. + component_value_type update(component_value_type a) + { + assert(num_unique > 0); + assert(collisions.count(a) != 0); + return collisions[a]; + } + + // collapse the collisions tree, so that update is a one lookup + // operation. Count unique components at the same time. + void uniqify(void) + { + typename std::map::iterator i, end; + + end = collisions.end(); + for (i = collisions.begin() ; i != end ; ++i) { + if (i->first == i->second) { + num_unique++; + } else { + i->second = collisions[i->second]; + } + } + } + + // get the number of component entries that have an associated + // component number of themselves, which are the real components + // used in the final mapping. This is the number of unique + // components in the graph. + int unique(void) + { + assert(num_unique > 0); + return num_unique; + } + + // "serialize" into a vector for communication. + std::vector serialize(void) + { + std::vector ret; + typename std::map::iterator i, end; + + end = collisions.end(); + for (i = collisions.begin() ; i != end ; ++i) { + ret.push_back(i->first); + ret.push_back(i->second); + } + + return ret; + } + + private: + std::map collisions; + int num_unique; + }; + + + // resolver to handle remote updates. The resolver will add + // entries into the collisions map if required, and if it is the + // first time the vertex has been touched, it will add the vertex + // to the remote queue. Note that local updates are handled + // differently, in the main loop (below). + + // BWB - FIX ME - don't need graph anymore - can pull from key value of Component Map. + template + struct update_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = false); + + typedef typename property_traits::value_type component_value_type; + typedef typename property_traits::key_type vertex_descriptor; + + update_reducer(work_queue *q, + cc_ps_detail::collision_map *collisions, + processor_id_type pg_id) : + q(q), collisions(collisions), pg_id(pg_id) + { + } + + // ghost cell initialization routine. This should never be + // called in this imlementation. + template + component_value_type operator()(const K&) const + { + return component_value_type(0); + } + + // resolver for remote updates. I'm not entirely sure why, but + // I decided to not change the value of the vertex if it's + // already non-infinite. It doesn't matter in the end, as we'll + // touch every vertex in the cleanup phase anyway. If the + // component is currently infinite, set to the new component + // number and add the vertex to the work queue. If it's not + // infinite, we've touched it already so don't add it to the + // work queue. Do add a collision entry so that we know the two + // components are the same. + component_value_type operator()(const vertex_descriptor &v, + const component_value_type& current, + const component_value_type& update) const + { + const component_value_type max = (std::numeric_limits::max)(); + component_value_type ret = current; + + if (max == current) { + q->push(v); + ret = update; + } else if (current != update) { + collisions->add(current, update); + } + + return ret; + } + + // So for whatever reason, the property map can in theory call + // the resolver with a local descriptor in addition to the + // standard global descriptor. As far as I can tell, this code + // path is never taken in this implementation, but I need to + // have this code here to make it compile. We just make a + // global descriptor and call the "real" operator(). + template + component_value_type operator()(const K& v, + const component_value_type& current, + const component_value_type& update) const + { + return (*this)(vertex_descriptor(pg_id, v), current, update); + } + + private: + work_queue *q; + collision_map *collisions; + boost::processor_id_type pg_id; + }; + + } // namespace cc_ps_detail + + + template + typename property_traits::value_type + connected_components_ps(const Graph& g, ComponentMap c) + { + using boost::graph::parallel::process_group; + + typedef typename property_traits::value_type component_value_type; + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename boost::graph::parallel::process_group_type + ::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef typename property_map + ::const_type vertex_owner_map; + typedef std::queue work_queue; + + static const component_value_type max_component = + (std::numeric_limits::max)(); + typename property_map::const_type + owner = get(vertex_owner, g); + + // standard who am i? stuff + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + + // Initialize every vertex to have infinite component number + BGL_FORALL_VERTICES_T(v, g, Graph) put(c, v, max_component); + + vertex_iterator current, end; + tie(current, end) = vertices(g); + + cc_ps_detail::component_value_allocator cva(process_id(pg), num_processes(pg)); + cc_ps_detail::collision_map collisions; + work_queue q; // this is intentionally a local data structure + c.set_reduce(cc_ps_detail::update_reducer(&q, &collisions, id)); + + // add starting work + while (true) { + bool useful_found = false; + component_value_type val = cva.allocate(); + put(c, *current, val); + collisions.add(val); + q.push(*current); + if (0 != out_degree(*current, g)) useful_found = true; + ++current; + if (useful_found) break; + } + + // Run the loop until everyone in the system is done + bool global_done = false; + while (!global_done) { + + // drain queue of work for this superstep + while (!q.empty()) { + vertex_descriptor v = q.front(); + q.pop(); + // iterate through outedges of the vertex currently being + // examined, setting their component to our component. There + // is no way to end up in the queue without having a component + // number already. + + BGL_FORALL_ADJ_T(v, peer, g, Graph) { + component_value_type my_component = get(c, v); + + // update other vertex with our component information. + // Resolver will handle remote collisions as well as whether + // to put the vertex on the work queue or not. We have to + // handle local collisions and work queue management + if (id == get(owner, peer)) { + if (max_component == get(c, peer)) { + put(c, peer, my_component); + q.push(peer); + } else if (my_component != get(c, peer)) { + collisions.add(my_component, get(c, peer)); + } + } else { + put(c, peer, my_component); + } + } + } + + // synchronize / start a new superstep. + synchronize(pg); + global_done = all_reduce(pg, (q.empty() && (current == end)), boost::parallel::minimum()); + + // If the queue is currently empty, add something to do to start + // the current superstep (supersteps start at the sync, not at + // the top of the while loop as one might expect). Down at the + // bottom of the while loop so that not everyone starts the + // algorithm with something to do, to try to reduce component + // name conflicts + if (q.empty()) { + bool useful_found = false; + for ( ; current != end && !useful_found ; ++current) { + if (max_component == get(c, *current)) { + component_value_type val = cva.allocate(); + put(c, *current, val); + collisions.add(val); + q.push(*current); + if (0 != out_degree(*current, g)) useful_found = true; + } + } + } + } + + // share component mappings + std::vector global; + std::vector mine = collisions.serialize(); + all_gather(pg, mine.begin(), mine.end(), global); + for (size_t i = 0 ; i < global.size() ; i += 2) { + collisions.add(global[i], global[i + 1]); + } + collisions.uniqify(); + + // update the component mappings + BGL_FORALL_VERTICES_T(v, g, Graph) { + put(c, v, collisions.update(get(c, v))); + } + + return collisions.unique(); + } + +} // end namespace distributed + +} // end namespace graph + +} // end namespace boost + +#endif // BOOST_GRAPH_PARALLEL_CC_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/crauser_et_al_shortest_paths.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/crauser_et_al_shortest_paths.hpp new file mode 100644 index 0000000000..c52ffd8f32 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/crauser_et_al_shortest_paths.hpp @@ -0,0 +1,664 @@ +// Copyright (C) 2004-2006 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 + +/************************************************************************** + * This source file implements the variation on Dijkstra's algorithm * + * presented by Crauser et al. in: * + * * + * Andreas Crauser, Kurt Mehlhorn, Ulrich Meyer, and Peter * + * Sanders. A Parallelization of Dijkstra's Shortest Path * + * Algorithm. In Lubos Brim, Jozef Gruska, and Jiri Zlatuska, * + * editors, Mathematical Foundations of Computer Science (MFCS), * + * volume 1450 of Lecture Notes in Computer Science, pages * + * 722--731, 1998. Springer. * + * * + * This implementation is, however, restricted to the distributed-memory * + * case, where the work is distributed by virtue of the vertices being * + * distributed. In a shared-memory (single address space) context, we * + * would want to add an explicit balancing step. * + **************************************************************************/ +#ifndef BOOST_GRAPH_CRAUSER_ET_AL_SHORTEST_PATHS_HPP +#define BOOST_GRAPH_CRAUSER_ET_AL_SHORTEST_PATHS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef PBGL_ACCOUNTING +# include +# include +#endif // PBGL_ACCOUNTING + +#ifdef MUTABLE_QUEUE +# include +#endif + +namespace boost { namespace graph { namespace distributed { + +#ifdef PBGL_ACCOUNTING +struct crauser_et_al_shortest_paths_stats_t +{ + /* Total wall-clock time used by the algorithm.*/ + accounting::time_type execution_time; + + /* The number of vertices deleted in each superstep. */ + std::vector deleted_vertices; + + template + void print(OutputStream& out) + { + double avg_deletions = std::accumulate(deleted_vertices.begin(), + deleted_vertices.end(), + 0.0); + avg_deletions /= deleted_vertices.size(); + + out << "Problem = \"Single-Source Shortest Paths\"\n" + << "Algorithm = \"Crauser et al\"\n" + << "Function = crauser_et_al_shortest_paths\n" + << "Wall clock time = " << accounting::print_time(execution_time) + << "\nSupersteps = " << deleted_vertices.size() << "\n" + << "Avg. deletions per superstep = " << avg_deletions << "\n"; + } +}; + +static crauser_et_al_shortest_paths_stats_t crauser_et_al_shortest_paths_stats; +#endif + +namespace detail { + + /************************************************************************ + * Function objects that perform distance comparisons modified by the * + * minimum or maximum edge weights. * + ************************************************************************/ + template + struct min_in_distance_compare + : std::binary_function + { + min_in_distance_compare(DistanceMap d, MinInWeightMap m, + Combine combine, Compare compare) + : distance_map(d), min_in_weight(m), combine(combine), + compare(compare) + { + } + + bool operator()(const Vertex& x, const Vertex& y) const + { + return compare(combine(get(distance_map, x), -get(min_in_weight, x)), + combine(get(distance_map, y), -get(min_in_weight, y))); + } + + private: + DistanceMap distance_map; + MinInWeightMap min_in_weight; + Combine combine; + Compare compare; + }; + + template + struct min_out_distance_compare + : std::binary_function + { + min_out_distance_compare(DistanceMap d, MinOutWeightMap m, + Combine combine, Compare compare) + : distance_map(d), min_out_weight(m), combine(combine), + compare(compare) + { + } + + bool operator()(const Vertex& x, const Vertex& y) const + { + return compare(combine(get(distance_map, x), get(min_out_weight, x)), + combine(get(distance_map, y), get(min_out_weight, y))); + } + + private: + DistanceMap distance_map; + MinOutWeightMap min_out_weight; + Combine combine; + Compare compare; + }; + /************************************************************************/ + + /************************************************************************ + * Dijkstra queue that implements Crauser et al.'s criteria. This queue * + * actually stores three separate priority queues, to help expose all * + * vertices that can be processed in a single phase. * + ************************************************************************/ + template + class crauser_et_al_dijkstra_queue + : public graph::detail::remote_update_set< + crauser_et_al_dijkstra_queue< + Graph, Combine, Compare, VertexIndexMap, DistanceMap, + PredecessorMap, MinOutWeightMap, MinInWeightMap>, + typename boost::graph::parallel::process_group_type::type, + typename dijkstra_msg_value::type, + typename property_map::const_type> + { + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + typedef crauser_et_al_dijkstra_queue self_type; + typedef dijkstra_msg_value msg_value_creator; + typedef typename msg_value_creator::type msg_value_type; + typedef typename graph_traits::vertices_size_type + vertices_size_type; + typedef typename property_map::const_type + OwnerPropertyMap; + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + typedef graph::detail::remote_update_set + inherited; + + // Priority queue for tentative distances + typedef indirect_cmp dist_queue_compare_type; + + typedef typename property_traits::value_type distance_type; + +#ifdef MUTABLE_QUEUE + typedef mutable_queue, + dist_queue_compare_type, VertexIndexMap> dist_queue_type; + +#else + typedef relaxed_heap dist_queue_type; +#endif // MUTABLE_QUEUE + + // Priority queue for OUT criteria + typedef min_out_distance_compare + out_queue_compare_type; + +#ifdef MUTABLE_QUEUE + typedef mutable_queue, + out_queue_compare_type, VertexIndexMap> out_queue_type; + +#else + typedef relaxed_heap out_queue_type; +#endif // MUTABLE_QUEUE + + // Priority queue for IN criteria + typedef min_in_distance_compare + in_queue_compare_type; + +#ifdef MUTABLE_QUEUE + typedef mutable_queue, + in_queue_compare_type, VertexIndexMap> in_queue_type; + +#else + typedef relaxed_heap in_queue_type; +#endif // MUTABLE_QUEUE + + typedef typename process_group_type::process_id_type process_id_type; + + public: + typedef typename dist_queue_type::size_type size_type; + typedef typename dist_queue_type::value_type value_type; + + crauser_et_al_dijkstra_queue(const Graph& g, + const Combine& combine, + const Compare& compare, + const VertexIndexMap& id, + const DistanceMap& distance_map, + const PredecessorMap& predecessor_map, + const MinOutWeightMap& min_out_weight, + const MinInWeightMap& min_in_weight) + : inherited(boost::graph::parallel::process_group(g), get(vertex_owner, g)), + dist_queue(num_vertices(g), + dist_queue_compare_type(distance_map, compare), + id), + out_queue(num_vertices(g), + out_queue_compare_type(distance_map, min_out_weight, + combine, compare), + id), + in_queue(num_vertices(g), + in_queue_compare_type(distance_map, min_in_weight, + combine, compare), + id), + g(g), + distance_map(distance_map), + predecessor_map(predecessor_map), + min_out_weight(min_out_weight), + min_in_weight(min_in_weight), + min_distance(0), + min_out_distance(0) +#ifdef PBGL_ACCOUNTING + , local_deletions(0) +#endif + { } + + void push(const value_type& x) + { + msg_value_type msg_value = + msg_value_creator::create(get(distance_map, x), + predecessor_value(get(predecessor_map, x))); + inherited::update(x, msg_value); + } + + void update(const value_type& x) { push(x); } + + void pop() + { + // Remove from distance queue + dist_queue.remove(top_vertex); + + // Remove from OUT queue + out_queue.remove(top_vertex); + + // Remove from IN queue + in_queue.remove(top_vertex); + +#ifdef PBGL_ACCOUNTING + ++local_deletions; +#endif + } + + vertex_descriptor& top() { return top_vertex; } + const vertex_descriptor& top() const { return top_vertex; } + + bool empty() + { + inherited::collect(); + + // If there are no suitable messages, wait until we get something + while (!has_suitable_vertex()) { + if (do_synchronize()) return true; + } + // Return true only if nobody has any messages; false if we + // have suitable messages + return false; + } + + bool do_synchronize() + { + using boost::parallel::all_reduce; + using boost::parallel::minimum; + + inherited::synchronize(); + + // TBD: could use combine here, but then we need to stop using + // minimum() as the function object. + distance_type local_distances[2]; + local_distances[0] = + dist_queue.empty()? (std::numeric_limits::max)() + : get(distance_map, dist_queue.top()); + + local_distances[1] = + out_queue.empty()? (std::numeric_limits::max)() + : (get(distance_map, out_queue.top()) + + get(min_out_weight, out_queue.top())); + + distance_type distances[2]; + all_reduce(this->process_group, local_distances, local_distances + 2, + distances, minimum()); + min_distance = distances[0]; + min_out_distance = distances[1]; + +#ifdef PBGL_ACCOUNTING + std::size_t deletions = 0; + all_reduce(this->process_group, &local_deletions, &local_deletions + 1, + &deletions, std::plus()); + if (process_id(this->process_group) == 0) { + crauser_et_al_shortest_paths_stats.deleted_vertices.push_back(deletions); + } + local_deletions = 0; + assert(deletions > 0); +#endif + + return min_distance == (std::numeric_limits::max)(); + } + + private: + vertex_descriptor predecessor_value(vertex_descriptor v) const + { return v; } + + vertex_descriptor + predecessor_value(property_traits::reference) const + { return graph_traits::null_vertex(); } + + bool has_suitable_vertex() const + { + if (!dist_queue.empty()) { + top_vertex = dist_queue.top(); + if (get(distance_map, dist_queue.top()) <= min_out_distance) + return true; + } + + if (!in_queue.empty()) { + top_vertex = in_queue.top(); + return (get(distance_map, top_vertex) + - get(min_in_weight, top_vertex)) <= min_distance; + } + return false; + } + + public: + void + receive_update(process_id_type source, vertex_descriptor vertex, + distance_type distance) + { + // Update the queue if the received distance is better than + // the distance we know locally + if (distance < get(distance_map, vertex) + || (distance == get(distance_map, vertex) + && source == process_id(this->process_group))) { + // Update the local distance map + put(distance_map, vertex, distance); + + bool is_in_queue = dist_queue.contains(vertex); + + if (!is_in_queue) { + dist_queue.push(vertex); + out_queue.push(vertex); + in_queue.push(vertex); + } + else { + dist_queue.update(vertex); + out_queue.update(vertex); + in_queue.update(vertex); + } + } + } + + void + receive_update(process_id_type source, vertex_descriptor vertex, + std::pair p) + { + if (p.first <= get(distance_map, vertex)) { + put(predecessor_map, vertex, p.second); + receive_update(source, vertex, p.first); + } + } + + private: + dist_queue_type dist_queue; + out_queue_type out_queue; + in_queue_type in_queue; + mutable value_type top_vertex; + const Graph& g; + DistanceMap distance_map; + PredecessorMap predecessor_map; + MinOutWeightMap min_out_weight; + MinInWeightMap min_in_weight; + distance_type min_distance; + distance_type min_out_distance; +#ifdef PBGL_ACCOUNTING + std::size_t local_deletions; +#endif + }; + /************************************************************************/ + + /************************************************************************ + * Initialize the property map that contains the minimum incoming edge * + * weight for each vertex. There are separate implementations for * + * directed, bidirectional, and undirected graph. * + ************************************************************************/ + template + void + initialize_min_in_weights(const Graph& g, MinInWeightMap min_in_weight, + WeightMap weight, Inf inf, Compare compare, + directed_tag, incidence_graph_tag) + { + // Send minimum weights off to the owners + set_property_map_role(vertex_distance, min_in_weight); + BGL_FORALL_VERTICES_T(v, g, Graph) { + BGL_FORALL_OUTEDGES_T(v, e, g, Graph) { + if (get(weight, e) < get(min_in_weight, target(e, g))) + put(min_in_weight, target(e, g), get(weight, e)); + } + } + + using boost::graph::parallel::process_group; + synchronize(process_group(g)); + + // Replace any infinities with zeros + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (get(min_in_weight, v) == inf) put(min_in_weight, v, 0); + } + } + + template + void + initialize_min_in_weights(const Graph& g, MinInWeightMap min_in_weight, + WeightMap weight, Inf inf, Compare compare, + directed_tag, bidirectional_graph_tag) + { +#if 0 + typename property_map::const_type + local = get(vertex_local, g); + + // This code assumes that the properties of the in-edges are + // available locally. This is not necessarily the case, so don't + // do this yet. + set_property_map_role(vertex_distance, min_in_weight); + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (in_edges(v, g).first != in_edges(v, g).second) { + std::cerr << "weights(" << g.distribution().global(get(local, v)) + << ") = "; + BGL_FORALL_INEDGES_T(v, e, g, Graph) { + std::cerr << get(weight, e) << ' '; + } + std::cerr << std::endl; + put(min_in_weight, v, + *std::min_element + (make_property_map_iterator(weight, in_edges(v, g).first), + make_property_map_iterator(weight, in_edges(v, g).second), + compare)); + } else { + put(min_in_weight, v, 0); + } + std::cerr << "miw(" << g.distribution().global(get(local, v)) << ") = " + << get(min_in_weight, v) << std::endl; + } +#else + initialize_min_in_weights(g, min_in_weight, weight, inf, compare, + directed_tag(), incidence_graph_tag()); +#endif + } + + template + inline void + initialize_min_in_weights(const Graph&, MinInWeightMap, WeightMap, Inf, + Compare, undirected_tag, bidirectional_graph_tag) + { + // In weights are the same as out weights, so do nothing + } + /************************************************************************/ + + + /************************************************************************ + * Initialize the property map that contains the minimum outgoing edge * + * weight for each vertex. * + ************************************************************************/ + template + void + initialize_min_out_weights(const Graph& g, MinOutWeightMap min_out_weight, + WeightMap weight, Compare compare) + { + typedef typename property_traits::value_type weight_type; + + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (out_edges(v, g).first != out_edges(v, g).second) { + put(min_out_weight, v, + *std::min_element + (make_property_map_iterator(weight, out_edges(v, g).first), + make_property_map_iterator(weight, out_edges(v, g).second), + compare)); + if (get(min_out_weight, v) < weight_type(0)) + boost::throw_exception(negative_edge()); + } + } + } + + /************************************************************************/ + +} // end namespace detail + +template +void +crauser_et_al_shortest_paths + (const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, WeightMap weight, + IndexMap index_map, ColorMap color_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) +{ + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef typename graph_traits::vertex_descriptor + Vertex; + typedef typename graph_traits::vertices_size_type + vertices_size_type; + +#ifdef PBGL_ACCOUNTING + crauser_et_al_shortest_paths_stats.deleted_vertices.clear(); + crauser_et_al_shortest_paths_stats.execution_time = accounting::get_time(); +#endif + + // Property map that stores the lowest edge weight outgoing from + // each vertex. If a vertex has no out-edges, the stored weight + // is zero. + typedef typename property_traits::value_type weight_type; + typedef iterator_property_map MinOutWeightMap; + std::vector min_out_weights_vec(num_vertices(g), inf); + MinOutWeightMap min_out_weight(&min_out_weights_vec.front(), index_map); + detail::initialize_min_out_weights(g, min_out_weight, weight, compare); + + // Property map that stores the lowest edge weight incoming to + // each vertex. For undirected graphs, this will just be a + // shallow copy of the version for outgoing edges. + typedef typename graph_traits::directed_category + directed_category; + const bool is_undirected = + is_same::value; + typedef MinOutWeightMap MinInWeightMap; + std::vector + min_in_weights_vec(is_undirected? 1 : num_vertices(g), inf); + MinInWeightMap min_in_weight(&min_in_weights_vec.front(), index_map); + typedef typename graph_traits::traversal_category + category; + detail::initialize_min_in_weights(g, min_in_weight, weight, inf, compare, + directed_category(), category()); + + // Initialize local portion of property maps + typename graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + put(distance, *ui, inf); + put(predecessor, *ui, *ui); + } + put(distance, s, zero); + + // Dijkstra Queue + typedef detail::crauser_et_al_dijkstra_queue + + Queue; + + Queue Q(g, combine, compare, index_map, distance, predecessor, + min_out_weight, is_undirected? min_out_weight : min_in_weight); + + // Parallel Dijkstra visitor + ::boost::detail::dijkstra_bfs_visitor< + DijkstraVisitor, Queue, WeightMap, + boost::parallel::caching_property_map, + boost::parallel::caching_property_map, Combine, Compare + > bfs_vis(vis, Q, weight, + boost::parallel::make_caching_property_map(predecessor), + boost::parallel::make_caching_property_map(distance), + combine, compare, zero); + + set_property_map_role(vertex_color, color_map); + set_property_map_role(vertex_distance, distance); + + breadth_first_search(g, s, Q, bfs_vis, color_map); + +#ifdef PBGL_ACCOUNTING + crauser_et_al_shortest_paths_stats.execution_time = + accounting::get_time() - crauser_et_al_shortest_paths_stats.execution_time; +#endif +} + +template +void +crauser_et_al_shortest_paths + (const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, WeightMap weight) +{ + typedef typename property_traits::value_type distance_type; + + std::vector colors(num_vertices(g), white_color); + + crauser_et_al_shortest_paths(g, s, predecessor, distance, weight, + get(vertex_index, g), + make_iterator_property_map(&colors[0], + get(vertex_index, g)), + std::less(), + closed_plus(), + (std::numeric_limits::max)(), + distance_type(), + dijkstra_visitor<>()); +} + +template +void +crauser_et_al_shortest_paths + (const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance) +{ + crauser_et_al_shortest_paths(g, s, predecessor, distance, + get(edge_weight, g)); +} + +} // end namespace distributed + +#ifdef PBGL_ACCOUNTING +using distributed::crauser_et_al_shortest_paths_stats; +#endif + +using distributed::crauser_et_al_shortest_paths; + + +} } // end namespace boost::graph + +#endif // BOOST_GRAPH_CRAUSER_ET_AL_SHORTEST_PATHS_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/dehne_gotz_min_spanning_tree.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/dehne_gotz_min_spanning_tree.hpp new file mode 100644 index 0000000000..3fcccf0790 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/dehne_gotz_min_spanning_tree.hpp @@ -0,0 +1,938 @@ +// Copyright (C) 2004-2006 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 + +/** + * This header implements four distributed algorithms to compute + * the minimum spanning tree (actually, minimum spanning forest) of a + * graph. All of the algorithms were implemented as specified in the + * paper by Dehne and Gotz: + * + * Frank Dehne and Silvia Gotz. Practical Parallel Algorithms for Minimum + * Spanning Trees. In Symposium on Reliable Distributed Systems, + * pages 366--371, 1998. + * + * There are four algorithm variants implemented. + */ + +#ifndef BOOST_DEHNE_GOTZ_MIN_SPANNING_TREE_HPP +#define BOOST_DEHNE_GOTZ_MIN_SPANNING_TREE_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace graph { namespace distributed { + +namespace detail { + /** + * Binary function object type that selects the (edge, weight) pair + * with the minimum weight. Used within a Boruvka merge step to select + * the candidate edges incident to each supervertex. + */ + struct smaller_weighted_edge + { + template + std::pair + operator()(const std::pair& x, + const std::pair& y) const + { return x.second < y.second? x : y; } + }; + + /** + * Unary predicate that determines if the source and target vertices + * of the given edge have the same representative within a disjoint + * sets data structure. Used to indicate when an edge is now a + * self-loop because of supervertex merging in Boruvka's algorithm. + */ + template + class do_has_same_supervertex + { + public: + typedef typename graph_traits::edge_descriptor edge_descriptor; + + do_has_same_supervertex(DisjointSets& dset, const Graph& g) + : dset(dset), g(g) { } + + bool operator()(edge_descriptor e) + { return dset.find_set(source(e, g)) == dset.find_set(target(e, g)); } + + private: + DisjointSets& dset; + const Graph& g; + }; + + /** + * Build a @ref do_has_same_supervertex object. + */ + template + inline do_has_same_supervertex + has_same_supervertex(DisjointSets& dset, const Graph& g) + { return do_has_same_supervertex(dset, g); } + + /** \brief A single distributed Boruvka merge step. + * + * A distributed Boruvka merge step involves computing (globally) + * the minimum weight edges incident on each supervertex and then + * merging supervertices along these edges. Once supervertices are + * merged, self-loops are eliminated. + * + * The set of parameters passed to this algorithm is large, and + * considering this algorithm in isolation there are several + * redundancies. However, the more asymptotically efficient + * distributed MSF algorithms require mixing Boruvka steps with the + * merging of local MSFs (implemented in + * merge_local_minimum_spanning_trees_step): the interaction of the + * two algorithms mandates the addition of these parameters. + * + * \param pg The process group over which communication should be + * performed. Within the distributed Boruvka algorithm, this will be + * equivalent to \code process_group(g); however, in the context of + * the mixed MSF algorithms, the process group @p pg will be a + * (non-strict) process subgroup of \code process_group(g). + * + * \param g The underlying graph on which the MSF is being + * computed. The type of @p g must model DistributedGraph, but there + * are no other requirements because the edge and (super)vertex + * lists are passed separately. + * + * \param weight_map Property map containing the weights of each + * edge. The type of this property map must model + * ReadablePropertyMap and must support caching. + * + * \param out An output iterator that will be written with the set + * of edges selected to build the MSF. Every process within the + * process group @p pg will receive all edges in the MSF. + * + * \param dset Disjoint sets data structure mapping from vertices in + * the graph @p g to their representative supervertex. + * + * \param supervertex_map Mapping from supervertex descriptors to + * indices. + * + * \param supervertices A vector containing all of the + * supervertices. Will be modified to include only the remaining + * supervertices after merging occurs. + * + * \param edge_list The list of edges that remain in the graph. This + * list will be pruned to remove self-loops once MSF edges have been + * found. + */ + template + OutputIterator + boruvka_merge_step(ProcessGroup pg, const Graph& g, WeightMap weight_map, + OutputIterator out, + disjoint_sets& dset, + SupervertexMap supervertex_map, + std::vector& supervertices, + EdgeList& edge_list) + { + 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 EdgeList::iterator edge_iterator; + typedef typename property_traits::value_type + weight_type; + typedef boost::parallel::detail::untracked_pair w_edge; + typedef typename property_traits::value_type + supervertex_index; + + smaller_weighted_edge min_edge; + weight_type inf = (std::numeric_limits::max)(); + + // Renumber the supervertices + for (std::size_t i = 0; i < supervertices.size(); ++i) + put(supervertex_map, supervertices[i], i); + + // BSP-B1: Find local minimum-weight edges for each supervertex + std::vector candidate_edges(supervertices.size(), + w_edge(edge_descriptor(), inf)); + for (edge_iterator ei = edge_list.begin(); ei != edge_list.end(); ++ei) { + weight_type w = get(weight_map, *ei); + supervertex_index u = + get(supervertex_map, dset.find_set(source(*ei, g))); + supervertex_index v = + get(supervertex_map, dset.find_set(target(*ei, g))); + + if (u != v) { + candidate_edges[u] = min_edge(candidate_edges[u], w_edge(*ei, w)); + candidate_edges[v] = min_edge(candidate_edges[v], w_edge(*ei, w)); + } + } + + // BSP-B2 (a): Compute global minimum edges for each supervertex + all_reduce(pg, + &candidate_edges[0], + &candidate_edges[0] + candidate_edges.size(), + &candidate_edges[0], min_edge); + + // BSP-B2 (b): Use the edges to compute sequentially the new + // connected components and emit the edges. + for (vertices_size_type i = 0; i < candidate_edges.size(); ++i) { + if (candidate_edges[i].second != inf) { + edge_descriptor e = candidate_edges[i].first; + vertex_descriptor u = dset.find_set(source(e, g)); + vertex_descriptor v = dset.find_set(target(e, g)); + if (u != v) { + // Emit the edge, but cache the weight so everyone knows it + cache(weight_map, e, candidate_edges[i].second); + *out++ = e; + + // Link the two supervertices + dset.link(u, v); + + // Whichever vertex was reparented will be removed from the + // list of supervertices. + vertex_descriptor victim = u; + if (dset.find_set(u) == u) victim = v; + supervertices[get(supervertex_map, victim)] = + graph_traits::null_vertex(); + } + } + } + + // BSP-B3: Eliminate self-loops + edge_list.erase(std::remove_if(edge_list.begin(), edge_list.end(), + has_same_supervertex(dset, g)), + edge_list.end()); + + // TBD: might also eliminate multiple edges between supervertices + // when the edges do not have the best weight, but this is not + // strictly necessary. + + // Eliminate supervertices that have been absorbed + supervertices.erase(std::remove(supervertices.begin(), + supervertices.end(), + graph_traits::null_vertex()), + supervertices.end()); + + return out; + } + + /** + * An edge descriptor adaptor that reroutes the source and target + * edges to different vertices, but retains the original edge + * descriptor for, e.g., property maps. This is used when we want to + * turn a set of edges in the overall graph into a set of edges + * between supervertices. + */ + template + struct supervertex_edge_descriptor + { + typedef supervertex_edge_descriptor self_type; + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + + Vertex source; + Vertex target; + Edge e; + + operator Edge() const { return e; } + + friend inline bool operator==(const self_type& x, const self_type& y) + { return x.e == y.e; } + + friend inline bool operator!=(const self_type& x, const self_type& y) + { return x.e != y.e; } + }; + + template + inline typename supervertex_edge_descriptor::Vertex + source(supervertex_edge_descriptor se, const Graph&) + { return se.source; } + + template + inline typename supervertex_edge_descriptor::Vertex + target(supervertex_edge_descriptor se, const Graph&) + { return se.target; } + + /** + * Build a supervertex edge descriptor from a normal edge descriptor + * using the given disjoint sets data structure to identify + * supervertex representatives. + */ + template + struct build_supervertex_edge_descriptor + { + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + + typedef Edge argument_type; + typedef supervertex_edge_descriptor result_type; + + build_supervertex_edge_descriptor() : g(0), dsets(0) { } + + build_supervertex_edge_descriptor(const Graph& g, DisjointSets& dsets) + : g(&g), dsets(&dsets) { } + + result_type operator()(argument_type e) const + { + result_type result; + result.source = dsets->find_set(source(e, *g)); + result.target = dsets->find_set(target(e, *g)); + result.e = e; + return result; + } + + private: + const Graph* g; + DisjointSets* dsets; + }; + + template + inline build_supervertex_edge_descriptor + make_supervertex_edge_descriptor(const Graph& g, DisjointSets& dsets) + { return build_supervertex_edge_descriptor(g, dsets); } + + template + struct identity_function + { + typedef T argument_type; + typedef T result_type; + + result_type operator()(argument_type x) const { return x; } + }; + + template + class is_not_msf_edge + { + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + + public: + is_not_msf_edge(const Graph& g, DisjointSets dset, EdgeMapper edge_mapper) + : g(g), dset(dset), edge_mapper(edge_mapper) { } + + bool operator()(Edge e) + { + Vertex u = dset.find_set(source(edge_mapper(e), g)); + Vertex v = dset.find_set(target(edge_mapper(e), g)); + if (u == v) return true; + else { + dset.link(u, v); + return false; + } + } + + private: + const Graph& g; + DisjointSets dset; + EdgeMapper edge_mapper; + }; + + template + void + sorted_mutating_kruskal(const Graph& g, + ForwardIterator first_vertex, + ForwardIterator last_vertex, + EdgeList& edge_list, EdgeMapper edge_mapper, + RankMap rank_map, ParentMap parent_map) + { + typedef disjoint_sets DisjointSets; + + // Build and initialize disjoint-sets data structure + DisjointSets dset(rank_map, parent_map); + for (ForwardIterator v = first_vertex; v != last_vertex; ++v) + dset.make_set(*v); + + is_not_msf_edge + remove_non_msf_edges(g, dset, edge_mapper); + edge_list.erase(std::remove_if(edge_list.begin(), edge_list.end(), + remove_non_msf_edges), + edge_list.end()); + } + + /** + * Merge local minimum spanning forests from p processes into + * minimum spanning forests on p/D processes (where D is the tree + * factor, currently fixed at 3), eliminating unnecessary edges in + * the process. + * + * As with @ref boruvka_merge_step, this routine has many + * parameters, not all of which make sense within the limited + * context of this routine. The parameters are required for the + * Boruvka and local MSF merging steps to interoperate. + * + * \param pg The process group on which local minimum spanning + * forests should be merged. The top (D-1)p/D processes will be + * eliminated, and a new process subgroup containing p/D processors + * will be returned. The value D is a constant factor that is + * currently fixed to 3. + * + * \param g The underlying graph whose MSF is being computed. It must model + * the DistributedGraph concept. + * + * \param first_vertex Iterator to the first vertex in the graph + * that should be considered. While the local MSF merging algorithm + * typically operates on the entire vertex set, within the hybrid + * distributed MSF algorithms this will refer to the first + * supervertex. + * + * \param last_vertex The past-the-end iterator for the vertex list. + * + * \param edge_list The list of local edges that will be + * considered. For the p/D processes that remain, this list will + * contain edges in the MSF known to the vertex after other + * processes' edge lists have been merged. The edge list must be + * sorted in order of increasing weight. + * + * \param weight Property map containing the weights of each + * edge. The type of this property map must model + * ReadablePropertyMap and must support caching. + * + * \param global_index Mapping from vertex descriptors to a global + * index. The type must model ReadablePropertyMap. + * + * \param edge_mapper A function object that can remap edge descriptors + * in the edge list to any alternative edge descriptor. This + * function object will be the identity function when a pure merging + * of local MSFs is required, but may be a mapping to a supervertex + * edge when the local MSF merging occurs on a supervertex + * graph. This function object saves us the trouble of having to + * build a supervertex graph adaptor. + * + * \param already_local_msf True when the edge list already + * constitutes a local MSF. If false, Kruskal's algorithm will first + * be applied to the local edge list to select MSF edges. + * + * \returns The process subgroup containing the remaining p/D + * processes. If the size of this process group is greater than one, + * the MSF edges contained in the edge list do not constitute an MSF + * for the entire graph. + */ + template + ProcessGroup + merge_local_minimum_spanning_trees_step(ProcessGroup pg, + const Graph& g, + ForwardIterator first_vertex, + ForwardIterator last_vertex, + EdgeList& edge_list, + WeightMap weight, + GlobalIndexMap global_index, + EdgeMapper edge_mapper, + bool already_local_msf) + { + typedef typename ProcessGroup::process_id_type process_id_type; + typedef typename EdgeList::value_type edge_descriptor; + typedef typename property_traits::value_type weight_type; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + // The tree factor, often called "D" + process_id_type const tree_factor = 3; + process_id_type num_procs = num_processes(pg); + process_id_type id = process_id(pg); + process_id_type procs_left = (num_procs + tree_factor - 1) / tree_factor; + std::size_t n = std::size_t(last_vertex - first_vertex); + + if (!already_local_msf) { + // Compute local minimum spanning forest. We only care about the + // edges in the MSF, because only edges in the local MSF can be in + // the global MSF. + std::vector ranks(n); + std::vector parents(n); + detail::sorted_mutating_kruskal + (g, first_vertex, last_vertex, + edge_list, edge_mapper, + make_iterator_property_map(ranks.begin(), global_index), + make_iterator_property_map(parents.begin(), global_index)); + } + + typedef std::pair w_edge; + + // Order edges based on their weights. + indirect_cmp > cmp_edge_weight(weight); + + if (id < procs_left) { + // The p/D processes that remain will receive local MSF edges from + // D-1 other processes. + synchronize(pg); + for (process_id_type from_id = procs_left + id; from_id < num_procs; + from_id += procs_left) { + std::size_t num_incoming_edges; + receive(pg, from_id, 0, num_incoming_edges); + if (num_incoming_edges > 0) { + std::vector incoming_edges(num_incoming_edges); + receive(pg, from_id, 1, &incoming_edges[0], num_incoming_edges); + + edge_list.reserve(edge_list.size() + num_incoming_edges); + for (std::size_t i = 0; i < num_incoming_edges; ++i) { + cache(weight, incoming_edges[i].first, incoming_edges[i].second); + edge_list.push_back(incoming_edges[i].first); + } + std::inplace_merge(edge_list.begin(), + edge_list.end() - num_incoming_edges, + edge_list.end(), + cmp_edge_weight); + } + } + + // Compute the local MSF from union of the edges in the MSFs of + // all children. + std::vector ranks(n); + std::vector parents(n); + detail::sorted_mutating_kruskal + (g, first_vertex, last_vertex, + edge_list, edge_mapper, + make_iterator_property_map(ranks.begin(), global_index), + make_iterator_property_map(parents.begin(), global_index)); + } else { + // The (D-1)p/D processes that are dropping out of further + // computations merely send their MSF edges to their parent + // process in the process tree. + send(pg, id % procs_left, 0, edge_list.size()); + if (edge_list.size() > 0) { + std::vector outgoing_edges; + outgoing_edges.reserve(edge_list.size()); + for (std::size_t i = 0; i < edge_list.size(); ++i) { + outgoing_edges.push_back(std::make_pair(edge_list[i], + get(weight, edge_list[i]))); + } + send(pg, id % procs_left, 1, &outgoing_edges[0], + outgoing_edges.size()); + } + synchronize(pg); + } + + // Return a process subgroup containing the p/D parent processes + return process_subgroup(pg, + make_counting_iterator(process_id_type(0)), + make_counting_iterator(procs_left)); + } +} // end namespace detail + +// --------------------------------------------------------------------- +// Dense Boruvka MSF algorithm +// --------------------------------------------------------------------- +template +OutputIterator +dense_boruvka_minimum_spanning_tree(const Graph& g, WeightMap weight_map, + OutputIterator out, + VertexIndexMap index_map, + RankMap rank_map, ParentMap parent_map, + SupervertexMap supervertex_map) +{ + using boost::graph::parallel::process_group; + + typedef typename graph_traits::traversal_category traversal_category; + + BOOST_STATIC_ASSERT((is_convertible::value)); + + typedef typename graph_traits::vertices_size_type vertices_size_type; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::edge_descriptor edge_descriptor; + + // Don't throw away cached edge weights + weight_map.set_max_ghost_cells(0); + + // Initialize the disjoint sets structures + disjoint_sets dset(rank_map, parent_map); + vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + dset.make_set(*vi); + + std::vector supervertices; + supervertices.assign(vertices(g).first, vertices(g).second); + + // Use Kruskal's algorithm to find the minimum spanning forest + // considering only the local edges. The resulting edges are not + // necessarily going to be in the final minimum spanning + // forest. However, any edge not part of the local MSF cannot be a + // part of the global MSF, so we should have eliminated some edges + // from consideration. + std::vector edge_list; + kruskal_minimum_spanning_tree + (make_vertex_and_edge_range(g, vertices(g).first, vertices(g).second, + edges(g).first, edges(g).second), + std::back_inserter(edge_list), + boost::weight_map(weight_map). + vertex_index_map(index_map)); + + // While the number of supervertices is decreasing, keep executing + // Boruvka steps to identify additional MSF edges. This loop will + // execute log |V| times. + vertices_size_type old_num_supervertices; + do { + old_num_supervertices = supervertices.size(); + out = detail::boruvka_merge_step(process_group(g), g, + weight_map, out, + dset, supervertex_map, supervertices, + edge_list); + } while (supervertices.size() < old_num_supervertices); + + return out; +} + +template +OutputIterator +dense_boruvka_minimum_spanning_tree(const Graph& g, WeightMap weight_map, + OutputIterator out, VertexIndex i_map) +{ + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + std::vector ranks(num_vertices(g)); + std::vector parents(num_vertices(g)); + std::vector supervertices(num_vertices(g)); + + return dense_boruvka_minimum_spanning_tree + (g, weight_map, out, i_map, + make_iterator_property_map(ranks.begin(), i_map), + make_iterator_property_map(parents.begin(), i_map), + make_iterator_property_map(supervertices.begin(), i_map)); +} + +template +OutputIterator +dense_boruvka_minimum_spanning_tree(const Graph& g, WeightMap weight_map, + OutputIterator out) +{ + return dense_boruvka_minimum_spanning_tree(g, weight_map, out, + get(vertex_index, g)); +} + +// --------------------------------------------------------------------- +// Merge local MSFs MSF algorithm +// --------------------------------------------------------------------- +template +OutputIterator +merge_local_minimum_spanning_trees(const Graph& g, WeightMap weight, + OutputIterator out, + GlobalIndexMap global_index) +{ + using boost::graph::parallel::process_group_type; + using boost::graph::parallel::process_group; + + typedef typename graph_traits::traversal_category traversal_category; + + BOOST_STATIC_ASSERT((is_convertible::value)); + + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::edge_descriptor edge_descriptor; + + // Don't throw away cached edge weights + weight.set_max_ghost_cells(0); + + // Compute the initial local minimum spanning forests + std::vector edge_list; + kruskal_minimum_spanning_tree + (make_vertex_and_edge_range(g, vertices(g).first, vertices(g).second, + edges(g).first, edges(g).second), + std::back_inserter(edge_list), + boost::weight_map(weight).vertex_index_map(global_index)); + + // Merge the local MSFs from p processes into p/D processes, + // reducing the number of processes in each step. Continue looping + // until either (a) the current process drops out or (b) only one + // process remains in the group. This loop will execute log_D p + // times. + typename process_group_type::type pg = process_group(g); + while (pg && num_processes(pg) > 1) { + pg = detail::merge_local_minimum_spanning_trees_step + (pg, g, vertices(g).first, vertices(g).second, + edge_list, weight, global_index, + detail::identity_function(), true); + } + + // Only process 0 has the entire edge list, so emit it to the output + // iterator. + if (pg && process_id(pg) == 0) { + out = std::copy(edge_list.begin(), edge_list.end(), out); + } + + synchronize(process_group(g)); + return out; +} + +template +inline OutputIterator +merge_local_minimum_spanning_trees(const Graph& g, WeightMap weight, + OutputIterator out) +{ + return merge_local_minimum_spanning_trees(g, weight, out, + get(vertex_index, g)); +} + +// --------------------------------------------------------------------- +// Boruvka-then-merge MSF algorithm +// --------------------------------------------------------------------- +template +OutputIterator +boruvka_then_merge(const Graph& g, WeightMap weight, OutputIterator out, + GlobalIndexMap index, RankMap rank_map, + ParentMap parent_map, SupervertexMap supervertex_map) +{ + using std::log; + using boost::graph::parallel::process_group_type; + using boost::graph::parallel::process_group; + + typedef typename graph_traits::traversal_category traversal_category; + + BOOST_STATIC_ASSERT((is_convertible::value)); + + typedef typename graph_traits::vertices_size_type vertices_size_type; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::edge_descriptor edge_descriptor; + + // Don't throw away cached edge weights + weight.set_max_ghost_cells(0); + + // Compute the initial local minimum spanning forests + std::vector edge_list; + kruskal_minimum_spanning_tree + (make_vertex_and_edge_range(g, vertices(g).first, vertices(g).second, + edges(g).first, edges(g).second), + std::back_inserter(edge_list), + boost::weight_map(weight). + vertex_index_map(index)); + + // Initialize the disjoint sets structures for Boruvka steps + disjoint_sets dset(rank_map, parent_map); + vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + dset.make_set(*vi); + + // Construct the initial set of supervertices (all vertices) + std::vector supervertices; + supervertices.assign(vertices(g).first, vertices(g).second); + + // Continue performing Boruvka merge steps until the number of + // supervertices reaches |V| / (log_D p)^2. + const std::size_t tree_factor = 3; // TBD: same as above! should be param + double log_d_p = log((double)num_processes(process_group(g))) + / log((double)tree_factor); + vertices_size_type target_supervertices = + vertices_size_type(num_vertices(g) / (log_d_p * log_d_p)); + vertices_size_type old_num_supervertices; + while (supervertices.size() > target_supervertices) { + old_num_supervertices = supervertices.size(); + out = detail::boruvka_merge_step(process_group(g), g, + weight, out, dset, + supervertex_map, supervertices, + edge_list); + if (supervertices.size() == old_num_supervertices) + return out; + } + + // Renumber the supervertices + for (std::size_t i = 0; i < supervertices.size(); ++i) + put(supervertex_map, supervertices[i], i); + + // Merge local MSFs on the supervertices. (D-1)p/D processors drop + // out each iteration, so this loop executes log_D p times. + typename process_group_type::type pg = process_group(g); + bool have_msf = false; + while (pg && num_processes(pg) > 1) { + pg = detail::merge_local_minimum_spanning_trees_step + (pg, g, supervertices.begin(), supervertices.end(), + edge_list, weight, supervertex_map, + detail::make_supervertex_edge_descriptor(g, dset), + have_msf); + have_msf = true; + } + + // Only process 0 has the complete list of _supervertex_ MST edges, + // so emit those to the output iterator. This is not the complete + // list of edges in the MSF, however: the Boruvka steps in the + // beginning of the algorithm emitted any edges used to merge + // supervertices. + if (pg && process_id(pg) == 0) + out = std::copy(edge_list.begin(), edge_list.end(), out); + + synchronize(process_group(g)); + return out; +} + +template +inline OutputIterator +boruvka_then_merge(const Graph& g, WeightMap weight, OutputIterator out, + GlobalIndexMap index) +{ + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::vertices_size_type vertices_size_type; + std::vector ranks(num_vertices(g)); + std::vector parents(num_vertices(g)); + std::vector supervertex_indices(num_vertices(g)); + + return boruvka_then_merge + (g, weight, out, index, + make_iterator_property_map(ranks.begin(), index), + make_iterator_property_map(parents.begin(), index), + make_iterator_property_map(supervertex_indices.begin(), index)); +} + +template +inline OutputIterator +boruvka_then_merge(const Graph& g, WeightMap weight, OutputIterator out) +{ return boruvka_then_merge(g, weight, out, get(vertex_index, g)); } + +// --------------------------------------------------------------------- +// Boruvka-mixed-merge MSF algorithm +// --------------------------------------------------------------------- +template +OutputIterator +boruvka_mixed_merge(const Graph& g, WeightMap weight, OutputIterator out, + GlobalIndexMap index, RankMap rank_map, + ParentMap parent_map, SupervertexMap supervertex_map) +{ + using boost::graph::parallel::process_group_type; + using boost::graph::parallel::process_group; + + typedef typename graph_traits::traversal_category traversal_category; + + BOOST_STATIC_ASSERT((is_convertible::value)); + + typedef typename graph_traits::vertices_size_type vertices_size_type; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::edge_descriptor edge_descriptor; + + // Don't throw away cached edge weights + weight.set_max_ghost_cells(0); + + // Initialize the disjoint sets structures for Boruvka steps + disjoint_sets dset(rank_map, parent_map); + vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + dset.make_set(*vi); + + // Construct the initial set of supervertices (all vertices) + std::vector supervertices; + supervertices.assign(vertices(g).first, vertices(g).second); + + // Compute the initial local minimum spanning forests + std::vector edge_list; + kruskal_minimum_spanning_tree + (make_vertex_and_edge_range(g, vertices(g).first, vertices(g).second, + edges(g).first, edges(g).second), + std::back_inserter(edge_list), + boost::weight_map(weight). + vertex_index_map(index)); + + if (num_processes(process_group(g)) == 1) { + return std::copy(edge_list.begin(), edge_list.end(), out); + } + + // Like the merging local MSFs algorithm and the Boruvka-then-merge + // algorithm, each iteration of this loop reduces the number of + // processes by a constant factor D, and therefore we require log_D + // p iterations. Note also that the number of edges in the edge list + // decreases geometrically, giving us an efficient distributed MSF + // algorithm. + typename process_group_type::type pg = process_group(g); + vertices_size_type old_num_supervertices; + while (pg && num_processes(pg) > 1) { + // A single Boruvka step. If this doesn't change anything, we're done + old_num_supervertices = supervertices.size(); + out = detail::boruvka_merge_step(pg, g, weight, out, dset, + supervertex_map, supervertices, + edge_list); + if (old_num_supervertices == supervertices.size()) { + edge_list.clear(); + break; + } + + // Renumber the supervertices + for (std::size_t i = 0; i < supervertices.size(); ++i) + put(supervertex_map, supervertices[i], i); + + // A single merging of local MSTs, which reduces the number of + // processes we're using by a constant factor D. + pg = detail::merge_local_minimum_spanning_trees_step + (pg, g, supervertices.begin(), supervertices.end(), + edge_list, weight, supervertex_map, + detail::make_supervertex_edge_descriptor(g, dset), + true); + + } + + // Only process 0 has the complete edge list, so emit it for the + // user. Note that list edge list only contains the MSF edges in the + // final supervertex graph: all of the other edges were used to + // merge supervertices and have been emitted by the Boruvka steps, + // although only process 0 has received the complete set. + if (pg && process_id(pg) == 0) + out = std::copy(edge_list.begin(), edge_list.end(), out); + + synchronize(process_group(g)); + return out; +} + +template +inline OutputIterator +boruvka_mixed_merge(const Graph& g, WeightMap weight, OutputIterator out, + GlobalIndexMap index) +{ + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::vertices_size_type vertices_size_type; + std::vector ranks(num_vertices(g)); + std::vector parents(num_vertices(g)); + std::vector supervertex_indices(num_vertices(g)); + + return boruvka_mixed_merge + (g, weight, out, index, + make_iterator_property_map(ranks.begin(), index), + make_iterator_property_map(parents.begin(), index), + make_iterator_property_map(supervertex_indices.begin(), index)); +} + +template +inline OutputIterator +boruvka_mixed_merge(const Graph& g, WeightMap weight, OutputIterator out) +{ return boruvka_mixed_merge(g, weight, out, get(vertex_index, g)); } + +} // end namespace distributed + +using distributed::dense_boruvka_minimum_spanning_tree; +using distributed::merge_local_minimum_spanning_trees; +using distributed::boruvka_then_merge; +using distributed::boruvka_mixed_merge; + +} } // end namespace boost::graph + + +#endif // BOOST_DEHNE_GOTZ_MIN_SPANNING_TREE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/delta_stepping_shortest_paths.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/delta_stepping_shortest_paths.hpp new file mode 100644 index 0000000000..ab1655b474 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/delta_stepping_shortest_paths.hpp @@ -0,0 +1,513 @@ +// Copyright (C) 2007 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 + +/************************************************************************** + * This source file implements the Delta-stepping algorithm: * + * * + * Ulrich Meyer and Peter Sanders. Parallel Shortest Path for Arbitrary * + * Graphs. In Proceedings from the 6th International Euro-Par * + * Conference on Parallel Processing, pages 461--470, 2000. * + * * + * Ulrich Meyer, Peter Sanders: [Delta]-stepping: A Parallelizable * + * Shortest Path Algorithm. J. Algorithms 49(1): 114-152, 2003. * + * * + * There are several potential optimizations we could still perform for * + * this algorithm implementation: * + * * + * - Implement "shortcuts", which bound the number of reinsertions * + * in a single bucket (to one). The computation of shortcuts looks * + * expensive in a distributed-memory setting, but it could be * + * ammortized over many queries. * + * * + * - The size of the "buckets" data structure can be bounded to * + * max_edge_weight/delta buckets, if we treat the buckets as a * + * circular array. * + * * + * - If we partition light/heavy edges ahead of time, we could improve * + * relaxation performance by only iterating over the right portion * + * of the out-edge list each time. * + * * + * - Implement a more sophisticated algorithm for guessing "delta", * + * based on the shortcut-finding algorithm. * + **************************************************************************/ +#ifndef BOOST_GRAPH_DELTA_STEPPING_SHORTEST_PATHS_HPP +#define BOOST_GRAPH_DELTA_STEPPING_SHORTEST_PATHS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for std::pair +#include // for std::logical_or +#include // for all_reduce +#include +#include // for std::min, std::max +#include + +#ifdef PBGL_DELTA_STEPPING_DEBUG +# include // for std::cerr +#endif + +namespace boost { namespace graph { namespace distributed { + +template +class delta_stepping_impl { + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::degree_size_type Degree; + typedef typename property_traits::value_type Dist; + typedef typename boost::graph::parallel::process_group_type::type + ProcessGroup; + + typedef std::list Bucket; + typedef typename Bucket::iterator BucketIterator; + typedef typename std::vector::size_type BucketIndex; + + typedef detail::dijkstra_msg_value MessageValue; + + enum { + // Relax a remote vertex. The message contains a pair, the first part of which is the vertex whose + // tentative distance is being relaxed and the second part + // contains either the new distance (if there is no predecessor + // map) or a pair with the distance and predecessor. + msg_relax + }; + +public: + delta_stepping_impl(const Graph& g, + PredecessorMap predecessor, + DistanceMap distance, + EdgeWeightMap weight, + Dist delta); + + delta_stepping_impl(const Graph& g, + PredecessorMap predecessor, + DistanceMap distance, + EdgeWeightMap weight); + + void run(Vertex s); + +private: + // Relax the edge (u, v), creating a new best path of distance x. + void relax(Vertex u, Vertex v, Dist x); + + // Synchronize all of the processes, by receiving all messages that + // have not yet been received. + void synchronize(); + + // Handle a relax message that contains only the target and + // distance. This kind of message will be received when the + // predecessor map is a dummy_property_map. + void handle_relax_message(Vertex v, Dist x) { relax(v, v, x); } + + // Handle a relax message that contains the source (predecessor), + // target, and distance. This kind of message will be received when + // the predecessor map is not a dummy_property_map. + void handle_relax_message(Vertex v, const std::pair& p) + { relax(p.second, v, p.first); } + + // Setup triggers for msg_relax messages + void setup_triggers(); + + void handle_msg_relax(int /*source*/, int /*tag*/, + const std::pair& data, + trigger_receive_context) + { handle_relax_message(data.first, data.second); } + + const Graph& g; + PredecessorMap predecessor; + DistanceMap distance; + EdgeWeightMap weight; + Dist delta; + ProcessGroup pg; + typename property_map::const_type owner; + typename property_map::const_type local; + + // A "property map" that contains the position of each vertex in + // whatever bucket it resides in. + std::vector position_in_bucket; + + // Bucket data structure. The ith bucket contains all local vertices + // with (tentative) distance in the range [i*delta, + // (i+1)*delta). + std::vector buckets; + + // This "dummy" list is used only so that we can initialize the + // position_in_bucket property map with non-singular iterators. This + // won't matter for most implementations of the C++ Standard + // Library, but it avoids undefined behavior and allows us to run + // with library "debug modes". + std::list dummy_list; + + // A "property map" that states which vertices have been deleted + // from the bucket in this iteration. + std::vector vertex_was_deleted; +}; + +template +delta_stepping_impl:: +delta_stepping_impl(const Graph& g, + PredecessorMap predecessor, + DistanceMap distance, + EdgeWeightMap weight, + Dist delta) + : g(g), + predecessor(predecessor), + distance(distance), + weight(weight), + delta(delta), + pg(boost::graph::parallel::process_group_adl(g), attach_distributed_object()), + owner(get(vertex_owner, g)), + local(get(vertex_local, g)) +{ + setup_triggers(); +} + +template +delta_stepping_impl:: +delta_stepping_impl(const Graph& g, + PredecessorMap predecessor, + DistanceMap distance, + EdgeWeightMap weight) + : g(g), + predecessor(predecessor), + distance(distance), + weight(weight), + pg(boost::graph::parallel::process_group_adl(g), attach_distributed_object()), + owner(get(vertex_owner, g)), + local(get(vertex_local, g)) +{ + using boost::parallel::all_reduce; + using boost::parallel::maximum; + using std::max; + + // Compute the maximum edge weight and degree + Dist max_edge_weight = 0; + Degree max_degree = 0; + BGL_FORALL_VERTICES_T(u, g, Graph) { + max_degree = max BOOST_PREVENT_MACRO_SUBSTITUTION (max_degree, out_degree(u, g)); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + max_edge_weight = max BOOST_PREVENT_MACRO_SUBSTITUTION (max_edge_weight, get(weight, e)); + } + + max_edge_weight = all_reduce(pg, max_edge_weight, maximum()); + max_degree = all_reduce(pg, max_degree, maximum()); + + // Take a guess at delta, based on what works well for random + // graphs. + delta = max_edge_weight / max_degree; + if (delta == 0) + delta = 1; + + setup_triggers(); +} + +template +void +delta_stepping_impl:: +run(Vertex s) +{ + Dist inf = (std::numeric_limits::max)(); + + // None of the vertices are stored in the bucket. + position_in_bucket.clear(); + position_in_bucket.resize(num_vertices(g), dummy_list.end()); + + // None of the vertices have been deleted + vertex_was_deleted.clear(); + vertex_was_deleted.resize(num_vertices(g), false); + + // No path from s to any other vertex, yet + BGL_FORALL_VERTICES_T(v, g, Graph) + put(distance, v, inf); + + // The distance to the starting node is zero + if (get(owner, s) == process_id(pg)) + // Put "s" into its bucket (bucket 0) + relax(s, s, 0); + else + // Note that we know the distance to s is zero + cache(distance, s, 0); + + BucketIndex max_bucket = (std::numeric_limits::max)(); + BucketIndex current_bucket = 0; + do { + // Synchronize with all of the other processes. + synchronize(); + + // Find the next bucket that has something in it. + while (current_bucket < buckets.size() + && (!buckets[current_bucket] || buckets[current_bucket]->empty())) + ++current_bucket; + if (current_bucket >= buckets.size()) + current_bucket = max_bucket; + +#ifdef PBGL_DELTA_STEPPING_DEBUG + std::cerr << "#" << process_id(pg) << ": lowest bucket is #" + << current_bucket << std::endl; +#endif + // Find the smallest bucket (over all processes) that has vertices + // that need to be processed. + using boost::parallel::all_reduce; + using boost::parallel::minimum; + current_bucket = all_reduce(pg, current_bucket, minimum()); + + if (current_bucket == max_bucket) + // There are no non-empty buckets in any process; exit. + break; + +#ifdef PBGL_DELTA_STEPPING_DEBUG + if (process_id(pg) == 0) + std::cerr << "Processing bucket #" << current_bucket << std::endl; +#endif + + // Contains the set of vertices that have been deleted in the + // relaxation of "light" edges. Note that we keep track of which + // vertices were deleted with the property map + // "vertex_was_deleted". + std::vector deleted_vertices; + + // Repeatedly relax light edges + bool nonempty_bucket; + do { + // Someone has work to do in this bucket. + + if (current_bucket < buckets.size() && buckets[current_bucket]) { + Bucket& bucket = *buckets[current_bucket]; + // For each element in the bucket + while (!bucket.empty()) { + Vertex u = bucket.front(); + +#ifdef PBGL_DELTA_STEPPING_DEBUG + std::cerr << "#" << process_id(pg) << ": processing vertex " + << get(vertex_global, g, u).second << "@" + << get(vertex_global, g, u).first + << std::endl; +#endif + + // Remove u from the front of the bucket + bucket.pop_front(); + + // Insert u into the set of deleted vertices, if it hasn't + // been done already. + if (!vertex_was_deleted[get(local, u)]) { + vertex_was_deleted[get(local, u)] = true; + deleted_vertices.push_back(u); + } + + // Relax each light edge. + Dist u_dist = get(distance, u); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + if (get(weight, e) <= delta) // light edge + relax(u, target(e, g), u_dist + get(weight, e)); + } + } + + // Synchronize with all of the other processes. + synchronize(); + + // Is the bucket empty now? + nonempty_bucket = (current_bucket < buckets.size() + && buckets[current_bucket] + && !buckets[current_bucket]->empty()); + } while (all_reduce(pg, nonempty_bucket, std::logical_or())); + + // Relax heavy edges for each of the vertices that we previously + // deleted. + for (typename std::vector::iterator iter = deleted_vertices.begin(); + iter != deleted_vertices.end(); ++iter) { + // Relax each heavy edge. + Vertex u = *iter; + Dist u_dist = get(distance, u); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + if (get(weight, e) > delta) // heavy edge + relax(u, target(e, g), u_dist + get(weight, e)); + } + + // Go to the next bucket: the current bucket must already be empty. + ++current_bucket; + } while (true); + + // Delete all of the buckets. + for (typename std::vector::iterator iter = buckets.begin(); + iter != buckets.end(); ++iter) { + if (*iter) { + delete *iter; + *iter = 0; + } + } +} + +template +void +delta_stepping_impl:: +relax(Vertex u, Vertex v, Dist x) +{ +#ifdef PBGL_DELTA_STEPPING_DEBUG + std::cerr << "#" << process_id(pg) << ": relax(" + << get(vertex_global, g, u).second << "@" + << get(vertex_global, g, u).first << ", " + << get(vertex_global, g, v).second << "@" + << get(vertex_global, g, v).first << ", " + << x << ")" << std::endl; +#endif + + if (x < get(distance, v)) { + // We're relaxing the edge to vertex v. + if (get(owner, v) == process_id(pg)) { + // Compute the new bucket index for v + BucketIndex new_index = static_cast(x / delta); + + // Make sure there is enough room in the buckets data structure. + if (new_index >= buckets.size()) buckets.resize(new_index + 1, 0); + + // Make sure that we have allocated the bucket itself. + if (!buckets[new_index]) buckets[new_index] = new Bucket; + + if (get(distance, v) != (std::numeric_limits::max)() + && !vertex_was_deleted[get(local, v)]) { + // We're moving v from an old bucket into a new one. Compute + // the old index, then splice it in. + BucketIndex old_index + = static_cast(get(distance, v) / delta); + buckets[new_index]->splice(buckets[new_index]->end(), + *buckets[old_index], + position_in_bucket[get(local, v)]); + } else { + // We're inserting v into a bucket for the first time. Put it + // at the end. + buckets[new_index]->push_back(v); + } + + // v is now at the last position in the new bucket + position_in_bucket[get(local, v)] = buckets[new_index]->end(); + --position_in_bucket[get(local, v)]; + + // Update predecessor and tentative distance information + put(predecessor, v, u); + put(distance, v, x); + } else { +#ifdef PBGL_DELTA_STEPPING_DEBUG + std::cerr << "#" << process_id(pg) << ": sending relax(" + << get(vertex_global, g, u).second << "@" + << get(vertex_global, g, u).first << ", " + << get(vertex_global, g, v).second << "@" + << get(vertex_global, g, v).first << ", " + << x << ") to " << get(owner, v) << std::endl; + +#endif + // The vertex is remote: send a request to the vertex's owner + send(pg, get(owner, v), msg_relax, + std::make_pair(v, MessageValue::create(x, u))); + + // Cache tentative distance information + cache(distance, v, x); + } + } +} + +template +void +delta_stepping_impl:: +synchronize() +{ + using boost::graph::parallel::synchronize; + + // Synchronize at the process group level. + synchronize(pg); + + // Receive any relaxation request messages. +// typedef typename ProcessGroup::process_id_type process_id_type; +// while (optional > stp = probe(pg)) { +// // Receive the relaxation message +// assert(stp->second == msg_relax); +// std::pair data; +// receive(pg, stp->first, stp->second, data); + +// // Turn it into a "relax" call +// handle_relax_message(data.first, data.second); +// } +} + +template +void +delta_stepping_impl:: +setup_triggers() +{ + using boost::graph::parallel::simple_trigger; + + simple_trigger(pg, msg_relax, this, + &delta_stepping_impl::handle_msg_relax); +} + +template +void +delta_stepping_shortest_paths + (const Graph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, EdgeWeightMap weight, + typename property_traits::value_type delta) +{ + // The "distance" map needs to act like one, retrieving the default + // value of infinity. + set_property_map_role(vertex_distance, distance); + + // Construct the implementation object, which will perform all of + // the actual work. + delta_stepping_impl + impl(g, predecessor, distance, weight, delta); + + // Run the delta-stepping algorithm. The results will show up in + // "predecessor" and "weight". + impl.run(s); +} + +template +void +delta_stepping_shortest_paths + (const Graph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, EdgeWeightMap weight) +{ + // The "distance" map needs to act like one, retrieving the default + // value of infinity. + set_property_map_role(vertex_distance, distance); + + // Construct the implementation object, which will perform all of + // the actual work. + delta_stepping_impl + impl(g, predecessor, distance, weight); + + // Run the delta-stepping algorithm. The results will show up in + // "predecessor" and "weight". + impl.run(s); +} + +} } } // end namespace boost::graph::distributed + +#endif // BOOST_GRAPH_DELTA_STEPPING_SHORTEST_PATHS_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/depth_first_search.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/depth_first_search.hpp new file mode 100644 index 0000000000..b6d49c5e96 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/depth_first_search.hpp @@ -0,0 +1,306 @@ +// Copyright (C) 2004-2008 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_DFS_HPP +#define BOOST_GRAPH_DISTRIBUTED_DFS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + namespace graph { namespace distributed { namespace detail { + template + class parallel_dfs + { + typedef typename graph_traits::vertex_iterator + vertex_iterator; + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + typedef typename graph_traits::out_edge_iterator + out_edge_iterator; + + typedef typename boost::graph::parallel::process_group_type + ::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + + /** + * The first vertex in the pair is the local node (i) and the + * second vertex in the pair is the (possibly remote) node (j). + */ + typedef boost::parallel::detail::untracked_pair vertex_pair; + + typedef typename property_traits::value_type color_type; + typedef color_traits Color; + + // Message types + enum { discover_msg = 10, return_msg = 50, visited_msg = 100 , done_msg = 150}; + + + public: + parallel_dfs(const DistributedGraph& g, ColorMap color, + ParentMap parent, ExploreMap explore, + VertexIndexMap index_map, DFSVisitor vis) + : g(g), color(color), parent(parent), explore(explore), + index_map(index_map), vis(vis), pg(process_group(g)), + owner(get(vertex_owner, g)), next_out_edge(num_vertices(g)) + { } + + void run(vertex_descriptor s) + { + vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { + put(color, *vi, Color::white()); + put(parent, *vi, *vi); + put(explore, *vi, *vi); + next_out_edge[get(index_map, *vi)] = out_edges(*vi, g).first; + vis.initialize_vertex(*vi, g); + } + + vis.start_vertex(s, g); + + if (get(owner, s) == process_id(pg)) { + send_oob(pg, get(owner, s), discover_msg, vertex_pair(s, s)); + } + + bool done = false; + while (!done) { + std::pair msg = *pg.poll(true); + + switch (msg.second) { + case discover_msg: + { + vertex_pair p; + receive_oob(pg, msg.first, msg.second, p); + + if (p.first != p.second) { + // delete j from nomessage(j) + if (get(color, p.second) != Color::black()) + local_put(color, p.second, Color::gray()); + + if (recover(p)) break; + } + + if (get(color, p.first) == Color::white()) { + put(color, p.first, Color::gray()); + put(parent, p.first, p.second); + + vis.discover_vertex(p.first, g); + + if (shift_center_of_activity(p.first)) break; + + out_edge_iterator ei, ei_end; + for (tie(ei,ei_end) = out_edges(p.first, g); ei != ei_end; ++ei) + { + // Notify everyone who may not know that the source + // vertex has been visited. They can then mark the + // corresponding color map entry gray. + if (get(parent, p.first) != target(*ei, g) + && get(explore, p.first) != target(*ei, g)) { + vertex_pair visit(target(*ei, g), p.first); + + send_oob(pg, get(owner, target(*ei, g)), visited_msg, visit); + } + } + } + } + break; + + case visited_msg: + { + vertex_pair p; + receive_oob(pg, msg.first, msg.second, p); + + // delete j from nomessage(j) + if (get(color, p.second) != Color::black()) + local_put(color, p.second, Color::gray()); + + recover(p); + } + break; + + case return_msg: + { + vertex_pair p; + receive_oob(pg, msg.first, msg.second, p); + + // delete j from nomessage(i) + local_put(color, p.second, Color::black()); + + shift_center_of_activity(p.first); + } + break; + + case done_msg: + { + receive_oob(pg, msg.first, msg.second, done); + + // Propagate done message downward in tree + done = true; + process_id_type id = process_id(pg); + process_id_type left = 2*id + 1; + process_id_type right = left + 1; + if (left < num_processes(pg)) + send_oob(pg, left, done_msg, done); + if (right < num_processes(pg)) + send_oob(pg, right, done_msg, done); + } + break; + + default: + assert(false); + } + } + } + + private: + bool recover(const vertex_pair& p) + { + if (get(explore, p.first) == p.second) { + return shift_center_of_activity(p.first); + } + else + return false; + } + + bool shift_center_of_activity(vertex_descriptor i) + { + for (out_edge_iterator ei = next_out_edge[get(index_map, i)], + ei_end = out_edges(i, g).second; + ei != ei_end; ++ei) { + vis.examine_edge(*ei, g); + + vertex_descriptor k = target(*ei, g); + color_type target_color = get(color, k); + if (target_color == Color::black()) vis.forward_or_cross_edge(*ei, g); + else if (target_color == Color::gray()) vis.back_edge(*ei, g); + else { + put(explore, i, k); + vis.tree_edge(*ei, g); + vertex_pair p(k, i); + send_oob(pg, get(owner, k), discover_msg, p); + next_out_edge[get(index_map, i)] = ++ei; + return false; + } + } + + next_out_edge[get(index_map, i)] = out_edges(i, g).second; + put(explore, i, i); + put(color, i, Color::black()); + vis.finish_vertex(i, g); + + if (get(parent, i) == i) { + send_oob(pg, 0, done_msg, true); + return true; + } + else { + vertex_pair ret(get(parent, i), i); + send_oob(pg, get(owner, ret.first), return_msg, ret); + } + return false; + } + + const DistributedGraph& g; + ColorMap color; + ParentMap parent; + ExploreMap explore; + VertexIndexMap index_map; + DFSVisitor vis; + process_group_type pg; + typename property_map::const_type owner; + std::vector next_out_edge; + }; + } // end namespace detail + + template + void + tsin_depth_first_visit + (const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + DFSVisitor vis, ColorMap color, ParentMap parent, ExploreMap explore, + VertexIndexMap index_map) + { + typedef typename graph_traits::directed_category + directed_category; + BOOST_STATIC_ASSERT( + (is_convertible::value)); + + set_property_map_role(vertex_color, color); + graph::distributed::detail::parallel_dfs + do_dfs(g, color, parent, explore, index_map, vis); + do_dfs.run(s); + + using boost::graph::parallel::process_group; + synchronize(process_group(g)); + } + + template + void + tsin_depth_first_visit + (const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + DFSVisitor vis, + VertexIndexMap index_map) + { + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + + std::vector colors(num_vertices(g)); + std::vector parent(num_vertices(g)); + std::vector explore(num_vertices(g)); + tsin_depth_first_visit + (g, s, + vis, + make_iterator_property_map(colors.begin(), index_map), + make_iterator_property_map(parent.begin(), index_map), + make_iterator_property_map(explore.begin(), index_map), + index_map); + } + + template + void + tsin_depth_first_visit + (const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + DFSVisitor vis) + { + tsin_depth_first_visit(g, s, vis, get(vertex_index, g)); + } +} // end namespace distributed + +using distributed::tsin_depth_first_visit; + +} // end namespace graph + +template +void +depth_first_visit + (const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + DFSVisitor vis) +{ + graph::tsin_depth_first_visit(g, s, vis, get(vertex_index, g)); +} + +} // end namespace boost + +#endif // BOOST_GRAPH_DISTRIBUTED_DFS_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/dijkstra_shortest_paths.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/dijkstra_shortest_paths.hpp new file mode 100644 index 0000000000..0597689167 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/dijkstra_shortest_paths.hpp @@ -0,0 +1,50 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP +#define BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include + +namespace boost { namespace graph { namespace distributed { namespace detail { + +/********************************************************************** + * Dijkstra queue message data * + **********************************************************************/ +template +class dijkstra_msg_value +{ + typedef typename property_traits::value_type distance_type; + typedef typename property_traits::value_type + predecessor_type; + +public: + typedef std::pair type; + + static type create(distance_type dist, predecessor_type pred) + { return std::make_pair(dist, pred); } +}; + +template +class dijkstra_msg_value +{ + typedef typename property_traits::key_type vertex_descriptor; +public: + typedef typename property_traits::value_type type; + + static type create(type dist, vertex_descriptor) { return dist; } +}; +/**********************************************************************/ + +} } } } // end namespace boost::graph::distributed::detail + +#endif // BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/filtered_queue.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/filtered_queue.hpp new file mode 100644 index 0000000000..9871b70daf --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/filtered_queue.hpp @@ -0,0 +1,108 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_FILTERED_QUEUE_HPP +#define BOOST_FILTERED_QUEUE_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include + +namespace boost { + +/** Queue adaptor that filters elements pushed into the queue + * according to some predicate. + */ +template +class filtered_queue +{ + public: + typedef Buffer buffer_type; + typedef Predicate predicate_type; + typedef typename Buffer::value_type value_type; + typedef typename Buffer::size_type size_type; + + /** + * Constructs a new filtered queue with an initial buffer and a + * predicate. + * + * @param buffer the initial buffer + * @param pred the predicate + */ + explicit + filtered_queue(const buffer_type& buffer = buffer_type(), + const predicate_type& pred = predicate_type()) + : buffer(buffer), pred(pred) {} + + /** Push a value into the queue. + * + * If the predicate returns @c true for @p x, pushes @p x into the + * buffer. + */ + void push(const value_type& x) { if (pred(x)) buffer.push(x); } + + /** Pop the front element off the buffer. + * + * @pre @c !empty() + */ + void pop() { buffer.pop(); } + + /** Retrieve the front (top) element in the buffer. + * + * @pre @c !empty() + */ + value_type& top() { return buffer.top(); } + + /** + * \overload + */ + const value_type& top() const { return buffer.top(); } + + /** Determine the number of elements in the buffer. */ + size_type size() const { return buffer.size(); } + + /** Determine if the buffer is empty. */ + bool empty() const { return buffer.empty(); } + + /** Get a reference to the underlying buffer. */ + buffer_type& base() { return buffer; } + const buffer_type& base() const { return buffer; } + + /** Swap the contents of this with @p other. */ + void swap(filtered_queue& other) + { + using std::swap; + swap(buffer, other.buffer); + swap(pred, other.pred); + } + + private: + buffer_type buffer; + predicate_type pred; +}; + +/** Create a filtered queue. */ +template +inline filtered_queue +make_filtered_queue(const Buffer& buffer, const Predicate& pred) +{ return filtered_queue(buffer, pred); } + +/** Swap a filtered_queue. */ +template +inline void +swap(filtered_queue& x, + filtered_queue& y) +{ + x.swap(y); +} + +} // end namespace boost + +#endif // BOOST_FILTERED_QUEUE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/mpi_process_group.ipp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/mpi_process_group.ipp new file mode 100644 index 0000000000..95ee21f162 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/mpi_process_group.ipp @@ -0,0 +1,1006 @@ +// -*- C++ -*- + +// Copyright (C) 2004-2008 The Trustees of Indiana University. +// Copyright (C) 2007 Douglas Gregor +// Copyright (C) 2007 Matthias Troyer + +// 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 +// Matthias Troyer + +//#define PBGL_PROCESS_GROUP_DEBUG + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// #define PBGL_PROCESS_GROUP_DEBUG + +#ifdef PBGL_PROCESS_GROUP_DEBUG +# include +#endif + +namespace boost { namespace graph { namespace distributed { + +struct mpi_process_group::impl +{ + + typedef mpi_process_group::message_header message_header; + typedef mpi_process_group::outgoing_messages outgoing_messages; + + /** + * Stores the incoming messages from a particular processor. + * + * @todo Evaluate whether we should use a deque instance, which + * would reduce could reduce the cost of "receiving" messages and + allow us to deallocate memory earlier, but increases the time + spent in the synchronization step. + */ + struct incoming_messages { + incoming_messages(); + ~incoming_messages() {} + + std::vector headers; + buffer_type buffer; + std::vector::iterator> next_header; + }; + + struct batch_request { + MPI_Request request; + buffer_type buffer; + }; + + // send once we have a certain number of messages or bytes in the buffer + // these numbers need to be tuned, we keep them small at first for testing + std::size_t batch_header_number; + std::size_t batch_buffer_size; + std::size_t batch_message_size; + + /** + * The actual MPI communicator used to transmit data. + */ + boost::mpi::communicator comm; + + /** + * The MPI communicator used to transmit out-of-band replies. + */ + boost::mpi::communicator oob_reply_comm; + + /// Outgoing message information, indexed by destination processor. + std::vector outgoing; + + /// Incoming message information, indexed by source processor. + std::vector incoming; + + /// The numbers of processors that have entered a synchronization stage + std::vector processors_synchronizing_stage; + + /// The synchronization stage of a processor + std::vector synchronizing_stage; + + /// Number of processors still sending messages + std::vector synchronizing_unfinished; + + /// Number of batches sent since last synchronization stage + std::vector number_sent_batches; + + /// Number of batches received minus number of expected batches + std::vector number_received_batches; + + + /// The context of the currently-executing trigger, or @c trc_none + /// if no trigger is executing. + trigger_receive_context trigger_context; + + /// Non-zero indicates that we're processing batches + /// Increment this when processing patches, + /// decrement it when you're done. + int processing_batches; + + /** + * Contains all of the active blocks corresponding to attached + * distributed data structures. + */ + blocks_type blocks; + + /// Whether we are currently synchronizing + bool synchronizing; + + /// The MPI requests for posted sends of oob messages + std::vector requests; + + /// The MPI buffers for posted irecvs of oob messages + std::map buffers; + + /// Queue for message batches received while already processing messages + std::queue > new_batches; + /// Maximum encountered size of the new_batches queue + std::size_t max_received; + + /// The MPI requests and buffers for batchess being sent + std::list sent_batches; + /// Maximum encountered size of the sent_batches list + std::size_t max_sent; + + /// Pre-allocated requests in a pool + std::vector batch_pool; + /// A stack controlling which batches are available + std::stack free_batches; + + void free_sent_batches(); + + // Tag allocator + detail::tag_allocator allocated_tags; + + impl(std::size_t num_headers, std::size_t buffers_size, + communicator_type parent_comm); + ~impl(); + +private: + void set_batch_size(std::size_t header_num, std::size_t buffer_sz); +}; + +inline trigger_receive_context mpi_process_group::trigger_context() const +{ + return impl_->trigger_context; +} + +template +void +mpi_process_group::send_impl(int dest, int tag, const T& value, + mpl::true_ /*is_mpi_datatype*/) const +{ + assert(tag < msg_reserved_first || tag > msg_reserved_last); + + impl::outgoing_messages& outgoing = impl_->outgoing[dest]; + + // Start constructing the message header + impl::message_header header; + header.source = process_id(*this); + header.tag = tag; + header.offset = outgoing.buffer.size(); + + boost::mpi::packed_oarchive oa(impl_->comm, outgoing.buffer); + oa << value; + +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << "SEND: " << process_id(*this) << " -> " << dest << ", tag = " + << tag << ", bytes = " << packed_size << std::endl; +#endif + + // Store the header + header.bytes = outgoing.buffer.size() - header.offset; + outgoing.headers.push_back(header); + + maybe_send_batch(dest); +} + + +template +void +mpi_process_group::send_impl(int dest, int tag, const T& value, + mpl::false_ /*is_mpi_datatype*/) const +{ + assert(tag < msg_reserved_first || tag > msg_reserved_last); + + impl::outgoing_messages& outgoing = impl_->outgoing[dest]; + + // Start constructing the message header + impl::message_header header; + header.source = process_id(*this); + header.tag = tag; + header.offset = outgoing.buffer.size(); + + // Serialize into the buffer + boost::mpi::packed_oarchive out(impl_->comm, outgoing.buffer); + out << value; + + // Store the header + header.bytes = outgoing.buffer.size() - header.offset; + outgoing.headers.push_back(header); + maybe_send_batch(dest); + +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << "SEND: " << process_id(*this) << " -> " << dest << ", tag = " + << tag << ", bytes = " << header.bytes << std::endl; +#endif +} + +template +inline void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T& value) +{ + pg.send_impl(dest, pg.encode_tag(pg.my_block_number(), tag), value, + boost::mpi::is_mpi_datatype()); +} + +template +typename enable_if, void>::type +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T values[], std::size_t n) +{ + pg.send_impl(dest, pg.encode_tag(pg.my_block_number(), tag), + boost::serialization::make_array(values,n), + boost::mpl::true_()); +} + +template +typename disable_if, void>::type +mpi_process_group:: +array_send_impl(int dest, int tag, const T values[], std::size_t n) const +{ + assert(tag < msg_reserved_first || tag > msg_reserved_last); + + impl::outgoing_messages& outgoing = impl_->outgoing[dest]; + + // Start constructing the message header + impl::message_header header; + header.source = process_id(*this); + header.tag = tag; + header.offset = outgoing.buffer.size(); + + // Serialize into the buffer + boost::mpi::packed_oarchive out(impl_->comm, outgoing.buffer); + out << n; + + for (std::size_t i = 0; i < n; ++i) + out << values[i]; + + // Store the header + header.bytes = outgoing.buffer.size() - header.offset; + outgoing.headers.push_back(header); + maybe_send_batch(dest); + +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << "SEND: " << process_id(*this) << " -> " << dest << ", tag = " + << tag << ", bytes = " << header.bytes << std::endl; +#endif +} + +template +typename disable_if, void>::type +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T values[], std::size_t n) +{ + pg.array_send_impl(dest, pg.encode_tag(pg.my_block_number(), tag), + values, n); +} + +template +void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, InputIterator first, InputIterator last) +{ + typedef typename std::iterator_traits::value_type value_type; + std::vector values(first, last); + if (values.empty()) send(pg, dest, tag, static_cast(0), 0); + else send(pg, dest, tag, &values[0], values.size()); +} + +template +bool +mpi_process_group::receive_impl(int source, int tag, T& value, + mpl::true_ /*is_mpi_datatype*/) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << "RECV: " << process_id(*this) << " <- " << source << ", tag = " + << tag << std::endl; +#endif + + impl::incoming_messages& incoming = impl_->incoming[source]; + + // Find the next header with the right tag + std::vector::iterator header = + incoming.next_header[my_block_number()]; + while (header != incoming.headers.end() && header->tag != tag) ++header; + + // If no header is found, notify the caller + if (header == incoming.headers.end()) return false; + + // Unpack the data + if (header->bytes > 0) { + boost::mpi::packed_iarchive ia(impl_->comm, incoming.buffer, + archive::no_header, header->offset); + ia >> value; + } + + // Mark this message as received + header->tag = -1; + + // Move the "next header" indicator to the next unreceived message + while (incoming.next_header[my_block_number()] != incoming.headers.end() + && incoming.next_header[my_block_number()]->tag == -1) + ++incoming.next_header[my_block_number()]; + + if (incoming.next_header[my_block_number()] == incoming.headers.end()) { + bool finished = true; + for (std::size_t i = 0; i < incoming.next_header.size() && finished; ++i) { + if (incoming.next_header[i] != incoming.headers.end()) finished = false; + } + + if (finished) { + std::vector no_headers; + incoming.headers.swap(no_headers); + buffer_type empty_buffer; + incoming.buffer.swap(empty_buffer); + for (std::size_t i = 0; i < incoming.next_header.size(); ++i) + incoming.next_header[i] = incoming.headers.end(); + } + } + + return true; +} + +template +bool +mpi_process_group::receive_impl(int source, int tag, T& value, + mpl::false_ /*is_mpi_datatype*/) const +{ + impl::incoming_messages& incoming = impl_->incoming[source]; + + // Find the next header with the right tag + std::vector::iterator header = + incoming.next_header[my_block_number()]; + while (header != incoming.headers.end() && header->tag != tag) ++header; + + // If no header is found, notify the caller + if (header == incoming.headers.end()) return false; + + // Deserialize the data + boost::mpi::packed_iarchive in(impl_->comm, incoming.buffer, + archive::no_header, header->offset); + in >> value; + + // Mark this message as received + header->tag = -1; + + // Move the "next header" indicator to the next unreceived message + while (incoming.next_header[my_block_number()] != incoming.headers.end() + && incoming.next_header[my_block_number()]->tag == -1) + ++incoming.next_header[my_block_number()]; + + if (incoming.next_header[my_block_number()] == incoming.headers.end()) { + bool finished = true; + for (std::size_t i = 0; i < incoming.next_header.size() && finished; ++i) { + if (incoming.next_header[i] != incoming.headers.end()) finished = false; + } + + if (finished) { + std::vector no_headers; + incoming.headers.swap(no_headers); + buffer_type empty_buffer; + incoming.buffer.swap(empty_buffer); + for (std::size_t i = 0; i < incoming.next_header.size(); ++i) + incoming.next_header[i] = incoming.headers.end(); + } + } + + return true; +} + +template +typename disable_if, bool>::type +mpi_process_group:: +array_receive_impl(int source, int tag, T* values, std::size_t& n) const +{ + impl::incoming_messages& incoming = impl_->incoming[source]; + + // Find the next header with the right tag + std::vector::iterator header = + incoming.next_header[my_block_number()]; + while (header != incoming.headers.end() && header->tag != tag) ++header; + + // If no header is found, notify the caller + if (header == incoming.headers.end()) return false; + + // Deserialize the data + boost::mpi::packed_iarchive in(impl_->comm, incoming.buffer, + archive::no_header, header->offset); + std::size_t num_sent; + in >> num_sent; + if (num_sent > n) + std::cerr << "ERROR: Have " << num_sent << " items but only space for " + << n << " items\n"; + + for (std::size_t i = 0; i < num_sent; ++i) + in >> values[i]; + n = num_sent; + + // Mark this message as received + header->tag = -1; + + // Move the "next header" indicator to the next unreceived message + while (incoming.next_header[my_block_number()] != incoming.headers.end() + && incoming.next_header[my_block_number()]->tag == -1) + ++incoming.next_header[my_block_number()]; + + if (incoming.next_header[my_block_number()] == incoming.headers.end()) { + bool finished = true; + for (std::size_t i = 0; i < incoming.next_header.size() && finished; ++i) { + if (incoming.next_header[i] != incoming.headers.end()) finished = false; + } + + if (finished) { + std::vector no_headers; + incoming.headers.swap(no_headers); + buffer_type empty_buffer; + incoming.buffer.swap(empty_buffer); + for (std::size_t i = 0; i < incoming.next_header.size(); ++i) + incoming.next_header[i] = incoming.headers.end(); + } + } + + return true; +} + +// Construct triggers +template +void mpi_process_group::trigger(int tag, const Handler& handler) +{ + assert(block_num); + install_trigger(tag,my_block_number(),shared_ptr( + new trigger_launcher(*this, tag, handler))); +} + +template +void mpi_process_group::trigger_with_reply(int tag, const Handler& handler) +{ + assert(block_num); + install_trigger(tag,my_block_number(),shared_ptr( + new reply_trigger_launcher(*this, tag, handler))); +} + +template +void mpi_process_group::global_trigger(int tag, const Handler& handler, + std::size_t sz) +{ + if (sz==0) // normal trigger + install_trigger(tag,0,shared_ptr( + new global_trigger_launcher(*this, tag, handler))); + else // trigger with irecv + install_trigger(tag,0,shared_ptr( + new global_irecv_trigger_launcher(*this, tag, handler,sz))); + +} + +namespace detail { + +template +void do_oob_receive(mpi_process_group const& self, + int source, int tag, Type& data, mpl::true_ /*is_mpi_datatype*/) +{ + using boost::mpi::get_mpi_datatype; + + //self.impl_->comm.recv(source,tag,data); + MPI_Recv(&data, 1, get_mpi_datatype(data), source, tag, self.impl_->comm, + MPI_STATUS_IGNORE); +} + +template +void do_oob_receive(mpi_process_group const& self, + int source, int tag, Type& data, mpl::false_ /*is_mpi_datatype*/) +{ + // self.impl_->comm.recv(source,tag,data); + // Receive the size of the data packet + boost::mpi::status status; + status = self.impl_->comm.probe(source, tag); + +#if BOOST_VERSION >= 103600 + int size = status.count().get(); +#else + int size; + MPI_Status& mpi_status = status; + MPI_Get_count(&mpi_status, MPI_PACKED, &size); +#endif + + // Receive the data packed itself + boost::mpi::packed_iarchive in(self.impl_->comm); + in.resize(size); + MPI_Recv(in.address(), size, MPI_PACKED, source, tag, self.impl_->comm, + MPI_STATUS_IGNORE); + + // Deserialize the data + in >> data; +} + +template +void do_oob_receive(mpi_process_group const& self, int source, int tag, Type& data) +{ + do_oob_receive(self, source, tag, data, + boost::mpi::is_mpi_datatype()); +} + + +} // namespace detail + + +template +void +mpi_process_group::trigger_launcher:: +receive(mpi_process_group const&, int source, int tag, + trigger_receive_context context, int block) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << (out_of_band? "OOB trigger" : "Trigger") + << " receive from source " << source << " and tag " << tag + << " in block " << (block == -1 ? self.my_block_number() : block) << std::endl; +#endif + + Type data; + + if (context == trc_out_of_band) { + // Receive the message directly off the wire + int realtag = self.encode_tag( + block == -1 ? self.my_block_number() : block, tag); + detail::do_oob_receive(self,source,realtag,data); + } + else + // Receive the message out of the local buffer + boost::graph::distributed::receive(self, source, tag, data); + + // Pass the message off to the handler + handler(source, tag, data, context); +} + +template +void +mpi_process_group::reply_trigger_launcher:: +receive(mpi_process_group const&, int source, int tag, + trigger_receive_context context, int block) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << (out_of_band? "OOB reply trigger" : "Reply trigger") + << " receive from source " << source << " and tag " << tag + << " in block " << (block == -1 ? self.my_block_number() : block) << std::endl; +#endif + assert(context == trc_out_of_band); + + boost::parallel::detail::untracked_pair data; + + // Receive the message directly off the wire + int realtag = self.encode_tag(block == -1 ? self.my_block_number() : block, + tag); + detail::do_oob_receive(self, source, realtag, data); + + // Pass the message off to the handler and send the result back to + // the source. + send_oob(self, source, data.first, + handler(source, tag, data.second, context), -2); +} + +template +void +mpi_process_group::global_trigger_launcher:: +receive(mpi_process_group const& self, int source, int tag, + trigger_receive_context context, int block) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << (out_of_band? "OOB trigger" : "Trigger") + << " receive from source " << source << " and tag " << tag + << " in block " << (block == -1 ? self.my_block_number() : block) << std::endl; +#endif + + Type data; + + if (context == trc_out_of_band) { + // Receive the message directly off the wire + int realtag = self.encode_tag( + block == -1 ? self.my_block_number() : block, tag); + detail::do_oob_receive(self,source,realtag,data); + } + else + // Receive the message out of the local buffer + boost::graph::distributed::receive(self, source, tag, data); + + // Pass the message off to the handler + handler(self, source, tag, data, context); +} + + +template +void +mpi_process_group::global_irecv_trigger_launcher:: +receive(mpi_process_group const& self, int source, int tag, + trigger_receive_context context, int block) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << (out_of_band? "OOB trigger" : "Trigger") + << " receive from source " << source << " and tag " << tag + << " in block " << (block == -1 ? self.my_block_number() : block) << std::endl; +#endif + + Type data; + + if (context == trc_out_of_band) { + return; + } + assert (context == trc_irecv_out_of_band); + + // force posting of new MPI_Irecv, even though buffer is already allocated + boost::mpi::packed_iarchive ia(self.impl_->comm,self.impl_->buffers[tag]); + ia >> data; + // Start a new receive + prepare_receive(self,tag,true); + // Pass the message off to the handler + handler(self, source, tag, data, context); +} + + +template +void +mpi_process_group::global_irecv_trigger_launcher:: +prepare_receive(mpi_process_group const& self, int tag, bool force) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << ("Posting Irecv for trigger") + << " receive with tag " << tag << std::endl; +#endif + if (self.impl_->buffers.find(tag) == self.impl_->buffers.end()) { + self.impl_->buffers[tag].resize(buffer_size); + force = true; + } + assert(static_cast(self.impl_->buffers[tag].size()) >= buffer_size); + + //BOOST_MPL_ASSERT(mpl::not_ >); + if (force) { + self.impl_->requests.push_back(MPI_Request()); + MPI_Request* request = &self.impl_->requests.back(); + MPI_Irecv(&self.impl_->buffers[tag].front(),buffer_size, + MPI_PACKED,MPI_ANY_SOURCE,tag,self.impl_->comm,request); + } +} + + +template +inline mpi_process_group::process_id_type +receive(const mpi_process_group& pg, int tag, T& value) +{ + for (std::size_t source = 0; source < pg.impl_->incoming.size(); ++source) { + if (pg.receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + value, boost::mpi::is_mpi_datatype())) + return source; + } + assert (false); +} + +template +typename + enable_if, + std::pair >::type +receive(const mpi_process_group& pg, int tag, T values[], std::size_t n) +{ + for (std::size_t source = 0; source < pg.impl_->incoming.size(); ++source) { + bool result = + pg.receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + boost::serialization::make_array(values,n), + boost::mpl::true_()); + if (result) + return std::make_pair(source, n); + } + assert(false); +} + +template +typename + disable_if, + std::pair >::type +receive(const mpi_process_group& pg, int tag, T values[], std::size_t n) +{ + for (std::size_t source = 0; source < pg.impl_->incoming.size(); ++source) { + if (pg.array_receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + values, n)) + return std::make_pair(source, n); + } + assert(false); +} + +template +mpi_process_group::process_id_type +receive(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value) +{ + if (pg.receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + value, boost::mpi::is_mpi_datatype())) + return source; + else { + fprintf(stderr, + "Process %d failed to receive a message from process %d with tag %d in block %d.\n", + process_id(pg), source, tag, pg.my_block_number()); + + assert(false); + exit(1); + } +} + +template +typename + enable_if, + std::pair >::type +receive(const mpi_process_group& pg, int source, int tag, T values[], + std::size_t n) +{ + if (pg.receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + boost::serialization::make_array(values,n), + boost::mpl::true_())) + return std::make_pair(source,n); + else { + fprintf(stderr, + "Process %d failed to receive a message from process %d with tag %d in block %d.\n", + process_id(pg), source, tag, pg.my_block_number()); + + assert(false); + exit(1); + } +} + +template +typename + disable_if, + std::pair >::type +receive(const mpi_process_group& pg, int source, int tag, T values[], + std::size_t n) +{ + pg.array_receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + values, n); + + return std::make_pair(source, n); +} + +template +T* +all_reduce(const mpi_process_group& pg, T* first, T* last, T* out, + BinaryOperation bin_op) +{ + synchronize(pg); + + bool inplace = first == out; + + if (inplace) out = new T [last-first]; + + boost::mpi::all_reduce(boost::mpi::communicator(communicator(pg), + boost::mpi::comm_attach), + first, last-first, out, bin_op); + + if (inplace) { + std::copy(out, out + (last-first), first); + delete [] out; + return last; + } + + return out; +} + +template +void +broadcast(const mpi_process_group& pg, T& val, + mpi_process_group::process_id_type root) +{ + // broadcast the seed + boost::mpi::communicator comm(communicator(pg),boost::mpi::comm_attach); + boost::mpi::broadcast(comm,val,root); +} + + +template +T* +scan(const mpi_process_group& pg, T* first, T* last, T* out, + BinaryOperation bin_op) +{ + synchronize(pg); + + bool inplace = first == out; + + if (inplace) out = new T [last-first]; + + boost::mpi::scan(communicator(pg), first, last-first, out, bin_op); + + if (inplace) { + std::copy(out, out + (last-first), first); + delete [] out; + return last; + } + + return out; +} + + +template +void +all_gather(const mpi_process_group& pg, InputIterator first, + InputIterator last, std::vector& out) +{ + synchronize(pg); + + // Stick a copy of the local values into a vector, so we can broadcast it + std::vector local_values(first, last); + + // Collect the number of vertices stored in each process + int size = local_values.size(); + std::vector sizes(num_processes(pg)); + int result = MPI_Allgather(&size, 1, MPI_INT, + &sizes[0], 1, MPI_INT, + communicator(pg)); + assert(result == MPI_SUCCESS); + + // Adjust sizes based on the number of bytes + std::transform(sizes.begin(), sizes.end(), sizes.begin(), + std::bind2nd(std::multiplies(), sizeof(T))); + + // Compute displacements + std::vector displacements; + displacements.reserve(sizes.size() + 1); + displacements.push_back(0); + std::partial_sum(sizes.begin(), sizes.end(), + std::back_inserter(displacements)); + + // Gather all of the values + out.resize(displacements.back() / sizeof(T)); + if (!out.empty()) { + result = MPI_Allgatherv(local_values.empty()? (void*)&local_values + /* local results */: (void*)&local_values[0], + local_values.size() * sizeof(T), + MPI_BYTE, + &out[0], &sizes[0], &displacements[0], MPI_BYTE, + communicator(pg)); + } + assert(result == MPI_SUCCESS); +} + +template +mpi_process_group +process_subgroup(const mpi_process_group& pg, + InputIterator first, InputIterator last) +{ +/* + boost::mpi::group current_group = communicator(pg).group(); + boost::mpi::group new_group = current_group.include(first,last); + boost::mpi::communicator new_comm(communicator(pg),new_group); + return mpi_process_group(new_comm); +*/ + std::vector ranks(first, last); + + MPI_Group current_group; + int result = MPI_Comm_group(communicator(pg), ¤t_group); + assert(result == MPI_SUCCESS); + + MPI_Group new_group; + result = MPI_Group_incl(current_group, ranks.size(), &ranks[0], &new_group); + assert(result == MPI_SUCCESS); + + MPI_Comm new_comm; + result = MPI_Comm_create(communicator(pg), new_group, &new_comm); + assert(result == MPI_SUCCESS); + + result = MPI_Group_free(&new_group); + assert(result == MPI_SUCCESS); + result = MPI_Group_free(¤t_group); + assert(result == MPI_SUCCESS); + + if (new_comm != MPI_COMM_NULL) { + mpi_process_group result_pg(boost::mpi::communicator(new_comm,boost::mpi::comm_attach)); + result = MPI_Comm_free(&new_comm); + assert(result == 0); + return result_pg; + } else { + return mpi_process_group(mpi_process_group::create_empty()); + } + +} + + +template +Receiver* mpi_process_group::get_receiver() +{ + return impl_->blocks[my_block_number()]->on_receive + .template target(); +} + +template +typename enable_if >::type +receive_oob(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value, int block) +{ + using boost::mpi::get_mpi_datatype; + + // Determine the actual message we expect to receive, and which + // communicator it will come by. + std::pair actual + = pg.actual_communicator_and_tag(tag, block); + + // Post a non-blocking receive that waits until we complete this request. + MPI_Request request; + MPI_Irecv(&value, 1, get_mpi_datatype(value), + source, actual.second, actual.first, &request); + + int done = 0; + do { + MPI_Test(&request, &done, MPI_STATUS_IGNORE); + if (!done) + pg.poll(/*wait=*/false, block); + } while (!done); +} + +template +typename disable_if >::type +receive_oob(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value, int block) +{ + // Determine the actual message we expect to receive, and which + // communicator it will come by. + std::pair actual + = pg.actual_communicator_and_tag(tag, block); + + boost::optional status; + do { + status = actual.first.iprobe(source, actual.second); + if (!status) + pg.poll(); + } while (!status); + + //actual.first.recv(status->source(), status->tag(),value); + + // Allocate the receive buffer + boost::mpi::packed_iarchive in(actual.first); + +#if BOOST_VERSION >= 103600 + in.resize(status->count().get()); +#else + int size; + MPI_Status mpi_status = *status; + MPI_Get_count(&mpi_status, MPI_PACKED, &size); + in.resize(size); +#endif + + // Receive the message data + MPI_Recv(in.address(), in.size(), MPI_PACKED, + status->source(), status->tag(), actual.first, MPI_STATUS_IGNORE); + + // Unpack the message data + in >> value; +} + + +template +typename enable_if >::type +send_oob_with_reply(const mpi_process_group& pg, + mpi_process_group::process_id_type dest, + int tag, const SendT& send_value, ReplyT& reply_value, + int block) +{ + detail::tag_allocator::token reply_tag = pg.impl_->allocated_tags.get_tag(); + send_oob(pg, dest, tag, boost::parallel::detail::make_untracked_pair( + (int)reply_tag, send_value), block); + receive_oob(pg, dest, reply_tag, reply_value); +} + +template +typename disable_if >::type +send_oob_with_reply(const mpi_process_group& pg, + mpi_process_group::process_id_type dest, + int tag, const SendT& send_value, ReplyT& reply_value, + int block) +{ + detail::tag_allocator::token reply_tag = pg.impl_->allocated_tags.get_tag(); + send_oob(pg, dest, tag, + boost::parallel::detail::make_untracked_pair((int)reply_tag, + send_value), block); + receive_oob(pg, dest, reply_tag, reply_value); +} + +} } } // end namespace boost::graph::distributed diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/queue.ipp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/queue.ipp new file mode 100644 index 0000000000..f37ff25f2f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/queue.ipp @@ -0,0 +1,177 @@ +// Copyright (C) 2004-2006 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 +#include +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +namespace boost { namespace graph { namespace distributed { + +template +BOOST_DISTRIBUTED_QUEUE_TYPE:: +distributed_queue(const ProcessGroup& process_group, const OwnerMap& owner, + const Buffer& buffer, bool polling) + : process_group(process_group, attach_distributed_object()), + owner(owner), + buffer(buffer), + polling(polling) +{ + if (!polling) + outgoing_buffers.reset( + new outgoing_buffers_t(num_processes(process_group))); + + setup_triggers(); +} + +template +BOOST_DISTRIBUTED_QUEUE_TYPE:: +distributed_queue(const ProcessGroup& process_group, const OwnerMap& owner, + const Buffer& buffer, const UnaryPredicate& pred, + bool polling) + : process_group(process_group, attach_distributed_object()), + owner(owner), + buffer(buffer), + pred(pred), + polling(polling) +{ + if (!polling) + outgoing_buffers.reset( + new outgoing_buffers_t(num_processes(process_group))); + + setup_triggers(); +} + +template +BOOST_DISTRIBUTED_QUEUE_TYPE:: +distributed_queue(const ProcessGroup& process_group, const OwnerMap& owner, + const UnaryPredicate& pred, bool polling) + : process_group(process_group, attach_distributed_object()), + owner(owner), + pred(pred), + polling(polling) +{ + if (!polling) + outgoing_buffers.reset( + new outgoing_buffers_t(num_processes(process_group))); + + setup_triggers(); +} + +template +void +BOOST_DISTRIBUTED_QUEUE_TYPE::push(const value_type& x) +{ + typename ProcessGroup::process_id_type dest = get(owner, x); + if (outgoing_buffers) + outgoing_buffers->at(dest).push_back(x); + else if (dest == process_id(process_group)) + buffer.push(x); + else + send(process_group, get(owner, x), msg_push, x); +} + +template +bool +BOOST_DISTRIBUTED_QUEUE_TYPE::empty() const +{ + /* Processes will stay here until the buffer is nonempty or + synchronization with the other processes indicates that all local + buffers are empty (and no messages are in transit). + */ + while (buffer.empty() && !do_synchronize()) ; + + return buffer.empty(); +} + +template +typename BOOST_DISTRIBUTED_QUEUE_TYPE::size_type +BOOST_DISTRIBUTED_QUEUE_TYPE::size() const +{ + empty(); + return buffer.size(); +} + +template +void BOOST_DISTRIBUTED_QUEUE_TYPE::setup_triggers() +{ + using boost::graph::parallel::simple_trigger; + + simple_trigger(process_group, msg_push, this, + &distributed_queue::handle_push); + simple_trigger(process_group, msg_multipush, this, + &distributed_queue::handle_multipush); +} + +template +void +BOOST_DISTRIBUTED_QUEUE_TYPE:: +handle_push(int /*source*/, int /*tag*/, const value_type& value, + trigger_receive_context) +{ + if (pred(value)) buffer.push(value); +} + +template +void +BOOST_DISTRIBUTED_QUEUE_TYPE:: +handle_multipush(int /*source*/, int /*tag*/, + const std::vector& values, + trigger_receive_context) +{ + for (std::size_t i = 0; i < values.size(); ++i) + if (pred(values[i])) buffer.push(values[i]); +} + +template +bool +BOOST_DISTRIBUTED_QUEUE_TYPE::do_synchronize() const +{ +#ifdef PBGL_ACCOUNTING + ++num_synchronizations; +#endif + + using boost::parallel::all_reduce; + using std::swap; + + typedef typename ProcessGroup::process_id_type process_id_type; + + if (outgoing_buffers) { + // Transfer all of the push requests + process_id_type id = process_id(process_group); + process_id_type np = num_processes(process_group); + for (process_id_type dest = 0; dest < np; ++dest) { + outgoing_buffer_t& outgoing = outgoing_buffers->at(dest); + std::size_t size = outgoing.size(); + if (size != 0) { + if (dest != id) { + send(process_group, dest, msg_multipush, outgoing); + } else { + for (std::size_t i = 0; i < size; ++i) + buffer.push(outgoing[i]); + } + outgoing.clear(); + } + } + } + synchronize(process_group); + + unsigned local_size = buffer.size(); + unsigned global_size = + all_reduce(process_group, local_size, std::plus()); + return global_size == 0; +} + +} } } // end namespace boost::graph::distributed diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/remote_update_set.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/remote_update_set.hpp new file mode 100644 index 0000000000..08f4316ad6 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/remote_update_set.hpp @@ -0,0 +1,259 @@ +// Copyright (C) 2005-2006 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DETAIL_REMOTE_UPDATE_SET_HPP +#define BOOST_GRAPH_DETAIL_REMOTE_UPDATE_SET_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace graph { namespace detail { + +template +void do_synchronize(ProcessGroup& pg) +{ + using boost::parallel::synchronize; + synchronize(pg); +} + +struct remote_set_queued {}; +struct remote_set_immediate {}; + +template +class remote_set_semantics +{ + BOOST_STATIC_CONSTANT + (bool, + queued = (is_convertible< + typename ProcessGroup::communication_category, + parallel::bsp_process_group_tag>::value)); + + public: + typedef typename mpl::if_c::type type; +}; + + +template::type> +class remote_update_set; + +/********************************************************************** + * Remote updating set that queues messages until synchronization * + **********************************************************************/ +template +class remote_update_set +{ + typedef typename property_traits::key_type Key; + typedef std::vector > Updates; + typedef typename Updates::size_type updates_size_type; + typedef typename Updates::value_type updates_pair_type; + +public: + +private: + typedef typename ProcessGroup::process_id_type process_id_type; + + enum message_kind { + /** Message containing the number of updates that will be sent in + * a msg_updates message that will immediately follow. This + * message will contain a single value of type + * updates_size_type. + */ + msg_num_updates, + + /** Contains (key, value) pairs with all of the updates from a + * particular source. The number of updates is variable, but will + * be provided in a msg_num_updates message that immediately + * preceeds this message. + * + */ + msg_updates + }; + + struct handle_messages + { + explicit + handle_messages(remote_update_set* self, const ProcessGroup& pg) + : self(self), update_sizes(num_processes(pg), 0) { } + + void operator()(process_id_type source, int tag) + { + switch(tag) { + case msg_num_updates: + { + // Receive the # of updates + updates_size_type num_updates; + receive(self->process_group, source, tag, num_updates); + + update_sizes[source] = num_updates; + } + break; + + case msg_updates: + { + updates_size_type num_updates = update_sizes[source]; + assert(num_updates); + + // Receive the actual updates + std::vector updates(num_updates); + receive(self->process_group, source, msg_updates, &updates[0], + num_updates); + + // Send updates to derived "receive_update" member + Derived* derived = static_cast(self); + for (updates_size_type u = 0; u < num_updates; ++u) + derived->receive_update(source, updates[u].first, updates[u].second); + + update_sizes[source] = 0; + } + break; + }; + } + + private: + remote_update_set* self; + std::vector update_sizes; + }; + friend struct handle_messages; + + protected: + remote_update_set(const ProcessGroup& pg, const OwnerMap& owner) + : process_group(pg, handle_messages(this, pg)), + updates(num_processes(pg)), owner(owner) { + } + + + void update(const Key& key, const Value& value) + { + if (get(owner, key) == process_id(process_group)) { + Derived* derived = static_cast(this); + derived->receive_update(get(owner, key), key, value); + } + else { + updates[get(owner, key)].push_back(std::make_pair(key, value)); + } + } + + void collect() { } + + void synchronize() + { + // Emit all updates and then remove them + process_id_type num_processes = updates.size(); + for (process_id_type p = 0; p < num_processes; ++p) { + if (!updates[p].empty()) { + send(process_group, p, msg_num_updates, updates[p].size()); + send(process_group, p, msg_updates, + &updates[p].front(), updates[p].size()); + updates[p].clear(); + } + } + + do_synchronize(process_group); + } + + ProcessGroup process_group; + + private: + std::vector updates; + OwnerMap owner; +}; + +/********************************************************************** + * Remote updating set that sends messages immediately * + **********************************************************************/ +template +class remote_update_set +{ + typedef typename property_traits::key_type Key; + typedef std::pair update_pair_type; + typedef typename std::vector::size_type updates_size_type; + +public: + typedef typename ProcessGroup::process_id_type process_id_type; + +private: + enum message_kind { + /** Contains a (key, value) pair that will be updated. */ + msg_update + }; + + struct handle_messages + { + explicit handle_messages(remote_update_set* self, const ProcessGroup& pg) + : self(self) + { update_sizes.resize(num_processes(pg), 0); } + + void operator()(process_id_type source, int tag) + { + // Receive the # of updates + assert(tag == msg_update); + update_pair_type update; + receive(self->process_group, source, tag, update); + + // Send update to derived "receive_update" member + Derived* derived = static_cast(self); + derived->receive_update(source, update.first, update.second); + } + + private: + std::vector update_sizes; + remote_update_set* self; + }; + friend struct handle_messages; + + protected: + remote_update_set(const ProcessGroup& pg, const OwnerMap& owner) + : process_group(pg, handle_messages(this, pg)), owner(owner) { } + + void update(const Key& key, const Value& value) + { + if (get(owner, key) == process_id(process_group)) { + Derived* derived = static_cast(this); + derived->receive_update(get(owner, key), key, value); + } + else + send(process_group, get(owner, key), msg_update, + update_pair_type(key, value)); + } + + void collect() + { + typedef std::pair probe_type; + handle_messages handler(this, process_group); + while (optional stp = probe(process_group)) + if (stp->second == msg_update) handler(stp->first, stp->second); + } + + void synchronize() + { + do_synchronize(process_group); + } + + ProcessGroup process_group; + OwnerMap owner; +}; + +} } } // end namespace boost::graph::detail + +#endif // BOOST_GRAPH_DETAIL_REMOTE_UPDATE_SET_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/tag_allocator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/tag_allocator.hpp new file mode 100644 index 0000000000..2734039270 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/detail/tag_allocator.hpp @@ -0,0 +1,84 @@ +// -*- C++ -*- + +// Copyright (C) 2007 Douglas Gregor + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP +#define BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include + +namespace boost { namespace graph { namespace distributed { namespace detail { + +/** + * \brief The tag allocator allows clients to request unique tags that + * can be used for one-time communications. + * + * The tag allocator hands out tag values from a predefined maximum + * (given in the constructor) moving downward. Tags are provided one + * at a time via a @c token. When the @c token goes out of scope, the + * tag is returned and may be reallocated. These tags should be used, + * for example, for one-time communication of values. + */ +class tag_allocator { +public: + class token; + friend class token; + + /** + * Construct a new tag allocator that provides unique tags starting + * with the value @p top_tag and moving lower, as necessary. + */ + explicit tag_allocator(int top_tag) : bottom(top_tag) { } + + /** + * Retrieve a new tag. The token itself holds onto the tag, which + * will be released when the token is destroyed. + */ + token get_tag(); + +private: + int bottom; + std::vector freed; +}; + +/** + * A token used to represent an allocated tag. + */ +class tag_allocator::token { +public: + /// Transfer ownership of the tag from @p other. + token(const token& other); + + /// De-allocate the tag, if this token still owns it. + ~token(); + + /// Retrieve the tag allocated for this task. + operator int() const { return tag_; } + +private: + /// Create a token with a specific tag from the given tag_allocator + token(tag_allocator* allocator, int tag) + : allocator(allocator), tag_(tag) { } + + /// Undefined: tokens are not copy-assignable + token& operator=(const token&); + + /// The allocator from which this tag was allocated. + tag_allocator* allocator; + + /// The stored tag flag. If -1, this token does not own the tag. + mutable int tag_; + + friend class tag_allocator; +}; + +} } } } // end namespace boost::graph::distributed::detail + +#endif // BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/dijkstra_shortest_paths.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/dijkstra_shortest_paths.hpp new file mode 100644 index 0000000000..f72fa11a50 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/dijkstra_shortest_paths.hpp @@ -0,0 +1,205 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_DIJKSTRA_HPP +#define BOOST_GRAPH_PARALLEL_DIJKSTRA_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include + +namespace boost { + + namespace graph { namespace detail { + + + template + struct parallel_dijkstra_impl2 + { + template + static void + run(const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + typename property_traits::value_type lookahead, + WeightMap weight, IndexMap index_map, ColorMap color_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) + { + eager_dijkstra_shortest_paths(g, s, predecessor, distance, lookahead, + weight, index_map, color_map, compare, + combine, inf, zero, vis); + } + }; + + template<> + struct parallel_dijkstra_impl2< ::boost::detail::error_property_not_found > + { + template + static void + run(const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + ::boost::detail::error_property_not_found, + WeightMap weight, IndexMap index_map, ColorMap color_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) + { + crauser_et_al_shortest_paths(g, s, predecessor, distance, weight, + index_map, color_map, compare, combine, + inf, zero, vis); + } + }; + + template + struct parallel_dijkstra_impl + { + template + static void + run(const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + Lookahead lookahead, + WeightMap weight, IndexMap index_map, ColorMap color_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) + { + graph::detail::parallel_dijkstra_impl2 + ::run(g, s, predecessor, distance, lookahead, weight, index_map, + color_map, compare, combine, inf, zero, vis); + } + }; + + template<> + struct parallel_dijkstra_impl< ::boost::detail::error_property_not_found > + { + private: + template + static void + run_impl(const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + Lookahead lookahead, WeightMap weight, IndexMap index_map, + ColorMap color_map, Compare compare, Combine combine, + DistInf inf, DistZero zero, DijkstraVisitor vis) + { + BGL_FORALL_VERTICES_T(u, g, DistributedGraph) + BGL_FORALL_OUTEDGES_T(u, e, g, DistributedGraph) + local_put(color_map, target(e, g), white_color); + + graph::detail::parallel_dijkstra_impl2 + ::run(g, s, predecessor, distance, lookahead, weight, index_map, + color_map, compare, combine, inf, zero, vis); + } + + public: + template + static void + run(const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + Lookahead lookahead, WeightMap weight, IndexMap index_map, + ::boost::detail::error_property_not_found, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) + { + typedef typename graph_traits::vertices_size_type + vertices_size_type; + + vertices_size_type n = num_vertices(g); + std::vector colors(n, white_color); + + run_impl(g, s, predecessor, distance, lookahead, weight, index_map, + make_iterator_property_map(colors.begin(), index_map), + compare, combine, inf, zero, vis); + } + }; + } } // end namespace graph::detail + + + /** Dijkstra's single-source shortest paths algorithm for distributed + * graphs. + * + * Also implements the heuristics of: + * + * Andreas Crauser, Kurt Mehlhorn, Ulrich Meyer, and Peter + * Sanders. A Parallelization of Dijkstra's Shortest Path + * Algorithm. In Lubos Brim, Jozef Gruska, and Jiri Zlatuska, + * editors, Mathematical Foundations of Computer Science (MFCS), + * volume 1450 of Lecture Notes in Computer Science, pages + * 722--731, 1998. Springer. + */ + template + inline + void + dijkstra_shortest_paths + (const DistributedGraph& 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, + const bgl_named_params& params + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(DistributedGraph,distributed_graph_tag)) + { + typedef typename graph_traits::vertices_size_type + vertices_size_type; + + // Build a distributed property map for vertex colors, if we need it + bool use_default_color_map + = is_default_param(get_param(params, vertex_color)); + vertices_size_type n = use_default_color_map? num_vertices(g) : 1; + std::vector color(n, white_color); + typedef iterator_property_map::iterator, + IndexMap> DefColorMap; + DefColorMap color_map(color.begin(), index_map); + + typedef typename property_value< bgl_named_params, + vertex_color_t>::type color_map_type; + + graph::detail::parallel_dijkstra_impl + ::run(g, s, predecessor, distance, + get_param(params, lookahead_t()), + weight, index_map, + get_param(params, vertex_color), + compare, combine, inf, zero, vis); + } +} // end namespace boost + +#endif // BOOST_GRAPH_PARALLEL_DIJKSTRA_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/distributed_graph_utility.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/distributed_graph_utility.hpp new file mode 100644 index 0000000000..058b9887d8 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/distributed_graph_utility.hpp @@ -0,0 +1,154 @@ +// Copyright (C) 2005-2006 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: Peter Gottschling +// Douglas Gregor +// Andrew Lumsdaine + +#include +#include + +#ifndef BOOST_GRAPH_DISTRIBUTED_GRAPH_UTILITY_INCLUDE +#define BOOST_GRAPH_DISTRIBUTED_GRAPH_UTILITY_INCLUDE + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +namespace boost { namespace graph { + + template + void property_on_inedges(Property p, const Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_INEDGES_T(u, e, g, Graph) + request(p, e); + synchronize(p); + } + + // For reverse graphs + template + void property_on_outedges(Property p, const Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + request(p, e); + synchronize(p); + } + + template + void property_on_successors(Property p, const Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + request(p, target(e, g)); + synchronize(p); + } + + template + void property_on_predecessors(Property p, const Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_INEDGES_T(u, e, g, Graph) + request(p, source(e, g)); + synchronize(p); + } + + // Like successors and predecessors but saves one synchronize (and a call) + template + void property_on_adjacents(Property p, const Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) { + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + request(p, target(e, g)); + BGL_FORALL_INEDGES_T(u, e, g, Graph) + request(p, source(e, g)); + } + synchronize(p); + } + + template + void copy_vertex_property(PropertyIn p_in, PropertyOut p_out, Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + put(p_out, u, get(p_in, g)); + } + + template + void copy_edge_property(PropertyIn p_in, PropertyOut p_out, Graph& g) + { + BGL_FORALL_EDGES_T(e, g, Graph) + put(p_out, e, get(p_in, g)); + } + + + namespace distributed { + + // Define global_index global(graph); + // Then global(v) returns global index of v + template + struct global_index + { + typedef typename property_map::const_type + VertexIndexMap; + typedef typename property_map::const_type + VertexGlobalMap; + + explicit global_index(Graph const& g) + : global_index_map(process_group(g), num_vertices(g), get(vertex_index, g), + get(vertex_global, g)) {} + + int operator() (typename graph_traits::vertex_descriptor v) + { return get(global_index_map, v); } + + protected: + boost::parallel::global_index_map + global_index_map; + }; + + template + struct additive_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template + T operator()(const K&) const { return T(0); } + + template + T operator()(const K&, const T& local, const T& remote) const { return local + remote; } + }; + + template + struct choose_min_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template + T operator()(const K&) const { return (std::numeric_limits::max)(); } + + template + T operator()(const K&, const T& x, const T& y) const + { return x < y ? x : y; } + }; + + // To use a property map syntactically like a function + template + struct property_map_reader + { + explicit property_map_reader(PropertyMap pm) : pm(pm) {} + + template + typename PropertyMap::value_type + operator() (const T& v) + { + return get(pm, v); + } + private: + PropertyMap pm; + }; + + } // namespace distributed + +}} // namespace boost::graph + +#endif // BOOST_GRAPH_DISTRIBUTED_GRAPH_UTILITY_INCLUDE diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp new file mode 100644 index 0000000000..8cee034fbe --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp @@ -0,0 +1,446 @@ +// Copyright (C) 2004-2006 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 + +/************************************************************************** + * This source file implements a variation on distributed Dijkstra's * + * algorithm that can expose additional parallelism by permitting * + * vertices within a certain distance from the minimum to be processed, * + * even though they may not be at their final distance. This can * + * introduce looping, but the algorithm will still terminate so long as * + * there are no negative loops. * + **************************************************************************/ +#ifndef BOOST_GRAPH_EAGER_DIJKSTRA_SHORTEST_PATHS_HPP +#define BOOST_GRAPH_EAGER_DIJKSTRA_SHORTEST_PATHS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef PBGL_ACCOUNTING +# include +# include +#endif // PBGL_ACCOUNTING + +#ifdef MUTABLE_QUEUE +# include +#endif + +namespace boost { namespace graph { namespace distributed { + +#ifdef PBGL_ACCOUNTING +struct eager_dijkstra_shortest_paths_stats_t +{ + /* The value of the lookahead parameter. */ + double lookahead; + + /* Total wall-clock time used by the algorithm.*/ + accounting::time_type execution_time; + + /* The number of vertices deleted in each superstep. */ + std::vector deleted_vertices; + + template + void print(OutputStream& out) + { + double avg_deletions = std::accumulate(deleted_vertices.begin(), + deleted_vertices.end(), + 0.0); + avg_deletions /= deleted_vertices.size(); + + out << "Problem = \"Single-Source Shortest Paths\"\n" + << "Algorithm = \"Eager Dijkstra\"\n" + << "Function = eager_dijkstra_shortest_paths\n" + << "(P) Lookahead = " << lookahead << "\n" + << "Wall clock time = " << accounting::print_time(execution_time) + << "\nSupersteps = " << deleted_vertices.size() << "\n" + << "Avg. deletions per superstep = " << avg_deletions << "\n"; + } +}; + +static eager_dijkstra_shortest_paths_stats_t eager_dijkstra_shortest_paths_stats; +#endif + +namespace detail { + +// Borrowed from BGL's dijkstra_shortest_paths +template + struct parallel_dijkstra_bfs_visitor : bfs_visitor<> +{ + typedef typename property_traits::value_type distance_type; + + parallel_dijkstra_bfs_visitor(UniformCostVisitor vis, Queue& Q, + WeightMap w, PredecessorMap p, DistanceMap d, + BinaryFunction combine, BinaryPredicate compare, + distance_type 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 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); } + + /* Since the eager formulation of Parallel Dijkstra's algorithm can + loop, we may relax on *any* edge, not just those associated with + white and gray targets. */ + template + void examine_edge(Edge e, Graph& g) { + if (m_compare(get(m_weight, e), m_zero)) + boost::throw_exception(negative_edge()); + + m_vis.examine_edge(e, g); + + boost::parallel::caching_property_map c_pred(m_predecessor); + boost::parallel::caching_property_map c_dist(m_distance); + + distance_type old_distance = get(c_dist, target(e, g)); + + bool m_decreased = relax(e, g, m_weight, c_pred, c_dist, + 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(c_dist, 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 finish_vertex(Vertex u, Graph& g) { m_vis.finish_vertex(u, g); } + + UniformCostVisitor m_vis; + Queue& m_Q; + WeightMap m_weight; + PredecessorMap m_predecessor; + DistanceMap m_distance; + BinaryFunction m_combine; + BinaryPredicate m_compare; + distance_type m_zero; +}; + + /********************************************************************** + * Dijkstra queue that implements arbitrary "lookahead" * + **********************************************************************/ + template + class lookahead_dijkstra_queue + : public graph::detail::remote_update_set< + lookahead_dijkstra_queue< + Graph, Combine, Compare, VertexIndexMap, DistanceMap, + PredecessorMap>, + typename boost::graph::parallel::process_group_type::type, + typename dijkstra_msg_value::type, + typename property_map::const_type> + { + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + typedef lookahead_dijkstra_queue self_type; + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + typedef dijkstra_msg_value msg_value_creator; + typedef typename msg_value_creator::type msg_value_type; + typedef typename property_map::const_type + OwnerPropertyMap; + + typedef graph::detail::remote_update_set + inherited; + + // Priority queue for tentative distances + typedef indirect_cmp queue_compare_type; + + typedef typename property_traits::value_type distance_type; + +#ifdef MUTABLE_QUEUE + typedef mutable_queue, + queue_compare_type, VertexIndexMap> queue_type; + +#else + typedef relaxed_heap queue_type; +#endif // MUTABLE_QUEUE + + typedef typename process_group_type::process_id_type process_id_type; + + public: + typedef vertex_descriptor value_type; + + lookahead_dijkstra_queue(const Graph& g, + const Combine& combine, + const Compare& compare, + const VertexIndexMap& id, + const DistanceMap& distance_map, + const PredecessorMap& predecessor_map, + distance_type lookahead) + : inherited(boost::graph::parallel::process_group(g), get(vertex_owner, g)), + queue(num_vertices(g), queue_compare_type(distance_map, compare), id), + distance_map(distance_map), + predecessor_map(predecessor_map), + min_distance(0), + lookahead(lookahead) +#ifdef PBGL_ACCOUNTING + , local_deletions(0) +#endif + { } + + void push(const value_type& x) + { + msg_value_type msg_value = + msg_value_creator::create(get(distance_map, x), + predecessor_value(get(predecessor_map, x))); + inherited::update(x, msg_value); + } + + void update(const value_type& x) { push(x); } + + void pop() + { + queue.pop(); +#ifdef PBGL_ACCOUNTING + ++local_deletions; +#endif + } + + value_type& top() { return queue.top(); } + const value_type& top() const { return queue.top(); } + + bool empty() + { + inherited::collect(); + + // If there are no suitable messages, wait until we get something + while (!has_suitable_vertex()) { + if (do_synchronize()) return true; + } + + // Return true only if nobody has any messages; false if we + // have suitable messages + return false; + } + + private: + vertex_descriptor predecessor_value(vertex_descriptor v) const + { return v; } + + vertex_descriptor + predecessor_value(property_traits::reference) const + { return graph_traits::null_vertex(); } + + bool has_suitable_vertex() const + { + return (!queue.empty() + && get(distance_map, queue.top()) <= min_distance + lookahead); + } + + bool do_synchronize() + { + using boost::parallel::all_reduce; + using boost::parallel::minimum; + + inherited::synchronize(); + + // TBD: could use combine here, but then we need to stop using + // minimum() as the function object. + distance_type local_distance = + queue.empty()? (std::numeric_limits::max)() + : get(distance_map, queue.top()); + + all_reduce(this->process_group, &local_distance, &local_distance + 1, + &min_distance, minimum()); + +#ifdef PBGL_ACCOUNTING + std::size_t deletions = 0; + all_reduce(this->process_group, &local_deletions, &local_deletions + 1, + &deletions, std::plus()); + if (process_id(this->process_group) == 0) + eager_dijkstra_shortest_paths_stats.deleted_vertices + .push_back(deletions); + local_deletions = 0; + assert(deletions > 0); +#endif + + return min_distance == (std::numeric_limits::max)(); + } + + public: + void + receive_update(process_id_type source, vertex_descriptor vertex, + distance_type distance) + { + // Update the queue if the received distance is better than + // the distance we know locally + if (distance <= get(distance_map, vertex)) { + + // Update the local distance map + put(distance_map, vertex, distance); + + bool is_in_queue = queue.contains(vertex); + + if (!is_in_queue) + queue.push(vertex); + else + queue.update(vertex); + } + } + + void + receive_update(process_id_type source, vertex_descriptor vertex, + std::pair p) + { + if (p.first <= get(distance_map, vertex)) { + put(predecessor_map, vertex, p.second); + receive_update(source, vertex, p.first); + } + } + + private: + queue_type queue; + DistanceMap distance_map; + PredecessorMap predecessor_map; + distance_type min_distance; + distance_type lookahead; +#ifdef PBGL_ACCOUNTING + std::size_t local_deletions; +#endif + }; + /**********************************************************************/ +} // end namespace detail + +template +void +eager_dijkstra_shortest_paths + (const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + typename property_traits::value_type lookahead, + WeightMap weight, IndexMap index_map, ColorMap color_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) +{ + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + typedef typename graph_traits::vertex_descriptor + Vertex; + typedef typename graph_traits::vertices_size_type + vertices_size_type; + +#ifdef PBGL_ACCOUNTING + eager_dijkstra_shortest_paths_stats.deleted_vertices.clear(); + eager_dijkstra_shortest_paths_stats.lookahead = lookahead; + eager_dijkstra_shortest_paths_stats.execution_time = accounting::get_time(); +#endif + + // Initialize local portion of property maps + typename graph_traits::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + put(distance, *ui, inf); + put(predecessor, *ui, *ui); + } + put(distance, s, zero); + + // Dijkstra Queue + typedef detail::lookahead_dijkstra_queue + Queue; + + Queue Q(g, combine, compare, index_map, distance, + predecessor, lookahead); + + // Parallel Dijkstra visitor + detail::parallel_dijkstra_bfs_visitor + bfs_vis(vis, Q, weight, predecessor, distance, combine, compare, + zero); + + set_property_map_role(vertex_color, color_map); + set_property_map_role(vertex_distance, distance); + + breadth_first_search(g, s, Q, bfs_vis, color_map); + +#ifdef PBGL_ACCOUNTING + eager_dijkstra_shortest_paths_stats.execution_time = + accounting::get_time() + - eager_dijkstra_shortest_paths_stats.execution_time; +#endif +} + +template +void +eager_dijkstra_shortest_paths + (const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + typename property_traits::value_type lookahead, + WeightMap weight) +{ + typedef typename property_traits::value_type distance_type; + + std::vector colors(num_vertices(g), white_color); + + eager_dijkstra_shortest_paths(g, s, predecessor, distance, lookahead, weight, + get(vertex_index, g), + make_iterator_property_map(&colors[0], + get(vertex_index, + g)), + std::less(), + closed_plus(), + distance_type(), + (std::numeric_limits::max)(), + dijkstra_visitor<>()); +} + +template +void +eager_dijkstra_shortest_paths + (const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + typename property_traits::value_type lookahead) +{ + eager_dijkstra_shortest_paths(g, s, predecessor, distance, lookahead, + get(edge_weight, g)); +} +} // end namespace distributed + +#ifdef PBGL_ACCOUNTING +using distributed::eager_dijkstra_shortest_paths_stats; +#endif + +using distributed::eager_dijkstra_shortest_paths; + +} } // end namespace boost::graph + +#endif // BOOST_GRAPH_EAGER_DIJKSTRA_SHORTEST_PATHS_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/filtered_graph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/filtered_graph.hpp new file mode 100644 index 0000000000..9677e4dd10 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/filtered_graph.hpp @@ -0,0 +1,51 @@ +// Copyright (C) 2004-2008 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: Nick Edmonds +// Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP +#define BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include + +namespace boost { + namespace graph { + namespace parallel { + /// Retrieve the process group from a filtered graph + template + struct process_group_type > + : process_group_type { }; + + template + struct process_group_type > + : process_group_type { }; + } + + } + + /// Retrieve the process group from a filtered graph + template + inline typename graph::parallel::process_group_type::type + process_group(filtered_graph const& g) { + return process_group(g.m_g); + } + + /// Forward vertex() to vertex() of the base graph + template + typename graph_traits::vertex_descriptor + vertex(typename graph_traits::vertices_size_type i, + filtered_graph const& g) + { return vertex(i, g.m_g); } + +} + +#endif // BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/fruchterman_reingold.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/fruchterman_reingold.hpp new file mode 100644 index 0000000000..a89aea3dd1 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/fruchterman_reingold.hpp @@ -0,0 +1,384 @@ +// Copyright (C) 2005-2006 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_FRUCHTERMAN_REINGOLD_HPP +#define BOOST_GRAPH_DISTRIBUTED_FRUCHTERMAN_REINGOLD_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include + +namespace boost { namespace graph { namespace distributed { + +class simple_tiling +{ + public: + simple_tiling(int columns, int rows, bool flip = true) + : columns(columns), rows(rows), flip(flip) + { + } + + // Convert from a position (x, y) in the tiled display into a + // processor ID number + int operator()(int x, int y) const + { + return flip? (rows - y - 1) * columns + x : y * columns + x; + } + + // Convert from a process ID to a position (x, y) in the tiled + // display + std::pair operator()(int id) + { + int my_col = id % columns; + int my_row = flip? rows - (id / columns) - 1 : id / columns; + return std::make_pair(my_col, my_row); + } + + int columns, rows; + + private: + bool flip; +}; + +// Force pairs function object that does nothing +struct no_force_pairs +{ + template + void operator()(const Graph&, const ApplyForce&) + { + } +}; + +// Computes force pairs in the distributed case. +template +class distributed_force_pairs_proxy +{ + public: + distributed_force_pairs_proxy(const PositionMap& position, + const DisplacementMap& displacement, + const LocalForces& local_forces, + const NonLocalForces& nonlocal_forces = NonLocalForces()) + : position(position), displacement(displacement), + local_forces(local_forces), nonlocal_forces(nonlocal_forces) + { + } + + template + void operator()(const Graph& g, ApplyForce apply_force) + { + // Flush remote displacements + displacement.flush(); + + // Receive updated positions for all of our neighbors + synchronize(position); + + // Reset remote displacements + displacement.reset(); + + // Compute local repulsive forces + local_forces(g, apply_force); + + // Compute neighbor repulsive forces + nonlocal_forces(g, apply_force); + } + + protected: + PositionMap position; + DisplacementMap displacement; + LocalForces local_forces; + NonLocalForces nonlocal_forces; +}; + +template +inline +distributed_force_pairs_proxy +make_distributed_force_pairs(const PositionMap& position, + const DisplacementMap& displacement, + const LocalForces& local_forces) +{ + typedef + distributed_force_pairs_proxy + result_type; + return result_type(position, displacement, local_forces); +} + +template +inline +distributed_force_pairs_proxy +make_distributed_force_pairs(const PositionMap& position, + const DisplacementMap& displacement, + const LocalForces& local_forces, + const NonLocalForces& nonlocal_forces) +{ + typedef + distributed_force_pairs_proxy + result_type; + return result_type(position, displacement, local_forces, nonlocal_forces); +} + +// Compute nonlocal force pairs based on the shared borders with +// adjacent tiles. +template +class neighboring_tiles_force_pairs +{ + public: + typedef typename property_traits::value_type Point; + typedef typename point_traits::component_type Dim; + + enum bucket_position { left, top, right, bottom, end_position }; + + neighboring_tiles_force_pairs(PositionMap position, Point origin, + Point extent, simple_tiling tiling) + : position(position), origin(origin), extent(extent), tiling(tiling) + { + } + + template + void operator()(const Graph& g, ApplyForce apply_force) + { + // TBD: Do this some smarter way + if (tiling.columns == 1 && tiling.rows == 1) + return; + + typedef typename graph_traits::vertex_descriptor vertex_descriptor; +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif // BOOST_NO_STDC_NAMESPACE + + // TBD: num_vertices(g) should be the global number of vertices? + Dim two_k = Dim(2) * sqrt(extent[0] * extent[1] / num_vertices(g)); + + std::vector my_vertices[4]; + std::vector neighbor_vertices[4]; + + // Compute cutoff positions + Dim cutoffs[4]; + cutoffs[left] = origin[0] + two_k; + cutoffs[top] = origin[1] + two_k; + cutoffs[right] = origin[0] + extent[0] - two_k; + cutoffs[bottom] = origin[1] + extent[1] - two_k; + + // Compute neighbors + typename PositionMap::process_group_type pg = position.process_group(); + std::pair my_tile = tiling(process_id(pg)); + int neighbors[4] = { -1, -1, -1, -1 } ; + if (my_tile.first > 0) + neighbors[left] = tiling(my_tile.first - 1, my_tile.second); + if (my_tile.second > 0) + neighbors[top] = tiling(my_tile.first, my_tile.second - 1); + if (my_tile.first < tiling.columns - 1) + neighbors[right] = tiling(my_tile.first + 1, my_tile.second); + if (my_tile.second < tiling.rows - 1) + neighbors[bottom] = tiling(my_tile.first, my_tile.second + 1); + + // Sort vertices along the edges into buckets + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (position[v][0] <= cutoffs[left]) my_vertices[left].push_back(v); + if (position[v][1] <= cutoffs[top]) my_vertices[top].push_back(v); + if (position[v][0] >= cutoffs[right]) my_vertices[right].push_back(v); + if (position[v][1] >= cutoffs[bottom]) my_vertices[bottom].push_back(v); + } + + // Send vertices to neighbors, and gather our neighbors' vertices + bucket_position pos; + for (pos = left; pos < end_position; pos = bucket_position(pos + 1)) { + if (neighbors[pos] != -1) { + send(pg, neighbors[pos], 0, my_vertices[pos].size()); + if (!my_vertices[pos].empty()) + send(pg, neighbors[pos], 1, + &my_vertices[pos].front(), my_vertices[pos].size()); + } + } + + // Pass messages around + synchronize(pg); + + // Receive neighboring vertices + for (pos = left; pos < end_position; pos = bucket_position(pos + 1)) { + if (neighbors[pos] != -1) { + std::size_t incoming_vertices; + receive(pg, neighbors[pos], 0, incoming_vertices); + + if (incoming_vertices) { + neighbor_vertices[pos].resize(incoming_vertices); + receive(pg, neighbors[pos], 1, &neighbor_vertices[pos].front(), + incoming_vertices); + } + } + } + + // For each neighboring vertex, we need to get its current position + for (pos = left; pos < end_position; pos = bucket_position(pos + 1)) + for (typename std::vector::iterator i = + neighbor_vertices[pos].begin(); + i != neighbor_vertices[pos].end(); + ++i) + request(position, *i); + synchronize(position); + + // Apply forces in adjacent bins. This is O(n^2) in the worst + // case. Oh well. + for (pos = left; pos < end_position; pos = bucket_position(pos + 1)) { + for (typename std::vector::iterator i = + my_vertices[pos].begin(); + i != my_vertices[pos].end(); + ++i) + for (typename std::vector::iterator j = + neighbor_vertices[pos].begin(); + j != neighbor_vertices[pos].end(); + ++j) + apply_force(*i, *j); + } + } + + protected: + PositionMap position; + Point origin; + Point extent; + simple_tiling tiling; +}; + +template +inline neighboring_tiles_force_pairs +make_neighboring_tiles_force_pairs + (PositionMap position, + typename property_traits::value_type origin, + typename property_traits::value_type extent, + simple_tiling tiling) +{ + return neighboring_tiles_force_pairs(position, origin, extent, + tiling); +} + +template +class distributed_cooling_proxy +{ + public: + typedef typename Cooling::result_type result_type; + + distributed_cooling_proxy(const DisplacementMap& displacement, + const Cooling& cooling) + : displacement(displacement), cooling(cooling) + { + } + + result_type operator()() + { + // Accumulate displacements computed on each processor + synchronize(displacement.data->process_group); + + // Allow the underlying cooling to occur + return cooling(); + } + + protected: + DisplacementMap displacement; + Cooling cooling; +}; + +template +inline distributed_cooling_proxy +make_distributed_cooling(const DisplacementMap& displacement, + const Cooling& cooling) +{ + typedef distributed_cooling_proxy result_type; + return result_type(displacement, cooling); +} + +template +struct point_accumulating_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template + Point operator()(const K&) const { return Point(); } + + template + Point operator()(const K&, const Point& p1, const Point& p2) const + { return Point(p1[0] + p2[0], p1[1] + p2[1]); } +}; + +template +void +fruchterman_reingold_force_directed_layout + (const Graph& g, + PositionMap position, + typename property_traits::value_type const& origin, + typename property_traits::value_type const& extent, + AttractiveForce attractive_force, + RepulsiveForce repulsive_force, + ForcePairs force_pairs, + Cooling cool, + DisplacementMap displacement) +{ + typedef typename property_traits::value_type Point; + + // Reduction in the displacement map involves summing the forces + displacement.set_reduce(point_accumulating_reducer()); + + // We need to track the positions of all of our neighbors + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_ADJ_T(u, v, g, Graph) + request(position, v); + + // Invoke the "sequential" Fruchterman-Reingold implementation + boost::fruchterman_reingold_force_directed_layout + (g, position, origin, extent, + attractive_force, repulsive_force, + make_distributed_force_pairs(position, displacement, force_pairs), + make_distributed_cooling(displacement, cool), + displacement); +} + +template +void +fruchterman_reingold_force_directed_layout + (const Graph& g, + PositionMap position, + typename property_traits::value_type const& origin, + typename property_traits::value_type const& extent, + AttractiveForce attractive_force, + RepulsiveForce repulsive_force, + ForcePairs force_pairs, + Cooling cool, + DisplacementMap displacement, + simple_tiling tiling) +{ + typedef typename property_traits::value_type Point; + + // Reduction in the displacement map involves summing the forces + displacement.set_reduce(point_accumulating_reducer()); + + // We need to track the positions of all of our neighbors + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_ADJ_T(u, v, g, Graph) + request(position, v); + + // Invoke the "sequential" Fruchterman-Reingold implementation + boost::fruchterman_reingold_force_directed_layout + (g, position, origin, extent, + attractive_force, repulsive_force, + make_distributed_force_pairs + (position, displacement, force_pairs, + make_neighboring_tiles_force_pairs(position, origin, extent, tiling)), + make_distributed_cooling(displacement, cool), + displacement); +} + +} } } // end namespace boost::graph::distributed + +#endif // BOOST_GRAPH_DISTRIBUTED_FRUCHTERMAN_REINGOLD_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/graphviz.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/graphviz.hpp new file mode 100644 index 0000000000..1ca4082023 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/graphviz.hpp @@ -0,0 +1,294 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_GRAPHVIZ_HPP +#define BOOST_GRAPH_PARALLEL_GRAPHVIZ_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + +template +struct graph_id_writer +{ + explicit graph_id_writer(const Graph& g) : g(g) { } + + void operator()(std::ostream& out) + { + out << " label=\"p" << process_id(g.process_group()) << "\";\n"; + } + + private: + const Graph& g; +}; + +template +struct paint_by_number_writer +{ + explicit paint_by_number_writer(NumberMap number) : number(number) { } + + template + void operator()(std::ostream& out, Descriptor k) + { + static const char* color_names[] = { + "blue", + "brown", + "cyan", + "darkgreen", + "darkorchid", + "darksalmon", + "darkviolet", + "deeppink", + "gold3", + "green", + "magenta", + "navy", + "red", + "yellow", + "palegreen", + "gray65", + "gray21", + "bisque2", + "greenyellow", + "indianred4", + "lightblue2", + "mediumspringgreen", + "orangered", + "orange" + }; + const int colors = sizeof(color_names) / sizeof(color_names[0]); + if (get(number, k) < colors) { + out << " [ style=\"filled\", fillcolor=\"" << color_names[get(number, k)] + << "\" ]"; + } else { + out << " [ label=\"(" << get(number, k) << ")\" ]"; + } + } + + private: + NumberMap number; +}; + +template +inline paint_by_number_writer +paint_by_number(NumberMap number) +{ return paint_by_number_writer(number); } + +template +void +write_graphviz(std::ostream& out, + const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw, + GraphPropertiesWriter gpw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + typedef typename graph_traits::directed_category directed_category; + typedef typename graph_traits::vertices_size_type vertices_size_type; + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef typename property_map::const_type + VertexIndexMap; + typedef typename property_map::const_type + VertexGlobalMap; + + static const bool is_undirected + = (is_base_and_derived::value + || is_same::value); + static const char* graph_kind = is_undirected? "graph" : "digraph"; + static const char* edge_kind = is_undirected? "--" : "->"; + + using boost::graph::parallel::process_group; + process_group_type pg = process_group(g); + + parallel::global_index_map + global_index(pg, num_vertices(g), get(vertex_index, g), + get(vertex_global, g)); + + std::ostringstream local_graph_out; + + local_graph_out << " subgraph cluster_" << process_id(pg) << " {\n"; + gpw(local_graph_out); + + typename graph_traits::vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { + + int global_idx = get(global_index, *vi); + local_graph_out << " n" << global_idx; + vpw(local_graph_out, *vi); + local_graph_out << ";\n"; + } + local_graph_out << " }\n\n"; + + + typename graph_traits::edge_iterator ei, ei_end; + for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { + int source_idx = get(global_index, source(*ei, g)); + int target_idx = get(global_index, target(*ei, g)); + local_graph_out << " n" << source_idx << " " << edge_kind << " n" + << target_idx; + epw(local_graph_out, *ei); + local_graph_out << ";\n"; + } + + if (process_id(pg) == 0) { + out << graph_kind << " g {\n"; + out << local_graph_out.str(); + + synchronize(pg); + for (int i = 1; i < num_processes(pg); ++i) { + int len; + receive(pg, i, 0, len); + char* data = new char [len+1]; + data[len] = 0; + receive(pg, i, 1, data, len); + out << std::endl << data; + delete [] data; + } + out << "}\n"; + } else { + std::string result_str = local_graph_out.str(); + const char* data = result_str.c_str(); + + int len = result_str.length(); + send(pg, 0, 0, len); + send(pg, 0, 1, data, len); + synchronize(pg); + } + synchronize(pg); + synchronize(pg); + synchronize(pg); +} + +template +inline void +write_graphviz(std::ostream& out, + const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + write_graphviz(out, g, vpw, epw, graph_id_writer(g)); +} + +template +inline void +write_graphviz(std::ostream& out, + const Graph& g, + VertexPropertiesWriter vpw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + write_graphviz(out, g, vpw, default_writer()); +} + +template +inline void +write_graphviz(std::ostream& out, const Graph& g + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + write_graphviz(out, g, default_writer()); +} + +template +void +write_graphviz(const std::string& filename, + const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw, + GraphPropertiesWriter gpw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + if (process_id(g.process_group()) == 0) { + std::ofstream out(filename.c_str()); + write_graphviz(out, g, vpw, epw, gpw); + } else { + write_graphviz(std::cout, g, vpw, epw, gpw); + } +} + +template +void +write_graphviz(const std::string& filename, + const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + if (process_id(g.process_group()) == 0) { + std::ofstream out(filename.c_str()); + write_graphviz(out, g, vpw, epw); + } else { + write_graphviz(std::cout, g, vpw, epw); + } +} + +template +void +write_graphviz(const std::string& filename, + const Graph& g, + VertexPropertiesWriter vpw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + if (process_id(g.process_group()) == 0) { + std::ofstream out(filename.c_str()); + write_graphviz(out, g, vpw); + } else { + write_graphviz(std::cout, g, vpw); + } +} + +template +void +write_graphviz(const std::string& filename, const Graph& g + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + if (process_id(g.process_group()) == 0) { + std::ofstream out(filename.c_str()); + write_graphviz(out, g); + } else { + write_graphviz(std::cout, g); + } +} + +template +void +write_graphviz(std::ostream& out, const Graph& g, + const dynamic_properties& dp, + const std::string& node_id = "node_id" + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + write_graphviz + (out, g, + /*vertex_writer=*/dynamic_vertex_properties_writer(dp, node_id), + /*edge_writer=*/dynamic_properties_writer(dp)); +} + +} // end namespace boost + +#endif // BOOST_GRAPH_PARALLEL_GRAPHVIZ_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/hohberg_biconnected_components.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/hohberg_biconnected_components.hpp new file mode 100644 index 0000000000..8c3c16a446 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/hohberg_biconnected_components.hpp @@ -0,0 +1,1129 @@ +// Copyright 2005 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 + +// An implementation of Walter Hohberg's distributed biconnected +// components algorithm, from: +// +// Walter Hohberg. How to Find Biconnected Components in Distributed +// Networks. J. Parallel Distrib. Comput., 9(4):374-386, 1990. +// +#ifndef BOOST_GRAPH_DISTRIBUTED_HOHBERG_BICONNECTED_COMPONENTS_HPP +#define BOOST_GRAPH_DISTRIBUTED_HOHBERG_BICONNECTED_COMPONENTS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +/* You can define PBGL_HOHBERG_DEBUG to an integer value (1, 2, or 3) + * to enable debugging information. 1 includes only the phases of the + * algorithm and messages as their are received. 2 and 3 add + * additional levels of detail about internal data structures related + * to the algorithm itself. + * + * #define PBGL_HOHBERG_DEBUG 1 +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for std::pair +#include +#include // for std::find, std::mismatch +#include +#include +#include + +namespace boost { namespace graph { namespace distributed { + +namespace hohberg_detail { + enum message_kind { + /* A header for the PATH message, stating which edge the message + is coming on and how many vertices will be following. The data + structure communicated will be a path_header. */ + msg_path_header, + /* A message containing the vertices that make up a path. It will + always follow a msg_path_header and will contain vertex + descriptors, only. */ + msg_path_vertices, + /* A header for the TREE message, stating the value of gamma and + the number of vertices to come in the following + msg_tree_vertices. */ + msg_tree_header, + /* A message containing the vertices that make up the set of + vertices in the same bicomponent as the sender. It will always + follow a msg_tree_header and will contain vertex descriptors, + only. */ + msg_tree_vertices, + /* Provides a name for the biconnected component of the edge. */ + msg_name + }; + + // Payload for a msg_path_header message. + template + struct path_header + { + // The edge over which the path is being communicated + EdgeDescriptor edge; + + // The length of the path, i.e., the number of vertex descriptors + // that will be coming in the next msg_path_vertices message. + std::size_t path_length; + + template + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & edge & path_length; + } + }; + + // Payload for a msg_tree_header message. + template + struct tree_header + { + // The edge over which the tree is being communicated + Edge edge; + + // Gamma, which is the eta of the sender. + Vertex gamma; + + // The length of the list of vertices in the bicomponent, i.e., + // the number of vertex descriptors that will be coming in the + // next msg_tree_vertices message. + std::size_t bicomp_length; + + template + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & edge & gamma & bicomp_length; + } + }; + + // Payload for the msg_name message. + template + struct name_header + { + // The edge being communicated and named. + EdgeDescriptor edge; + + // The 0-based name of the component + std::size_t name; + + template + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & edge & name; + } + }; + + /* Computes the branch point between two paths. The branch point is + the last position at which both paths are equivalent, beyond + which the paths diverge. Both paths must have length > 0 and the + initial elements of the paths must be equal. This is guaranteed + in Hohberg's algorithm because all paths start at the + leader. Returns the value at the branch point. */ + template + T branch_point(const std::vector& p1, const std::vector& p2) + { + assert(!p1.empty()); + assert(!p2.empty()); + assert(p1.front() == p2.front()); + + typedef typename std::vector::const_iterator iterator; + + iterator mismatch_pos; + if (p1.size() <= p2.size()) + mismatch_pos = std::mismatch(p1.begin(), p1.end(), p2.begin()).first; + else + mismatch_pos = std::mismatch(p2.begin(), p2.end(), p1.begin()).first; + --mismatch_pos; + return *mismatch_pos; + } + + /* Computes the infimum of vertices a and b in the given path. The + infimum is the largest element that is on the paths from a to the + root and from b to the root. */ + template + T infimum(const std::vector& parent_path, T a, T b) + { + using std::swap; + + typedef typename std::vector::const_iterator iterator; + iterator first = parent_path.begin(), last = parent_path.end(); + +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << "infimum("; + for (iterator i = first; i != last; ++i) { + if (i != first) std::cerr << ' '; + std::cerr << local(*i) << '@' << owner(*i); + } + std::cerr << ", " << local(a) << '@' << owner(a) << ", " + << local(b) << '@' << owner(b) << ") = "; +#endif + + if (a == b) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << local(a) << '@' << owner(a) << std::endl; +#endif + return a; + } + + // Try to find a or b, whichever is closest to the end + --last; + while (*last != a) { + // If we match b, swap the two so we'll be looking for b later. + if (*last == b) { swap(a,b); break; } + + if (last == first) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << local(*first) << '@' << owner(*first) << std::endl; +#endif + return *first; + } + else --last; + } + + // Try to find b (which may originally have been a) + while (*last != b) { + if (last == first) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << local(*first) << '@' << owner(*first) << std::endl; +#endif + return *first; + } + else --last; + } + +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << local(*last) << '@' << owner(*last) << std::endl; +#endif + // We've found b; it's the infimum. + return *last; + } +} // end namespace hohberg_detail + +/* A message that will be stored for each edge by Hohberg's algorithm. */ +template +struct hohberg_message +{ + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + + // Assign from a path message + void assign(const std::vector& path) + { + gamma = graph_traits::null_vertex(); + path_or_bicomp = path; + } + + // Assign from a tree message + void assign(Vertex gamma, const std::vector& in_same_bicomponent) + { + this->gamma = gamma; + path_or_bicomp = in_same_bicomponent; + } + + bool is_path() const { return gamma == graph_traits::null_vertex(); } + bool is_tree() const { return gamma != graph_traits::null_vertex(); } + + /// The "gamma" of a tree message, or null_vertex() for a path message + Vertex gamma; + + // Either the path for a path message or the in_same_bicomponent + std::vector path_or_bicomp; +}; + + +/* An abstraction of a vertex processor in Hohberg's algorithm. The + hohberg_vertex_processor class is responsible for processing + messages transmitted to it via its edges. */ +template +class hohberg_vertex_processor +{ + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::edge_descriptor Edge; + typedef typename graph_traits::degree_size_type degree_size_type; + typedef typename graph_traits::edges_size_type edges_size_type; + typedef typename boost::graph::parallel::process_group_type::type + ProcessGroup; + typedef std::vector path_t; + typedef typename path_t::iterator path_iterator; + + public: + hohberg_vertex_processor() + : phase(1), + parent(graph_traits::null_vertex()), + eta(graph_traits::null_vertex()) + { + } + + // Called to initialize a leader in the algorithm, which involves + // sending out the initial path messages and being ready to receive + // them. + void initialize_leader(Vertex alpha, const Graph& g); + + /// Handle a path message on edge e. The path will be destroyed by + /// this operation. + void + operator()(Edge e, path_t& path, const Graph& g); + + /// Handle a tree message on edge e. in_same_bicomponent will be + /// destroyed by this operation. + void + operator()(Edge e, Vertex gamma, path_t& in_same_bicomponent, + const Graph& g); + + // Handle a name message. + void operator()(Edge e, edges_size_type name, const Graph& g); + + // Retrieve the phase + unsigned char get_phase() const { return phase; } + + // Start the naming phase. The current phase must be 3 (echo), and + // the offset contains the offset at which this processor should + // begin when labelling its bicomponents. The offset is just a + // parallel prefix sum of the number of bicomponents in each + // processor that precedes it (globally). + void + start_naming_phase(Vertex alpha, const Graph& g, edges_size_type offset); + + /* Determine the number of bicomponents that we will be naming + * ourselves. + */ + edges_size_type num_starting_bicomponents(Vertex alpha, const Graph& g); + + // Fill in the edge component map with biconnected component + // numbers. + template + void fill_edge_map(Vertex alpha, const Graph& g, ComponentMap& component); + + protected: + /* Start the echo phase (phase 3) where we propagate information up + the tree. */ + void echo_phase(Vertex alpha, const Graph& g); + + /* Retrieve the index of edge in the out-edges list of target(e, g). */ + std::size_t get_edge_index(Edge e, const Graph& g); + + /* Retrieve the index of the edge incidence on v in the out-edges + list of vertex u. */ + std::size_t get_incident_edge_index(Vertex u, Vertex v, const Graph& g); + + /* Keeps track of which phase of the algorithm we are in. There are + * four phases plus the "finished" phase: + * + * 1) Building the spanning tree + * 2) Discovering cycles + * 3) Echoing back up the spanning tree + * 4) Labelling biconnected components + * 5) Finished + */ + unsigned char phase; + + /* The parent of this vertex in the spanning tree. This value will + be graph_traits::null_vertex() for the leader. */ + Vertex parent; + + /* The farthest ancestor up the tree that resides in the same + biconnected component as we do. This information is approximate: + we might not know about the actual farthest ancestor, but this is + the farthest one we've seen so far. */ + Vertex eta; + + /* The number of edges that have not yet transmitted any messages to + us. This starts at the degree of the vertex and decreases as we + receive messages. When this counter hits zero, we're done with + the second phase of the algorithm. In Hohberg's paper, the actual + remaining edge set E is stored with termination when all edges + have been removed from E, but we only need to detect termination + so the set E need not be explicitly represented. */ + degree_size_type num_edges_not_transmitted; + + /* The path from the root of the spanning tree to this vertex. This + vector will always store only the parts of the path leading up to + this vertex, and not the vertex itself. Thus, it will be empty + for the leader. */ + std::vector path_from_root; + + /* Structure containing all of the extra data we need to keep around + PER EDGE. This information can not be contained within a property + map, because it can't be shared among vertices without breaking + the algorithm. Decreasing the size of this structure will drastically */ + struct per_edge_data + { + hohberg_message msg; + std::vector M; + bool is_tree_edge; + degree_size_type partition; + }; + + /* Data for each edge in the graph. This structure will be indexed + by the position of the edge in the out_edges() list. */ + std::vector edge_data; + + /* The mapping from local partition numbers (0..n-1) to global + partition numbers. */ + std::vector local_to_global_partitions; + + friend class boost::serialization::access; + + // We cannot actually serialize a vertex processor, nor would we + // want to. However, the fact that we're putting instances into a + // distributed_property_map means that we need to have a serialize() + // function available. + template + void serialize(Archiver&, const unsigned int /*version*/) + { + assert(false); + } +}; + +template +void +hohberg_vertex_processor::initialize_leader(Vertex alpha, + const Graph& g) +{ + using namespace hohberg_detail; + + ProcessGroup pg = process_group(g); + + typename property_map::const_type + owner = get(vertex_owner, g); + + path_header header; + header.path_length = 1; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + header.edge = e; + send(pg, get(owner, target(e, g)), msg_path_header, header); + send(pg, get(owner, target(e, g)), msg_path_vertices, alpha); + } + + num_edges_not_transmitted = degree(alpha, g); + edge_data.resize(num_edges_not_transmitted); + phase = 2; +} + +template +void +hohberg_vertex_processor::operator()(Edge e, path_t& path, + const Graph& g) +{ + using namespace hohberg_detail; + + typename property_map::const_type + owner = get(vertex_owner, g); + +#ifdef PBGL_HOHBERG_DEBUG +// std::cerr << local(source(e, g)) << '@' << owner(source(e, g)) << " -> " +// << local(target(e, g)) << '@' << owner(target(e, g)) << ": path("; +// for (std::size_t i = 0; i < path.size(); ++i) { +// if (i > 0) std::cerr << ' '; +// std::cerr << local(path[i]) << '@' << owner(path[i]); +// } + std::cerr << "), phase = " << (int)phase << std::endl; +#endif + + // Get access to edge-specific data + if (edge_data.empty()) + edge_data.resize(degree(target(e, g), g)); + per_edge_data& edata = edge_data[get_edge_index(e, g)]; + + // Record the message. We'll need it in phase 3. + edata.msg.assign(path); + + // Note: "alpha" refers to the vertex "processor" receiving the + // message. + Vertex alpha = target(e, g); + + switch (phase) { + case 1: + { + num_edges_not_transmitted = degree(alpha, g) - 1; + edata.is_tree_edge = true; + parent = path.back(); + eta = parent; + edata.M.clear(); edata.M.push_back(parent); + + // Broadcast the path from the root to our potential children in + // the spanning tree. + path.push_back(alpha); + path_header header; + header.path_length = path.size(); + ProcessGroup pg = process_group(g); + BGL_FORALL_OUTEDGES_T(alpha, oe, g, Graph) { + // Skip the tree edge we just received + if (target(oe, g) != source(e, g)) { + header.edge = oe; + send(pg, get(owner, target(oe, g)), msg_path_header, header); + send(pg, get(owner, target(oe, g)), msg_path_vertices, &path[0], + header.path_length); + } + } + path.pop_back(); + + // Swap the old path in, to save some extra copying. Nobody + path_from_root.swap(path); + + // Once we have received our place in the spanning tree, move on + // to phase 2. + phase = 2; + + // If we only had only edge, skip to phase 3. + if (num_edges_not_transmitted == 0) + echo_phase(alpha, g); + return; + } + + case 2: + { + --num_edges_not_transmitted; + edata.is_tree_edge = false; + + // Determine if alpha (our vertex) is in the path + path_iterator pos = std::find(path.begin(), path.end(), alpha); + if (pos != path.end()) { + // Case A: There is a cycle alpha beta ... gamma alpha + // M(e) <- {beta, gammar} + edata.M.clear(); + ++pos; + // If pos == path.end(), we have a self-loop + if (pos != path.end()) { + // Add beta + edata.M.push_back(*pos); + ++pos; + } + // If pos == path.end(), we have a self-loop or beta == gamma + // (parallel edge). Otherwise, add gamma. + if (pos != path.end()) edata.M.push_back(path.back()); + } else { + // Case B: There is a cycle but we haven't seen alpha yet. + // M(e) = {parent, path.back()} + edata.M.clear(); + edata.M.push_back(path.back()); + if (parent != path.back()) edata.M.push_back(parent); + + // eta = inf(eta, bra(pi_t, pi)) + eta = infimum(path_from_root, eta, branch_point(path_from_root, path)); + } + if (num_edges_not_transmitted == 0) + echo_phase(alpha, g); + break; + } + + default: +// std::cerr << "Phase is " << int(phase) << "\n"; + assert(false); + } +} + +template +void +hohberg_vertex_processor::operator()(Edge e, Vertex gamma, + path_t& in_same_bicomponent, + const Graph& g) +{ + using namespace hohberg_detail; + +#ifdef PBGL_HOHBERG_DEBUG + std::cerr << local(source(e, g)) << '@' << owner(source(e, g)) << " -> " + << local(target(e, g)) << '@' << owner(target(e, g)) << ": tree(" + << local(gamma) << '@' << owner(gamma) << ", "; + for (std::size_t i = 0; i < in_same_bicomponent.size(); ++i) { + if (i > 0) std::cerr << ' '; + std::cerr << local(in_same_bicomponent[i]) << '@' + << owner(in_same_bicomponent[i]); + } + std::cerr << ", " << local(source(e, g)) << '@' << owner(source(e, g)) + << "), phase = " << (int)phase << std::endl; +#endif + + // Get access to edge-specific data + per_edge_data& edata = edge_data[get_edge_index(e, g)]; + + // Record the message. We'll need it in phase 3. + edata.msg.assign(gamma, in_same_bicomponent); + + // Note: "alpha" refers to the vertex "processor" receiving the + // message. + Vertex alpha = target(e, g); + Vertex beta = source(e, g); + + switch (phase) { + case 2: + --num_edges_not_transmitted; + edata.is_tree_edge = true; + + if (gamma == alpha) { + // Case C + edata.M.swap(in_same_bicomponent); + } else { + // Case D + edata.M.clear(); + edata.M.push_back(parent); + if (beta != parent) edata.M.push_back(beta); + eta = infimum(path_from_root, eta, gamma); + } + if (num_edges_not_transmitted == 0) + echo_phase(alpha, g); + break; + + default: + assert(false); + } +} + +template +void +hohberg_vertex_processor::operator()(Edge e, edges_size_type name, + const Graph& g) +{ + using namespace hohberg_detail; + +#ifdef PBGL_HOHBERG_DEBUG + std::cerr << local(source(e, g)) << '@' << owner(source(e, g)) << " -> " + << local(target(e, g)) << '@' << owner(target(e, g)) << ": name(" + << name << "), phase = " << (int)phase << std::endl; +#endif + + assert(phase == 4); + + typename property_map::const_type + owner = get(vertex_owner, g); + + // Send name messages along the spanning tree edges that are in the + // same bicomponent as the edge to our parent. + ProcessGroup pg = process_group(g); + + Vertex alpha = target(e, g); + + std::size_t idx = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + per_edge_data& edata = edge_data[idx++]; + if (edata.is_tree_edge + && find(edata.M.begin(), edata.M.end(), parent) != edata.M.end() + && target(e, g) != parent) { + // Notify our children in the spanning tree of this name + name_header header; + header.edge = e; + header.name = name; + send(pg, get(owner, target(e, g)), msg_name, header); + } else if (target(e, g) == parent) { + // Map from local partition numbers to global bicomponent numbers + local_to_global_partitions[edata.partition] = name; + } + } + + // Final stage + phase = 5; +} + +template +typename hohberg_vertex_processor::edges_size_type +hohberg_vertex_processor:: +num_starting_bicomponents(Vertex alpha, const Graph& g) +{ + edges_size_type not_mapped = (std::numeric_limits::max)(); + + edges_size_type result = 0; + std::size_t idx = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + per_edge_data& edata = edge_data[idx++]; + if (edata.is_tree_edge + && find(edata.M.begin(), edata.M.end(), parent) == edata.M.end()) { + // Map from local partition numbers to global bicomponent numbers + if (local_to_global_partitions[edata.partition] == not_mapped) + local_to_global_partitions[edata.partition] = result++; + } + } + +#ifdef PBGL_HOHBERG_DEBUG + std::cerr << local(alpha) << '@' << owner(alpha) << " has " << result + << " bicomponents originating at it." << std::endl; +#endif + + return result; +} + +template +template +void +hohberg_vertex_processor:: +fill_edge_map(Vertex alpha, const Graph& g, ComponentMap& component) +{ + std::size_t idx = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + per_edge_data& edata = edge_data[idx++]; + local_put(component, e, local_to_global_partitions[edata.partition]); + +#if defined(PBGL_HOHBERG_DEBUG) && PBGL_HOHBERG_DEBUG > 2 + std::cerr << "component(" + << local(source(e, g)) << '@' << owner(source(e, g)) << " -> " + << local(target(e, g)) << '@' << owner(target(e, g)) << ") = " + << local_to_global_partitions[edata.partition] + << " (partition = " << edata.partition << " of " + << local_to_global_partitions.size() << ")" << std::endl; +#endif + } +} + +template +void +hohberg_vertex_processor:: +start_naming_phase(Vertex alpha, const Graph& g, edges_size_type offset) +{ + using namespace hohberg_detail; + + assert(phase == 4); + + typename property_map::const_type + owner = get(vertex_owner, g); + + // Send name messages along the spanning tree edges of the + // components that we get to number. + ProcessGroup pg = process_group(g); + + bool has_more_children_to_name = false; + + // Map from local partition numbers to global bicomponent numbers + edges_size_type not_mapped = (std::numeric_limits::max)(); + for (std::size_t i = 0; i < local_to_global_partitions.size(); ++i) { + if (local_to_global_partitions[i] != not_mapped) + local_to_global_partitions[i] += offset; + } + + std::size_t idx = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + per_edge_data& edata = edge_data[idx++]; + if (edata.is_tree_edge + && find(edata.M.begin(), edata.M.end(), parent) == edata.M.end()) { + // Notify our children in the spanning tree of this new name + name_header header; + header.edge = e; + header.name = local_to_global_partitions[edata.partition]; + send(pg, get(owner, target(e, g)), msg_name, header); + } else if (edata.is_tree_edge) { + has_more_children_to_name = true; + } +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << "M[" << local(source(e, g)) << '@' << owner(source(e, g)) + << " -> " << local(target(e, g)) << '@' << owner(target(e, g)) + << "] = "; + for (std::size_t i = 0; i < edata.M.size(); ++i) { + std::cerr << local(edata.M[i]) << '@' << owner(edata.M[i]) << ' '; + } + std::cerr << std::endl; +#endif + } + + // See if we're done. + if (!has_more_children_to_name) + // Final stage + phase = 5; +} + +template +void +hohberg_vertex_processor::echo_phase(Vertex alpha, const Graph& g) +{ + using namespace hohberg_detail; + + typename property_map::const_type + owner = get(vertex_owner, g); + + /* We're entering the echo phase. */ + phase = 3; + + if (parent != graph_traits::null_vertex()) { + Edge edge_to_parent; + +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 1 + std::cerr << local(alpha) << '@' << owner(alpha) << " echo: parent = " + << local(parent) << '@' << owner(parent) << ", eta = " + << local(eta) << '@' << owner(eta) << ", Gamma = "; +#endif + + std::vector bicomp; + std::size_t e_index = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + if (target(e, g) == parent && parent == eta) { + edge_to_parent = e; + if (find(bicomp.begin(), bicomp.end(), alpha) == bicomp.end()) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 1 + std::cerr << local(alpha) << '@' << owner(alpha) << ' '; +#endif + bicomp.push_back(alpha); + } + } else { + if (target(e, g) == parent) edge_to_parent = e; + + per_edge_data& edata = edge_data[e_index]; + + if (edata.msg.is_path()) { + path_iterator pos = std::find(edata.msg.path_or_bicomp.begin(), + edata.msg.path_or_bicomp.end(), + eta); + if (pos != edata.msg.path_or_bicomp.end()) { + ++pos; + if (pos != edata.msg.path_or_bicomp.end() + && find(bicomp.begin(), bicomp.end(), *pos) == bicomp.end()) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 1 + std::cerr << local(*pos) << '@' << owner(*pos) << ' '; +#endif + bicomp.push_back(*pos); + } + } + } else if (edata.msg.is_tree() && edata.msg.gamma == eta) { + for (path_iterator i = edata.msg.path_or_bicomp.begin(); + i != edata.msg.path_or_bicomp.end(); ++i) { + if (find(bicomp.begin(), bicomp.end(), *i) == bicomp.end()) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 1 + std::cerr << local(*i) << '@' << owner(*i) << ' '; +#endif + bicomp.push_back(*i); + } + } + } + } + ++e_index; + } +#ifdef PBGL_HOHBERG_DEBUG + std::cerr << std::endl; +#endif + + // Send tree(eta, bicomp) to parent + tree_header header; + header.edge = edge_to_parent; + header.gamma = eta; + header.bicomp_length = bicomp.size(); + ProcessGroup pg = process_group(g); + send(pg, get(owner, parent), msg_tree_header, header); + send(pg, get(owner, parent), msg_tree_vertices, &bicomp[0], + header.bicomp_length); + } + + // Compute the partition of edges such that iff two edges e1 and e2 + // are in different subsets then M(e1) is disjoint from M(e2). + + // Start by putting each edge in a different partition + std::vector parent_vec(edge_data.size()); + degree_size_type idx = 0; + for (idx = 0; idx < edge_data.size(); ++idx) + parent_vec[idx] = idx; + + // Go through each edge e, performing a union() on the edges + // incident on all vertices in M[e]. + idx = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + per_edge_data& edata = edge_data[idx++]; + + // Compute union of vertices in M + if (!edata.M.empty()) { + degree_size_type e1 = get_incident_edge_index(alpha, edata.M.front(), g); + while (parent_vec[e1] != e1) e1 = parent_vec[e1]; + + for (std::size_t i = 1; i < edata.M.size(); ++i) { + degree_size_type e2 = get_incident_edge_index(alpha, edata.M[i], g); + while (parent_vec[e2] != e2) e2 = parent_vec[e2]; + parent_vec[e2] = e1; + } + } + } + + edges_size_type not_mapped = (std::numeric_limits::max)(); + + // Determine the number of partitions + for (idx = 0; idx < parent_vec.size(); ++idx) { + if (parent_vec[idx] == idx) { + edge_data[idx].partition = local_to_global_partitions.size(); + local_to_global_partitions.push_back(not_mapped); + } + } + + // Assign partition numbers to each edge + for (idx = 0; idx < parent_vec.size(); ++idx) { + degree_size_type rep = parent_vec[idx]; + while (rep != parent_vec[rep]) rep = parent_vec[rep]; + edge_data[idx].partition = edge_data[rep].partition; + } + + // Enter the naming phase (but don't send anything yet). + phase = 4; +} + +template +std::size_t +hohberg_vertex_processor::get_edge_index(Edge e, const Graph& g) +{ + std::size_t result = 0; + BGL_FORALL_OUTEDGES_T(target(e, g), oe, g, Graph) { + if (source(e, g) == target(oe, g)) return result; + ++result; + } + assert(false); +} + +template +std::size_t +hohberg_vertex_processor::get_incident_edge_index(Vertex u, Vertex v, + const Graph& g) +{ + std::size_t result = 0; + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) { + if (target(e, g) == v) return result; + ++result; + } + assert(false); +} + +template +typename graph_traits::edges_size_type +hohberg_biconnected_components + (const Graph& g, + ComponentMap component, + InputIterator first, InputIterator last, + VertexProcessorMap vertex_processor) +{ + using namespace boost::graph::parallel; + using namespace hohberg_detail; + using boost::parallel::all_reduce; + + typename property_map::const_type + owner = get(vertex_owner, g); + + // The graph must be undirected + BOOST_STATIC_ASSERT( + (is_convertible::directed_category, + undirected_tag>::value)); + + // The graph must model Incidence Graph + function_requires< IncidenceGraphConcept >(); + + typedef typename graph_traits::edges_size_type edges_size_type; + typedef typename graph_traits::degree_size_type degree_size_type; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::edge_descriptor edge_descriptor; + + // Retrieve the process group we will use for communication + typedef typename process_group_type::type process_group_type; + process_group_type pg = process_group(g); + + // Keeps track of the edges that we know to be tree edges. + std::vector tree_edges; + + // The leaders send out a path message to initiate the algorithm + while (first != last) { + vertex_descriptor leader = *first; + if (process_id(pg) == get(owner, leader)) + vertex_processor[leader].initialize_leader(leader, g); + ++first; + } + synchronize(pg); + + // Will hold the number of bicomponents in the graph. + edges_size_type num_bicomponents = 0; + + // Keep track of the path length that we should expect, based on the + // level in the breadth-first search tree. At present, this is only + // used as a sanity check. TBD: This could be used to decrease the + // amount of communication required per-edge (by about 4 bytes). + std::size_t path_length = 1; + + typedef std::vector path_t; + typedef typename path_t::iterator path_iterator; + + unsigned char minimum_phase = 5; + do { + while (optional > msg = probe(pg)) { + switch (msg->second) { + case msg_path_header: + { + // Receive the path header + path_header header; + receive(pg, msg->first, msg->second, header); + assert(path_length == header.path_length); + + // Receive the path itself + path_t path(path_length); + receive(pg, msg->first, msg_path_vertices, &path[0], path_length); + + edge_descriptor e = header.edge; + vertex_processor[target(e, g)](e, path, g); + } + break; + + case msg_path_vertices: + // Should be handled in msg_path_header case, unless we're going + // stateless. + assert(false); + break; + + case msg_tree_header: + { + // Receive the tree header + tree_header header; + receive(pg, msg->first, msg->second, header); + + // Receive the tree itself + path_t in_same_bicomponent(header.bicomp_length); + receive(pg, msg->first, msg_tree_vertices, &in_same_bicomponent[0], + header.bicomp_length); + + edge_descriptor e = header.edge; + vertex_processor[target(e, g)](e, header.gamma, in_same_bicomponent, + g); + } + break; + + case msg_tree_vertices: + // Should be handled in msg_tree_header case, unless we're + // going stateless. + assert(false); + break; + + case msg_name: + { + name_header header; + receive(pg, msg->first, msg->second, header); + edge_descriptor e = header.edge; + vertex_processor[target(e, g)](e, header.name, g); + } + break; + + default: + assert(false); + } + } + ++path_length; + + // Compute minimum phase locally + minimum_phase = 5; + unsigned char maximum_phase = 1; + BGL_FORALL_VERTICES_T(v, g, Graph) { + minimum_phase = (std::min)(minimum_phase, vertex_processor[v].get_phase()); + maximum_phase = (std::max)(maximum_phase, vertex_processor[v].get_phase()); + } + +#ifdef PBGL_HOHBERG_DEBUG + if (process_id(pg) == 0) + std::cerr << "<---------End of stage------------->" << std::endl; +#endif + // Compute minimum phase globally + minimum_phase = all_reduce(pg, minimum_phase, boost::mpi::minimum()); + +#ifdef PBGL_HOHBERG_DEBUG + if (process_id(pg) == 0) + std::cerr << "Minimum phase = " << (int)minimum_phase << std::endl; +#endif + + if (minimum_phase == 4 + && all_reduce(pg, maximum_phase, boost::mpi::maximum()) == 4) { + +#ifdef PBGL_HOHBERG_DEBUG + if (process_id(pg) == 0) + std::cerr << "<---------Naming phase------------->" << std::endl; +#endif + // Compute the biconnected component number offsets for each + // vertex. + std::vector local_offsets; + local_offsets.reserve(num_vertices(g)); + edges_size_type num_local_bicomponents = 0; + BGL_FORALL_VERTICES_T(v, g, Graph) { + local_offsets.push_back(num_local_bicomponents); + num_local_bicomponents += + vertex_processor[v].num_starting_bicomponents(v, g); + } + + synchronize(pg); + + // Find our the number of bicomponent names that will originate + // from each process. This tells us how many bicomponents are in + // the entire graph and what our global offset is for computing + // our own biconnected component names. + std::vector all_bicomponents(num_processes(pg)); + all_gather(pg, &num_local_bicomponents, &num_local_bicomponents + 1, + all_bicomponents); + num_bicomponents = 0; + edges_size_type my_global_offset = 0; + for (std::size_t i = 0; i < all_bicomponents.size(); ++i) { + if (i == (std::size_t)process_id(pg)) + my_global_offset = num_bicomponents; + num_bicomponents += all_bicomponents[i]; + } + + std::size_t index = 0; + BGL_FORALL_VERTICES_T(v, g, Graph) { + edges_size_type offset = my_global_offset + local_offsets[index++]; + vertex_processor[v].start_naming_phase(v, g, offset); + } + } + + synchronize(pg); + } while (minimum_phase < 5); + + // Number the edges appropriately. + BGL_FORALL_VERTICES_T(v, g, Graph) + vertex_processor[v].fill_edge_map(v, g, component); + + return num_bicomponents; +} + +template +typename graph_traits::edges_size_type +hohberg_biconnected_components + (const Graph& g, ComponentMap component, + InputIterator first, InputIterator last) + +{ + std::vector > + vertex_processors(num_vertices(g)); + return hohberg_biconnected_components + (g, component, first, last, + make_iterator_property_map(vertex_processors.begin(), + get(vertex_index, g))); +} + +template +typename graph_traits::edges_size_type +hohberg_biconnected_components(const Graph& g, ComponentMap component, + ParentMap parent) +{ + // We need the connected components of the graph, but we don't care + // about component numbers. + connected_components(g, dummy_property_map(), parent); + + // Each root in the parent map is a leader + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + std::vector leaders; + BGL_FORALL_VERTICES_T(v, g, Graph) + if (get(parent, v) == v) leaders.push_back(v); + + return hohberg_biconnected_components(g, component, + leaders.begin(), leaders.end()); +} + +template +typename graph_traits::edges_size_type +hohberg_biconnected_components(const Graph& g, ComponentMap component) +{ + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + std::vector parents(num_vertices(g)); + return hohberg_biconnected_components + (g, component, make_iterator_property_map(parents.begin(), + get(vertex_index, g))); +} + +} } } // end namespace boost::graph::distributed + +#endif // BOOST_GRAPH_DISTRIBUTED_HOHBERG_BICONNECTED_COMPONENTS_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/local_subgraph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/local_subgraph.hpp new file mode 100644 index 0000000000..0029623175 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/local_subgraph.hpp @@ -0,0 +1,175 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_LOCAL_SUBGRAPH_HPP +#define BOOST_GRAPH_LOCAL_SUBGRAPH_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include + +namespace boost { + +namespace graph { namespace detail { + // Optionally, virtually derive from a base class + template struct derive_from_if; + template struct derive_from_if : virtual Base {}; + template struct derive_from_if {}; + + template + struct derive_from_if_tag_is : + derive_from_if<(is_base_and_derived::value + || is_same::value), + NewBase> + { + }; +} } // end namespace graph::detail + +template +class is_local_edge +{ +public: + typedef bool result_type; + typedef typename graph_traits::edge_descriptor + argument_type; + + is_local_edge() : g(0) {} + is_local_edge(DistributedGraph& g) : g(&g), owner(get(vertex_owner, g)) {} + + // Since either the source or target vertex must be local, the + // equivalence of their owners indicates a local edge. + result_type operator()(const argument_type& e) const + { return get(owner, source(e, *g)) == get(owner, target(e, *g)); } + +private: + DistributedGraph* g; + typename property_map::const_type owner; +}; + +template +class is_local_vertex +{ +public: + typedef bool result_type; + typedef typename graph_traits::vertex_descriptor + argument_type; + + is_local_vertex() : g(0) {} + is_local_vertex(DistributedGraph& g) : g(&g), owner(get(vertex_owner, g)) { } + + // Since either the source or target vertex must be local, the + // equivalence of their owners indicates a local edge. + result_type operator()(const argument_type& v) const + { + return get(owner, v) == process_id(process_group(*g)); + } + +private: + DistributedGraph* g; + typename property_map::const_type owner; +}; + +template +class local_subgraph + : public filtered_graph, + is_local_vertex > +{ + typedef filtered_graph, + is_local_vertex > + inherited; + typedef typename graph_traits::traversal_category + inherited_category; + +public: + struct traversal_category : + graph::detail::derive_from_if_tag_is, + graph::detail::derive_from_if_tag_is, + graph::detail::derive_from_if_tag_is, + graph::detail::derive_from_if_tag_is, + graph::detail::derive_from_if_tag_is, + graph::detail::derive_from_if_tag_is + { }; + + local_subgraph(DistributedGraph& g) + : inherited(g, + is_local_edge(g), + is_local_vertex(g)), + g(g) + { + } + + // Distributed Container + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + + process_group_type& process_group() + { + using boost::graph::parallel::process_group; + return process_group(g); + } + const process_group_type& process_group() const + { + using boost::graph::parallel::process_group; + return boost::graph::parallel::process_group(g); + } + + DistributedGraph& base() { return g; } + const DistributedGraph& base() const { return g; } + +private: + DistributedGraph& g; +}; + +template +class property_map, PropertyTag> + : public property_map { }; + +template +class property_map, PropertyTag> +{ + public: + typedef typename property_map::const_type + type; + typedef type const_type; +}; + +template +inline typename property_map, PropertyTag>::type +get(PropertyTag p, local_subgraph& g) +{ return get(p, g.base()); } + +template +inline typename property_map, PropertyTag> + ::const_type +get(PropertyTag p, const local_subgraph& g) +{ return get(p, g.base()); } + +template +inline local_subgraph +make_local_subgraph(DistributedGraph& g) +{ return local_subgraph(g); } + +} // end namespace boost + +#endif // BOOST_GRAPH_LOCAL_SUBGRAPH_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/mpi_process_group.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/mpi_process_group.hpp new file mode 100644 index 0000000000..e0ee579029 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/mpi_process_group.hpp @@ -0,0 +1,809 @@ +// Copyright (C) 2004-2008 The Trustees of Indiana University. +// Copyright (C) 2007 Douglas Gregor +// Copyright (C) 2007 Matthias Troyer + +// 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 +// Matthias Troyer +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_MPI_PROCESS_GROUP +#define BOOST_GRAPH_DISTRIBUTED_MPI_PROCESS_GROUP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +//#define NO_SPLIT_BATCHES +#define SEND_OOB_BSEND + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace graph { namespace distributed { + +// Process group tags +struct mpi_process_group_tag : virtual parallel::linear_process_group_tag { }; + +class mpi_process_group +{ + struct impl; + + public: + /// Number of tags available to each data structure. + static const int max_tags = 256; + + /** + * The type of a "receive" handler, that will be provided with + * (source, tag) pairs when a message is received. Users can provide a + * receive handler for a distributed data structure, for example, to + * automatically pick up and respond to messages as needed. + */ + typedef function receiver_type; + + /** + * The type of a handler for the on-synchronize event, which will be + * executed at the beginning of synchronize(). + */ + typedef function0 on_synchronize_event_type; + + /// Used as a tag to help create an "empty" process group. + struct create_empty {}; + + /// The type used to buffer message data + typedef boost::mpi::packed_oprimitive::buffer_type buffer_type; + + /// The type used to identify a process + typedef int process_id_type; + + /// The type used to count the number of processes + typedef int process_size_type; + + /// The type of communicator used to transmit data via MPI + typedef boost::mpi::communicator communicator_type; + + /// Classification of the capabilities of this process group + struct communication_category + : virtual parallel::bsp_process_group_tag, + virtual mpi_process_group_tag { }; + + // TBD: We can eliminate the "source" field and possibly the + // "offset" field. + struct message_header { + /// The process that sent the message + process_id_type source; + + /// The message tag + int tag; + + /// The offset of the message into the buffer + std::size_t offset; + + /// The length of the message in the buffer, in bytes + std::size_t bytes; + + template + void serialize(Archive& ar, int) + { + ar & source & tag & offset & bytes; + } + }; + + /** + * Stores the outgoing messages for a particular processor. + * + * @todo Evaluate whether we should use a deque instance, which + * would reduce could reduce the cost of "sending" messages but + * increases the time spent in the synchronization step. + */ + struct outgoing_messages { + outgoing_messages() {} + ~outgoing_messages() {} + + std::vector headers; + buffer_type buffer; + + template + void serialize(Archive& ar, int) + { + ar & headers & buffer; + } + + void swap(outgoing_messages& x) + { + headers.swap(x.headers); + buffer.swap(x.buffer); + } + }; + +private: + /** + * Virtual base from which every trigger will be launched. See @c + * trigger_launcher for more information. + */ + class trigger_base : boost::noncopyable + { + public: + explicit trigger_base(int tag) : tag_(tag) { } + + /// Retrieve the tag associated with this trigger + int tag() const { return tag_; } + + virtual ~trigger_base() { } + + /** + * Invoked to receive a message that matches a particular trigger. + * + * @param source the source of the message + * @param tag the (local) tag of the message + * @param context the context under which the trigger is being + * invoked + */ + virtual void + receive(mpi_process_group const& pg, int source, int tag, + trigger_receive_context context, int block=-1) const = 0; + + protected: + // The message tag associated with this trigger + int tag_; + }; + + /** + * Launches a specific handler in response to a trigger. This + * function object wraps up the handler function object and a buffer + * for incoming data. + */ + template + class trigger_launcher : public trigger_base + { + public: + explicit trigger_launcher(mpi_process_group& self, int tag, + const Handler& handler) + : trigger_base(tag), self(self), handler(handler) + {} + + void + receive(mpi_process_group const& pg, int source, int tag, + trigger_receive_context context, int block=-1) const; + + private: + mpi_process_group& self; + mutable Handler handler; + }; + + /** + * Launches a specific handler with a message reply in response to a + * trigger. This function object wraps up the handler function + * object and a buffer for incoming data. + */ + template + class reply_trigger_launcher : public trigger_base + { + public: + explicit reply_trigger_launcher(mpi_process_group& self, int tag, + const Handler& handler) + : trigger_base(tag), self(self), handler(handler) + {} + + void + receive(mpi_process_group const& pg, int source, int tag, + trigger_receive_context context, int block=-1) const; + + private: + mpi_process_group& self; + mutable Handler handler; + }; + + template + class global_trigger_launcher : public trigger_base + { + public: + explicit global_trigger_launcher(mpi_process_group& self, int tag, + const Handler& handler) + : trigger_base(tag), handler(handler) + { + } + + void + receive(mpi_process_group const& pg, int source, int tag, + trigger_receive_context context, int block=-1) const; + + private: + mutable Handler handler; + // TBD: do not forget to cancel any outstanding Irecv when deleted, + // if we decide to use Irecv + }; + + template + class global_irecv_trigger_launcher : public trigger_base + { + public: + explicit global_irecv_trigger_launcher(mpi_process_group& self, int tag, + const Handler& handler, int sz) + : trigger_base(tag), handler(handler), buffer_size(sz) + { + prepare_receive(self,tag); + } + + void + receive(mpi_process_group const& pg, int source, int tag, + trigger_receive_context context, int block=-1) const; + + private: + void prepare_receive(mpi_process_group const& pg, int tag, bool force=false) const; + Handler handler; + int buffer_size; + // TBD: do not forget to cancel any outstanding Irecv when deleted, + // if we decide to use Irecv + }; + +public: + /** + * Construct a new BSP process group from an MPI communicator. The + * MPI communicator will be duplicated to create a new communicator + * for this process group to use. + */ + mpi_process_group(communicator_type parent_comm = communicator_type()); + + /** + * Construct a new BSP process group from an MPI communicator. The + * MPI communicator will be duplicated to create a new communicator + * for this process group to use. This constructor allows to tune the + * size of message batches. + * + * @param num_headers The maximum number of headers in a message batch + * + * @param buffer_size The maximum size of the message buffer in a batch. + * + */ + mpi_process_group( std::size_t num_headers, std::size_t buffer_size, + communicator_type parent_comm = communicator_type()); + + /** + * Construct a copy of the BSP process group for a new distributed + * data structure. This data structure will synchronize with all + * other members of the process group's equivalence class (including + * @p other), but will have its own set of tags. + * + * @param other The process group that this new process group will + * be based on, using a different set of tags within the same + * communication and synchronization space. + * + * @param handler A message handler that will be passed (source, + * tag) pairs for each message received by this data + * structure. The handler is expected to receive the messages + * immediately. The handler can be changed after-the-fact by + * calling @c replace_handler. + * + * @param out_of_band_receive An anachronism. TODO: remove this. + */ + mpi_process_group(const mpi_process_group& other, + const receiver_type& handler, + bool out_of_band_receive = false); + + /** + * Construct a copy of the BSP process group for a new distributed + * data structure. This data structure will synchronize with all + * other members of the process group's equivalence class (including + * @p other), but will have its own set of tags. + */ + mpi_process_group(const mpi_process_group& other, + attach_distributed_object, + bool out_of_band_receive = false); + + /** + * Create an "empty" process group, with no information. This is an + * internal routine that users should never need. + */ + explicit mpi_process_group(create_empty) {} + + /** + * Destroys this copy of the process group. + */ + ~mpi_process_group(); + + /** + * Replace the current message handler with a new message handler. + * + * @param handle The new message handler. + * @param out_of_band_receive An anachronism: remove this + */ + void replace_handler(const receiver_type& handler, + bool out_of_band_receive = false); + + /** + * Turns this process group into the process group for a new + * distributed data structure or object, allocating its own tag + * block. + */ + void make_distributed_object(); + + /** + * Replace the handler to be invoked at the beginning of synchronize. + */ + void + replace_on_synchronize_handler(const on_synchronize_event_type& handler = 0); + + /** + * Return the block number of the current data structure. A value of + * 0 indicates that this particular instance of the process group is + * not associated with any distributed data structure. + */ + int my_block_number() const { return block_num? *block_num : 0; } + + /** + * Encode a block number/tag pair into a single encoded tag for + * transmission. + */ + int encode_tag(int block_num, int tag) const + { return block_num * max_tags + tag; } + + /** + * Decode an encoded tag into a block number/tag pair. + */ + std::pair decode_tag(int encoded_tag) const + { return std::make_pair(encoded_tag / max_tags, encoded_tag % max_tags); } + + // @todo Actually write up the friend declarations so these could be + // private. + + // private: + + /** Allocate a block of tags for this instance. The block should not + * have been allocated already, e.g., my_block_number() == + * 0. Returns the newly-allocated block number. + */ + int allocate_block(bool out_of_band_receive = false); + + /** Potentially emit a receive event out of band. Returns true if an event + * was actually sent, false otherwise. + */ + bool maybe_emit_receive(int process, int encoded_tag) const; + + /** Emit a receive event. Returns true if an event was actually + * sent, false otherwise. + */ + bool emit_receive(int process, int encoded_tag) const; + + /** Emit an on-synchronize event to all block handlers. */ + void emit_on_synchronize() const; + + /** Retrieve a reference to the stored receiver in this block. */ + template + Receiver* get_receiver(); + + template + void + send_impl(int dest, int tag, const T& value, + mpl::true_ /*is_mpi_datatype*/) const; + + template + void + send_impl(int dest, int tag, const T& value, + mpl::false_ /*is_mpi_datatype*/) const; + + template + typename disable_if, void>::type + array_send_impl(int dest, int tag, const T values[], std::size_t n) const; + + template + bool + receive_impl(int source, int tag, T& value, + mpl::true_ /*is_mpi_datatype*/) const; + + template + bool + receive_impl(int source, int tag, T& value, + mpl::false_ /*is_mpi_datatype*/) const; + + // Receive an array of values + template + typename disable_if, bool>::type + array_receive_impl(int source, int tag, T* values, std::size_t& n) const; + + optional > probe() const; + + void synchronize() const; + + operator bool() { return impl_; } + + mpi_process_group base() const; + + /** + * Create a new trigger for a specific message tag. Triggers handle + * out-of-band messaging, and the handler itself will be called + * whenever a message is available. The handler itself accepts four + * arguments: the source of the message, the message tag (which will + * be the same as @p tag), the message data (of type @c Type), and a + * boolean flag that states whether the message was received + * out-of-band. The last will be @c true for out-of-band receives, + * or @c false for receives at the end of a synchronization step. + */ + template + void trigger(int tag, const Handler& handler); + + /** + * Create a new trigger for a specific message tag, along with a way + * to send a reply with data back to the sender. Triggers handle + * out-of-band messaging, and the handler itself will be called + * whenever a message is available. The handler itself accepts four + * arguments: the source of the message, the message tag (which will + * be the same as @p tag), the message data (of type @c Type), and a + * boolean flag that states whether the message was received + * out-of-band. The last will be @c true for out-of-band receives, + * or @c false for receives at the end of a synchronization + * step. The handler also returns a value, which will be routed back + * to the sender. + */ + template + void trigger_with_reply(int tag, const Handler& handler); + + template + void global_trigger(int tag, const Handler& handler, std::size_t buffer_size=0); + + + + /** + * Poll for any out-of-band messages. This routine will check if any + * out-of-band messages are available. Those that are available will + * be handled immediately, if possible. + * + * @returns if an out-of-band message has been received, but we are + * unable to actually receive the message, a (source, tag) pair will + * be returned. Otherwise, returns an empty optional. + * + * @param wait When true, we should block until a message comes in. + * + * @param synchronizing whether we are currently synchronizing the + * process group + */ + optional > + poll(bool wait = false, int block = -1, bool synchronizing = false) const; + + /** + * Determines the context of the trigger currently executing. If + * multiple triggers are executing (recursively), then the context + * for the most deeply nested trigger will be returned. If no + * triggers are executing, returns @c trc_none. This might be used, + * for example, to determine whether a reply to a message should + * itself be sent out-of-band or whether it can go via the normal, + * slower communication route. + */ + trigger_receive_context trigger_context() const; + + /// INTERNAL ONLY + void receive_batch(process_id_type source, outgoing_messages& batch) const; + + /// INTERNAL ONLY + /// + /// Determine the actual communicator and tag will be used for a + /// transmission with the given tag. + std::pair + actual_communicator_and_tag(int tag, int block) const; + + /// set the size of the message buffer used for buffered oob sends + + static void set_message_buffer_size(std::size_t s); + + /// get the size of the message buffer used for buffered oob sends + + static std::size_t message_buffer_size(); + static int old_buffer_size; + static void* old_buffer; +private: + + void install_trigger(int tag, int block, + shared_ptr const& launcher); + + void poll_requests(int block=-1) const; + + + // send a batch if the buffer is full now or would get full + void maybe_send_batch(process_id_type dest) const; + + // actually send a batch + void send_batch(process_id_type dest, outgoing_messages& batch) const; + void send_batch(process_id_type dest) const; + + void pack_headers() const; + + /** + * Process a batch of incoming messages immediately. + * + * @param source the source of these messages + */ + void process_batch(process_id_type source) const; + void receive_batch(boost::mpi::status& status) const; + + //void free_finished_sends() const; + + /// Status messages used internally by the process group + enum status_messages { + /// the first of the reserved message tags + msg_reserved_first = 126, + /// Sent from a processor when sending batched messages + msg_batch = 126, + /// Sent from a processor when sending large batched messages, larger than + /// the maximum buffer size for messages to be received by MPI_Irecv + msg_large_batch = 127, + /// Sent from a source processor to everyone else when that + /// processor has entered the synchronize() function. + msg_synchronizing = 128, + /// the last of the reserved message tags + msg_reserved_last = 128 + }; + + /** + * Description of a block of tags associated to a particular + * distributed data structure. This structure will live as long as + * the distributed data structure is around, and will be used to + * help send messages to the data structure. + */ + struct block_type + { + block_type() { } + + /// Handler for receive events + receiver_type on_receive; + + /// Handler executed at the start of synchronization + on_synchronize_event_type on_synchronize; + + /// Individual message triggers. Note: at present, this vector is + /// indexed by the (local) tag of the trigger. Any tags that + /// don't have triggers will have NULL pointers in that spot. + std::vector > triggers; + }; + + /** + * Data structure containing all of the blocks for the distributed + * data structures attached to a process group. + */ + typedef std::vector blocks_type; + + /// Iterator into @c blocks_type. + typedef blocks_type::iterator block_iterator; + + /** + * Deleter used to deallocate a block when its distributed data + * structure is destroyed. This type will be used as the deleter for + * @c block_num. + */ + struct deallocate_block; + + static std::vector message_buffer; + +public: + /** + * Data associated with the process group and all of its attached + * distributed data structures. + */ + shared_ptr impl_; + + /** + * When non-null, indicates that this copy of the process group is + * associated with a particular distributed data structure. The + * integer value contains the block number (a value > 0) associated + * with that data structure. The deleter for this @c shared_ptr is a + * @c deallocate_block object that will deallocate the associated + * block in @c impl_->blocks. + */ + shared_ptr block_num; + + /** + * Rank of this process, to avoid having to call rank() repeatedly. + */ + int rank; + + /** + * Number of processes in this process group, to avoid having to + * call communicator::size() repeatedly. + */ + int size; +}; + + + +inline mpi_process_group::process_id_type +process_id(const mpi_process_group& pg) +{ return pg.rank; } + +inline mpi_process_group::process_size_type +num_processes(const mpi_process_group& pg) +{ return pg.size; } + +mpi_process_group::communicator_type communicator(const mpi_process_group& pg); + +template +void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T& value); + +template +void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, InputIterator first, InputIterator last); + +template +inline void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, T* first, T* last) +{ send(pg, dest, tag, first, last - first); } + +template +inline void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T* first, const T* last) +{ send(pg, dest, tag, first, last - first); } + +template +mpi_process_group::process_id_type +receive(const mpi_process_group& pg, int tag, T& value); + +template +mpi_process_group::process_id_type +receive(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value); + +optional > +probe(const mpi_process_group& pg); + +void synchronize(const mpi_process_group& pg); + +template +T* +all_reduce(const mpi_process_group& pg, T* first, T* last, T* out, + BinaryOperation bin_op); + +template +T* +scan(const mpi_process_group& pg, T* first, T* last, T* out, + BinaryOperation bin_op); + +template +void +all_gather(const mpi_process_group& pg, + InputIterator first, InputIterator last, std::vector& out); + +template +mpi_process_group +process_subgroup(const mpi_process_group& pg, + InputIterator first, InputIterator last); + +template +void +broadcast(const mpi_process_group& pg, T& val, + mpi_process_group::process_id_type root); + + +/******************************************************************* + * Out-of-band communication * + *******************************************************************/ + +template +typename enable_if >::type +send_oob(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T& value, int block=-1) +{ + using boost::mpi::get_mpi_datatype; + + // Determine the actual message tag we will use for the send, and which + // communicator we will use. + std::pair actual + = pg.actual_communicator_and_tag(tag, block); + +#ifdef SEND_OOB_BSEND + if (mpi_process_group::message_buffer_size()) { + MPI_Bsend(const_cast(&value), 1, get_mpi_datatype(value), dest, + actual.second, actual.first); + return; + } +#endif + MPI_Request request; + MPI_Isend(const_cast(&value), 1, get_mpi_datatype(value), dest, + actual.second, actual.first, &request); + + int done=0; + do { + pg.poll(); + MPI_Test(&request,&done,MPI_STATUS_IGNORE); + } while (!done); +} + +template +typename disable_if >::type +send_oob(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T& value, int block=-1) +{ + using boost::mpi::packed_oarchive; + + // Determine the actual message tag we will use for the send, and which + // communicator we will use. + std::pair actual + = pg.actual_communicator_and_tag(tag, block); + + // Serialize the data into a buffer + packed_oarchive out(actual.first); + out << value; + std::size_t size = out.size(); + + // Send the actual message data +#ifdef SEND_OOB_BSEND + if (mpi_process_group::message_buffer_size()) { + MPI_Bsend(const_cast(out.address()), size, MPI_PACKED, + dest, actual.second, actual.first); + return; + } +#endif + MPI_Request request; + MPI_Isend(const_cast(out.address()), size, MPI_PACKED, + dest, actual.second, actual.first, &request); + + int done=0; + do { + pg.poll(); + MPI_Test(&request,&done,MPI_STATUS_IGNORE); + } while (!done); +} + +template +typename enable_if >::type +receive_oob(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value, int block=-1); + +template +typename disable_if >::type +receive_oob(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value, int block=-1); + +template +typename enable_if >::type +send_oob_with_reply(const mpi_process_group& pg, + mpi_process_group::process_id_type dest, + int tag, const SendT& send_value, ReplyT& reply_value, + int block = -1); + +template +typename disable_if >::type +send_oob_with_reply(const mpi_process_group& pg, + mpi_process_group::process_id_type dest, + int tag, const SendT& send_value, ReplyT& reply_value, + int block = -1); + +} } } // end namespace boost::graph::distributed + +BOOST_IS_BITWISE_SERIALIZABLE(boost::graph::distributed::mpi_process_group::message_header) +namespace boost { namespace mpi { + template<> + struct is_mpi_datatype : mpl::true_ { }; +} } // end namespace boost::mpi + +namespace std { +/// optimized swap for outgoing messages +inline void +swap(boost::graph::distributed::mpi_process_group::outgoing_messages& x, + boost::graph::distributed::mpi_process_group::outgoing_messages& y) +{ + x.swap(y); +} + + +} + +BOOST_CLASS_IMPLEMENTATION(boost::graph::distributed::mpi_process_group::outgoing_messages,object_serializable) +BOOST_CLASS_TRACKING(boost::graph::distributed::mpi_process_group::outgoing_messages,track_never) + +#include + +#endif // BOOST_PARALLEL_MPI_MPI_PROCESS_GROUP_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/named_graph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/named_graph.hpp new file mode 100644 index 0000000000..83b00613b6 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/named_graph.hpp @@ -0,0 +1,1239 @@ +// Copyright (C) 2007 Douglas Gregor +// Copyright (C) 2007 Hartmut Kaiser + +// 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) + +// TODO: +// - Cache (some) remote vertex names? +#ifndef BOOST_GRAPH_DISTRIBUTED_NAMED_GRAPH_HPP +#define BOOST_GRAPH_DISTRIBUTED_NAMED_GRAPH_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace graph { namespace distributed { + +using boost::parallel::trigger_receive_context; +using boost::detail::parallel::pair_with_property; + +/******************************************************************* + * Hashed distribution of named entities * + *******************************************************************/ + +template +struct hashed_distribution +{ + template + hashed_distribution(const ProcessGroup& pg, std::size_t /*num_vertices*/ = 0) + : n(num_processes(pg)) { } + + int operator()(const T& value) const + { + return hasher(value) % n; + } + + std::size_t n; + hash hasher; +}; + +/// Specialization for named graphs +template ::type> +struct select_distribution +{ +private: + /// The type used to name vertices in the graph + typedef typename remove_cv< + typename remove_reference< + typename ExtractName::result_type>::type>::type + vertex_name_type; + +public: + /** + * The @c type field provides a distribution object that maps + * vertex names to processors. The distribution object will be + * constructed with the process group over which communication will + * occur. The distribution object shall also be a function + * object mapping from the type of the name to a processor number + * in @c [0, @c p) (for @c p processors). By default, the mapping + * function uses the @c boost::hash value of the name, modulo @c p. + */ + typedef typename mpl::if_, + hashed_distribution, + InDistribution>::type + type; + + /// for named graphs the default type is the same as the stored distribution + /// type + typedef type default_type; +}; + +/// Specialization for non-named graphs +template +struct select_distribution +{ + /// the distribution type stored in the graph for non-named graphs should be + /// the variant_distribution type + typedef typename mpl::if_, + boost::parallel::variant_distribution, + InDistribution>::type type; + + /// default_type is used as the distribution functor for the + /// adjacency_list, it should be parallel::block by default + typedef typename mpl::if_, + boost::parallel::block, type>::type + default_type; +}; + + +/******************************************************************* + * Named graph mixin * + *******************************************************************/ + +/** + * named_graph is a mixin that provides names for the vertices of a + * graph, including a mapping from names to vertices. Graph types that + * may or may not be have vertex names (depending on the properties + * supplied by the user) should use maybe_named_graph. + * + * Template parameters: + * + * Graph: the graph type that derives from named_graph + * + * Vertex: the type of a vertex descriptor in Graph. Note: we cannot + * use graph_traits here, because the Graph is not yet defined. + * + * VertexProperty: the type of the property stored along with the + * vertex. + * + * ProcessGroup: the process group over which the distributed name + * graph mixin will communicate. + */ +template +class named_graph +{ +public: + /// Messages passed within the distributed named graph + enum message_kind { + /** + * Requests the addition of a vertex on a remote processor. The + * message data is a @c vertex_name_type. + */ + msg_add_vertex_name, + + /** + * Requests the addition of a vertex on a remote processor. The + * message data is a @c vertex_name_type. The remote processor + * will send back a @c msg_add_vertex_name_reply message + * containing the vertex descriptor. + */ + msg_add_vertex_name_with_reply, + + /** + * Requests the vertex descriptor corresponding to the given + * vertex name. The remote process will reply with a + * @c msg_find_vertex_reply message containing the answer. + */ + msg_find_vertex, + + /** + * Requests the addition of an edge on a remote processor. The + * data stored in these messages is a @c pair@, + * where @c source and @c target may be either names (of type @c + * vertex_name_type) or vertex descriptors, depending on what + * information we have locally. + */ + msg_add_edge_name_name, + msg_add_edge_vertex_name, + msg_add_edge_name_vertex, + + /** + * These messages are identical to msg_add_edge_*_*, except that + * the process actually adding the edge will send back a @c + * pair + */ + msg_add_edge_name_name_with_reply, + msg_add_edge_vertex_name_with_reply, + msg_add_edge_name_vertex_with_reply, + + /** + * Requests the addition of an edge with a property on a remote + * processor. The data stored in these messages is a @c + * pair>@, where @c + * source and @c target may be either names (of type @c + * vertex_name_type) or vertex descriptors, depending on what + * information we have locally. + */ + msg_add_edge_name_name_with_property, + msg_add_edge_vertex_name_with_property, + msg_add_edge_name_vertex_with_property, + + /** + * These messages are identical to msg_add_edge_*_*_with_property, + * except that the process actually adding the edge will send back + * a @c pair. + */ + msg_add_edge_name_name_with_reply_and_property, + msg_add_edge_vertex_name_with_reply_and_property, + msg_add_edge_name_vertex_with_reply_and_property + }; + + /// The vertex descriptor type + typedef Vertex vertex_descriptor; + + /// The edge descriptor type + typedef Edge edge_descriptor; + + /// The vertex property type + typedef typename Config::vertex_property_type vertex_property_type; + + /// The vertex property type + typedef typename Config::edge_property_type edge_property_type; + + /// The type used to extract names from the property structure + typedef typename internal_vertex_name::type + extract_name_type; + + /// The type used to name vertices in the graph + typedef typename remove_cv< + typename remove_reference< + typename extract_name_type::result_type>::type>::type + vertex_name_type; + + /// The type used to distribute named vertices in the graph + typedef typename Config::distribution_type distribution_type; + typedef typename Config::base_distribution_type base_distribution_type; + + /// The type used for communication in the distributed structure + typedef typename Config::process_group_type process_group_type; + + /// Type used to identify processes + typedef typename process_group_type::process_id_type process_id_type; + + /// a reference to this class, which is used for disambiguation of the + // add_vertex function + typedef named_graph named_graph_type; + + /// Structure returned when adding a vertex by vertex name + struct lazy_add_vertex; + friend struct lazy_add_vertex; + + /// Structure returned when adding an edge by vertex name + struct lazy_add_edge; + friend struct lazy_add_edge; + + /// Structure returned when adding an edge by vertex name with a property + struct lazy_add_edge_with_property; + friend struct lazy_add_edge_with_property; + + explicit named_graph(const process_group_type& pg); + + named_graph(const process_group_type& pg, const base_distribution_type& distribution); + + /// Set up triggers, but only for the BSP process group + void setup_triggers(); + + /// Retrieve the derived instance + Graph& derived() { return static_cast(*this); } + const Graph& derived() const { return static_cast(*this); } + + /// Retrieve the process group + process_group_type& process_group() { return process_group_; } + const process_group_type& process_group() const { return process_group_; } + + // Retrieve the named distribution + distribution_type& named_distribution() { return distribution_; } + const distribution_type& named_distribution() const { return distribution_; } + + /// Notify the named_graph that we have added the given vertex. This + /// is a no-op. + void added_vertex(Vertex) { } + + /// Notify the named_graph that we are removing the given + /// vertex. This is a no-op. + void removing_vertex(Vertex) { } + + /// Notify the named_graph that we are clearing the graph + void clearing_graph() { } + + /// Retrieve the owner of a given vertex based on the properties + /// associated with that vertex. This operation just returns the + /// number of the local processor, adding all vertices locally. + process_id_type owner_by_property(const vertex_property_type&); + +protected: + void + handle_add_vertex_name(int source, int tag, const vertex_name_type& msg, + trigger_receive_context); + + vertex_descriptor + handle_add_vertex_name_with_reply(int source, int tag, + const vertex_name_type& msg, + trigger_receive_context); + + boost::parallel::detail::untracked_pair + handle_find_vertex(int source, int tag, const vertex_name_type& msg, + trigger_receive_context); + + template + void handle_add_edge(int source, int tag, const boost::parallel::detail::untracked_pair& msg, + trigger_receive_context); + + template + boost::parallel::detail::untracked_pair + handle_add_edge_with_reply(int source, int tag, const boost::parallel::detail::untracked_pair& msg, + trigger_receive_context); + + template + void + handle_add_edge_with_property + (int source, int tag, + const pair_with_property& msg, + trigger_receive_context); + + template + boost::parallel::detail::untracked_pair + handle_add_edge_with_reply_and_property + (int source, int tag, + const pair_with_property& msg, + trigger_receive_context); + + /// The process group for this distributed data structure + process_group_type process_group_; + + /// The distribution we will use to map names to processors + distribution_type distribution_; +}; + +/// Helper macro containing the template parameters of named_graph +#define BGL_NAMED_GRAPH_PARAMS \ + typename Graph, typename Vertex, typename Edge, typename Config +/// Helper macro containing the named_graph<...> instantiation +#define BGL_NAMED_GRAPH \ + named_graph + +/** + * Data structure returned from add_vertex that will "lazily" add the + * vertex, either when it is converted to a @c vertex_descriptor or + * when the most recent copy has been destroyed. + */ +template +struct BGL_NAMED_GRAPH::lazy_add_vertex +{ + /// Construct a new lazyily-added vertex + lazy_add_vertex(named_graph& self, const vertex_name_type& name) + : self(self), name(name), committed(false) { } + + /// Transfer responsibility for adding the vertex from the source of + /// the copy to the newly-constructed opbject. + lazy_add_vertex(const lazy_add_vertex& other) + : self(self), name(other.name), committed(other.committed) + { + other.committed = true; + } + + /// If the vertex has not been added yet, add it + ~lazy_add_vertex(); + + /// Add the vertex and return its descriptor. This conversion can + /// only occur once, and only when this object is responsible for + /// creating the vertex. + operator vertex_descriptor() const { return commit(); } + + /// Add the vertex and return its descriptor. This can only be + /// called once, and only when this object is responsible for + /// creating the vertex. + vertex_descriptor commit() const; + +protected: + named_graph& self; + vertex_name_type name; + mutable bool committed; +}; + +template +BGL_NAMED_GRAPH::lazy_add_vertex::~lazy_add_vertex() +{ + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + + /// If this vertex has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the vertex now. + if (committed || std::uncaught_exception()) + return; + + committed = true; + + process_id_type owner = self.named_distribution()(name); + if (owner == process_id(self.process_group())) + /// Add the vertex locally + add_vertex(self.derived().base().vertex_constructor(name), self.derived()); + else + /// Ask the owner of the vertex to add a vertex with this name + send(self.process_group(), owner, msg_add_vertex_name, name); +} + +template +typename BGL_NAMED_GRAPH::vertex_descriptor +BGL_NAMED_GRAPH::lazy_add_vertex::commit() const +{ + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + assert (!committed); + committed = true; + + process_id_type owner = self.named_distribution()(name); + if (owner == process_id(self.process_group())) + /// Add the vertex locally + return add_vertex(self.derived().base().vertex_constructor(name), + self.derived()); + else { + /// Ask the owner of the vertex to add a vertex with this name + vertex_descriptor result; + send_oob_with_reply(self.process_group(), owner, + msg_add_vertex_name_with_reply, name, result); + return result; + } +} + +/** + * Data structure returned from add_edge that will "lazily" add the + * edge, either when it is converted to a @c + * pair or when the most recent copy has been + * destroyed. + */ +template +struct BGL_NAMED_GRAPH::lazy_add_edge +{ + /// The graph's edge descriptor + typedef typename graph_traits::edge_descriptor edge_descriptor; + + /// Add an edge for the edge (u, v) based on vertex names + lazy_add_edge(BGL_NAMED_GRAPH& self, + const vertex_name_type& u_name, + const vertex_name_type& v_name) + : self(self), u(u_name), v(v_name), committed(false) { } + + /// Add an edge for the edge (u, v) based on a vertex descriptor and name + lazy_add_edge(BGL_NAMED_GRAPH& self, + vertex_descriptor u, + const vertex_name_type& v_name) + : self(self), u(u), v(v_name), committed(false) { } + + /// Add an edge for the edge (u, v) based on a vertex name and descriptor + lazy_add_edge(BGL_NAMED_GRAPH& self, + const vertex_name_type& u_name, + vertex_descriptor v) + : self(self), u(u_name), v(v), committed(false) { } + + /// Add an edge for the edge (u, v) based on vertex descriptors + lazy_add_edge(BGL_NAMED_GRAPH& self, + vertex_descriptor u, + vertex_descriptor v) + : self(self), u(u), v(v), committed(false) { } + + /// Copy a lazy_add_edge structure, which transfers responsibility + /// for adding the edge to the newly-constructed object. + lazy_add_edge(const lazy_add_edge& other) + : self(other.self), u(other.u), v(other.v), committed(other.committed) + { + other.committed = true; + } + + /// If the edge has not yet been added, add the edge but don't wait + /// for a reply. + ~lazy_add_edge(); + + /// Returns commit(). + operator std::pair() const { return commit(); } + + // Add the edge. This operation will block if a remote edge is + // being added. + std::pair commit() const; + +protected: + BGL_NAMED_GRAPH& self; + mutable variant u; + mutable variant v; + mutable bool committed; + +private: + // No copy-assignment semantics + void operator=(lazy_add_edge&); +}; + +template +BGL_NAMED_GRAPH::lazy_add_edge::~lazy_add_edge() +{ + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + + using boost::parallel::detail::make_untracked_pair; + + /// If this edge has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the edge now. + if (committed || std::uncaught_exception()) + return; + + committed = true; + + if (vertex_name_type* v_name = boost::get(&v)) { + // We haven't resolved the target vertex to a descriptor yet, so + // it must not be local. Send a message to the owner of the target + // of the edge. If the owner of the target does not happen to own + // the source, it will resolve the target to a vertex descriptor + // and pass the message along to the owner of the source. + if (vertex_name_type* u_name = boost::get(&u)) + send(self.process_group(), self.distribution_(*v_name), + BGL_NAMED_GRAPH::msg_add_edge_name_name, + make_untracked_pair(*u_name, *v_name)); + else + send(self.process_group(), self.distribution_(*v_name), + BGL_NAMED_GRAPH::msg_add_edge_vertex_name, + make_untracked_pair(boost::get(u), *v_name)); + } else { + if (vertex_name_type* u_name = boost::get(&u)) + // We haven't resolved the source vertex to a descriptor yet, so + // it must not be local. Send a message to the owner of the + // source vertex requesting the edge addition. + send(self.process_group(), self.distribution_(*u_name), + BGL_NAMED_GRAPH::msg_add_edge_name_vertex, + make_untracked_pair(*u_name, boost::get(v))); + else + // We have descriptors for both of the vertices, either of which + // may be remote or local. Tell the owner of the source vertex + // to add the edge (it may be us!). + add_edge(boost::get(u), + boost::get(v), + self.derived()); + } +} + +template +std::pair::edge_descriptor, bool> +BGL_NAMED_GRAPH::lazy_add_edge::commit() const +{ + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + using boost::parallel::detail::make_untracked_pair; + + assert(!committed); + committed = true; + + /// The result we will return, if we are sending a message to + /// request that someone else add the edge. + boost::parallel::detail::untracked_pair result; + + /// The owner of the vertex "u" + process_id_type u_owner; + + process_id_type rank = process_id(self.process_group()); + if (const vertex_name_type* u_name = boost::get(&u)) { + /// We haven't resolved the source vertex to a descriptor yet, so + /// it must not be local. + u_owner = self.named_distribution()(*u_name); + + /// Send a message to the remote vertex requesting that it add the + /// edge. The message differs depending on whether we have a + /// vertex name or a vertex descriptor for the target. + if (const vertex_name_type* v_name = boost::get(&v)) + send_oob_with_reply(self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_name_name_with_reply, + make_untracked_pair(*u_name, *v_name), result); + else + send_oob_with_reply(self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_name_vertex_with_reply, + make_untracked_pair(*u_name, + boost::get(v)), + result); + } else { + /// We have resolved the source vertex to a descriptor, which may + /// either be local or remote. + u_owner + = get(vertex_owner, self.derived(), + boost::get(u)); + if (u_owner == rank) { + /// The source is local. If we need to, resolve the target vertex. + if (const vertex_name_type* v_name = boost::get(&v)) + v = add_vertex(*v_name, self.derived()); + + /// Add the edge using vertex descriptors + return add_edge(boost::get(u), + boost::get(v), + self.derived()); + } else { + /// The source is remote. Just send a message to its owner + /// requesting that the owner add the new edge, either directly + /// or via the derived class's add_edge function. + if (const vertex_name_type* v_name = boost::get(&v)) + send_oob_with_reply + (self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_vertex_name_with_reply, + make_untracked_pair(boost::get(u), *v_name), + result); + else + return add_edge(boost::get(u), + boost::get(v), + self.derived()); + } + } + + // If we get here, the edge has been added remotely and "result" + // contains the result of that edge addition. + return result; +} + +/** + * Data structure returned from add_edge that will "lazily" add the + * edge with a property, either when it is converted to a @c + * pair or when the most recent copy has been + * destroyed. + */ +template +struct BGL_NAMED_GRAPH::lazy_add_edge_with_property +{ + /// The graph's edge descriptor + typedef typename graph_traits::edge_descriptor edge_descriptor; + + /// The Edge property type for our graph + typedef typename Config::edge_property_type edge_property_type; + + /// Add an edge for the edge (u, v) based on vertex names + lazy_add_edge_with_property(BGL_NAMED_GRAPH& self, + const vertex_name_type& u_name, + const vertex_name_type& v_name, + const edge_property_type& property) + : self(self), u(u_name), v(v_name), property(property), committed(false) + { + } + + /// Add an edge for the edge (u, v) based on a vertex descriptor and name + lazy_add_edge_with_property(BGL_NAMED_GRAPH& self, + vertex_descriptor u, + const vertex_name_type& v_name, + const edge_property_type& property) + : self(self), u(u), v(v_name), property(property), committed(false) { } + + /// Add an edge for the edge (u, v) based on a vertex name and descriptor + lazy_add_edge_with_property(BGL_NAMED_GRAPH& self, + const vertex_name_type& u_name, + vertex_descriptor v, + const edge_property_type& property) + : self(self), u(u_name), v(v), property(property), committed(false) { } + + /// Add an edge for the edge (u, v) based on vertex descriptors + lazy_add_edge_with_property(BGL_NAMED_GRAPH& self, + vertex_descriptor u, + vertex_descriptor v, + const edge_property_type& property) + : self(self), u(u), v(v), property(property), committed(false) { } + + /// Copy a lazy_add_edge_with_property structure, which transfers + /// responsibility for adding the edge to the newly-constructed + /// object. + lazy_add_edge_with_property(const lazy_add_edge_with_property& other) + : self(other.self), u(other.u), v(other.v), property(other.property), + committed(other.committed) + { + other.committed = true; + } + + /// If the edge has not yet been added, add the edge but don't wait + /// for a reply. + ~lazy_add_edge_with_property(); + + /// Returns commit(). + operator std::pair() const { return commit(); } + + // Add the edge. This operation will block if a remote edge is + // being added. + std::pair commit() const; + +protected: + BGL_NAMED_GRAPH& self; + mutable variant u; + mutable variant v; + edge_property_type property; + mutable bool committed; + +private: + // No copy-assignment semantics + void operator=(lazy_add_edge_with_property&); +}; + +template +BGL_NAMED_GRAPH::lazy_add_edge_with_property::~lazy_add_edge_with_property() +{ + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + using boost::detail::parallel::make_pair_with_property; + + /// If this edge has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the edge now. + if (committed || std::uncaught_exception()) + return; + + committed = true; + + if (vertex_name_type* v_name = boost::get(&v)) { + // We haven't resolved the target vertex to a descriptor yet, so + // it must not be local. Send a message to the owner of the target + // of the edge. If the owner of the target does not happen to own + // the source, it will resolve the target to a vertex descriptor + // and pass the message along to the owner of the source. + if (vertex_name_type* u_name = boost::get(&u)) + send(self.process_group(), self.distribution_(*v_name), + BGL_NAMED_GRAPH::msg_add_edge_name_name_with_property, + make_pair_with_property(*u_name, *v_name, property)); + else + send(self.process_group(), self.distribution_(*v_name), + BGL_NAMED_GRAPH::msg_add_edge_vertex_name_with_property, + make_pair_with_property(boost::get(u), *v_name, + property)); + } else { + if (vertex_name_type* u_name = boost::get(&u)) + // We haven't resolved the source vertex to a descriptor yet, so + // it must not be local. Send a message to the owner of the + // source vertex requesting the edge addition. + send(self.process_group(), self.distribution_(*u_name), + BGL_NAMED_GRAPH::msg_add_edge_name_vertex_with_property, + make_pair_with_property(*u_name, boost::get(v), + property)); + else + // We have descriptors for both of the vertices, either of which + // may be remote or local. Tell the owner of the source vertex + // to add the edge (it may be us!). + add_edge(boost::get(u), + boost::get(v), + property, + self.derived()); + } +} + +template +std::pair::edge_descriptor, bool> +BGL_NAMED_GRAPH::lazy_add_edge_with_property::commit() const +{ + using boost::detail::parallel::make_pair_with_property; + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + assert(!committed); + committed = true; + + /// The result we will return, if we are sending a message to + /// request that someone else add the edge. + boost::parallel::detail::untracked_pair result; + + /// The owner of the vertex "u" + process_id_type u_owner; + + process_id_type rank = process_id(self.process_group()); + if (const vertex_name_type* u_name = boost::get(&u)) { + /// We haven't resolved the source vertex to a descriptor yet, so + /// it must not be local. + u_owner = self.named_distribution()(*u_name); + + /// Send a message to the remote vertex requesting that it add the + /// edge. The message differs depending on whether we have a + /// vertex name or a vertex descriptor for the target. + if (const vertex_name_type* v_name = boost::get(&v)) + send_oob_with_reply + (self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_name_name_with_reply_and_property, + make_pair_with_property(*u_name, *v_name, property), + result); + else + send_oob_with_reply + (self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_name_vertex_with_reply_and_property, + make_pair_with_property(*u_name, + boost::get(v), + property), + result); + } else { + /// We have resolved the source vertex to a descriptor, which may + /// either be local or remote. + u_owner + = get(vertex_owner, self.derived(), + boost::get(u)); + if (u_owner == rank) { + /// The source is local. If we need to, resolve the target vertex. + if (const vertex_name_type* v_name = boost::get(&v)) + v = add_vertex(*v_name, self.derived()); + + /// Add the edge using vertex descriptors + return add_edge(boost::get(u), + boost::get(v), + property, + self.derived()); + } else { + /// The source is remote. Just send a message to its owner + /// requesting that the owner add the new edge, either directly + /// or via the derived class's add_edge function. + if (const vertex_name_type* v_name = boost::get(&v)) + send_oob_with_reply + (self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_vertex_name_with_reply_and_property, + make_pair_with_property(boost::get(u), *v_name, + property), + result); + else + return add_edge(boost::get(u), + boost::get(v), + property, + self.derived()); + } + } + + // If we get here, the edge has been added remotely and "result" + // contains the result of that edge addition. + return result; +} + +/// Construct the named_graph with a particular process group +template +BGL_NAMED_GRAPH::named_graph(const process_group_type& pg) + : process_group_(pg, parallel::attach_distributed_object()), + distribution_(pg) +{ + setup_triggers(); +} + +/// Construct the named_graph mixin with a particular process group +/// and distribution function +template +BGL_NAMED_GRAPH::named_graph(const process_group_type& pg, + const base_distribution_type& distribution) + : process_group_(pg, parallel::attach_distributed_object()), + distribution_(pg, distribution) +{ + setup_triggers(); +} + +template +void +BGL_NAMED_GRAPH::setup_triggers() +{ + using boost::graph::parallel::simple_trigger; + + simple_trigger(process_group_, msg_add_vertex_name, this, + &named_graph::handle_add_vertex_name); + simple_trigger(process_group_, msg_add_vertex_name_with_reply, this, + &named_graph::handle_add_vertex_name_with_reply); + simple_trigger(process_group_, msg_find_vertex, this, + &named_graph::handle_find_vertex); + simple_trigger(process_group_, msg_add_edge_name_name, this, + &named_graph::template handle_add_edge); + simple_trigger(process_group_, msg_add_edge_name_name_with_reply, this, + &named_graph::template handle_add_edge_with_reply + ); + simple_trigger(process_group_, msg_add_edge_name_vertex, this, + &named_graph::template handle_add_edge); + simple_trigger(process_group_, msg_add_edge_name_vertex_with_reply, this, + &named_graph::template handle_add_edge_with_reply + ); + simple_trigger(process_group_, msg_add_edge_vertex_name, this, + &named_graph::template handle_add_edge); + simple_trigger(process_group_, msg_add_edge_vertex_name_with_reply, this, + &named_graph::template handle_add_edge_with_reply + ); + simple_trigger(process_group_, msg_add_edge_name_name_with_property, this, + &named_graph:: + template handle_add_edge_with_property); + simple_trigger(process_group_, + msg_add_edge_name_name_with_reply_and_property, this, + &named_graph::template handle_add_edge_with_reply_and_property + ); + simple_trigger(process_group_, msg_add_edge_name_vertex_with_property, this, + &named_graph:: + template handle_add_edge_with_property); + simple_trigger(process_group_, + msg_add_edge_name_vertex_with_reply_and_property, this, + &named_graph::template handle_add_edge_with_reply_and_property + ); + simple_trigger(process_group_, msg_add_edge_vertex_name_with_property, this, + &named_graph:: + template handle_add_edge_with_property); + simple_trigger(process_group_, + msg_add_edge_vertex_name_with_reply_and_property, this, + &named_graph::template handle_add_edge_with_reply_and_property + ); +} + +/// Retrieve the vertex associated with the given name +template +optional +find_vertex(typename BGL_NAMED_GRAPH::vertex_name_type const& name, + const BGL_NAMED_GRAPH& g) +{ + typedef typename Graph::local_vertex_descriptor local_vertex_descriptor; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + // Determine the owner of this name + typename BGL_NAMED_GRAPH::process_id_type owner + = g.named_distribution()(name); + + if (owner == process_id(g.process_group())) { + // The vertex is local, so search for a mapping here + optional result + = find_vertex(name, g.derived().base()); + if (result) + return Vertex(owner, *result); + else + return optional(); + } + else { + // Ask the ownering process for the name of this vertex + boost::parallel::detail::untracked_pair result; + send_oob_with_reply(g.process_group(), owner, + BGL_NAMED_GRAPH::msg_find_vertex, name, result); + if (result.second) + return result.first; + else + return optional(); + } +} + +/// meta-function helping in figuring out if the given VertextProerty belongs to +/// a named graph +template +struct not_is_named_graph + : is_same::type, void> +{}; + +/// Retrieve the vertex associated with the given name +template +typename Graph::named_graph_type::lazy_add_vertex +add_vertex(typename Graph::vertex_name_type const& name, + Graph& g, + typename disable_if< + not_is_named_graph, + void*>::type = 0) +{ + return typename Graph::named_graph_type::lazy_add_vertex(g, name); +} + +/// Add an edge using vertex names to refer to the vertices +template +typename BGL_NAMED_GRAPH::lazy_add_edge +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + BGL_NAMED_GRAPH& g) +{ + typedef typename BGL_NAMED_GRAPH::lazy_add_edge lazy_add_edge; + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + + process_id_type rank = process_id(g.process_group()); + process_id_type u_owner = g.named_distribution()(u_name); + process_id_type v_owner = g.named_distribution()(v_name); + + // Resolve local vertex names before building the "lazy" edge + // addition structure. + if (u_owner == rank && v_owner == rank) + return lazy_add_edge(g, add_vertex(u_name, g), add_vertex(v_name, g)); + else if (u_owner == rank && v_owner != rank) + return lazy_add_edge(g, add_vertex(u_name, g), v_name); + else if (u_owner != rank && v_owner == rank) + return lazy_add_edge(g, u_name, add_vertex(v_name, g)); + else + return lazy_add_edge(g, u_name, v_name); +} + +template +typename BGL_NAMED_GRAPH::lazy_add_edge +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_descriptor const& v, + BGL_NAMED_GRAPH& g) +{ + // Resolve local vertex names before building the "lazy" edge + // addition structure. + typedef typename BGL_NAMED_GRAPH::lazy_add_edge lazy_add_edge; + if (g.named_distribution()(u_name) == process_id(g.process_group())) + return lazy_add_edge(g, add_vertex(u_name, g), v); + else + return lazy_add_edge(g, u_name, v); +} + +template +typename BGL_NAMED_GRAPH::lazy_add_edge +add_edge(typename BGL_NAMED_GRAPH::vertex_descriptor const& u, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + BGL_NAMED_GRAPH& g) +{ + // Resolve local vertex names before building the "lazy" edge + // addition structure. + typedef typename BGL_NAMED_GRAPH::lazy_add_edge lazy_add_edge; + if (g.named_distribution()(v_name) == process_id(g.process_group())) + return lazy_add_edge(g, u, add_vertex(v_name, g)); + else + return lazy_add_edge(g, u, v_name); +} + +/// Add an edge using vertex names to refer to the vertices +template +typename BGL_NAMED_GRAPH::lazy_add_edge_with_property +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + typename Graph::edge_property_type const& property, + BGL_NAMED_GRAPH& g) +{ + typedef typename BGL_NAMED_GRAPH::lazy_add_edge_with_property lazy_add_edge; + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + + process_id_type rank = process_id(g.process_group()); + process_id_type u_owner = g.named_distribution()(u_name); + process_id_type v_owner = g.named_distribution()(v_name); + + // Resolve local vertex names before building the "lazy" edge + // addition structure. + if (u_owner == rank && v_owner == rank) + return lazy_add_edge(g, add_vertex(u_name, g), add_vertex(v_name, g), + property); + else if (u_owner == rank && v_owner != rank) + return lazy_add_edge(g, add_vertex(u_name, g), v_name, property); + else if (u_owner != rank && v_owner == rank) + return lazy_add_edge(g, u_name, add_vertex(v_name, g), property); + else + return lazy_add_edge(g, u_name, v_name, property); +} + +template +typename BGL_NAMED_GRAPH::lazy_add_edge_with_property +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_descriptor const& v, + typename Graph::edge_property_type const& property, + BGL_NAMED_GRAPH& g) +{ + // Resolve local vertex names before building the "lazy" edge + // addition structure. + typedef typename BGL_NAMED_GRAPH::lazy_add_edge_with_property lazy_add_edge; + if (g.named_distribution()(u_name) == process_id(g.process_group())) + return lazy_add_edge(g, add_vertex(u_name, g), v, property); + else + return lazy_add_edge(g, u_name, v, property); +} + +template +typename BGL_NAMED_GRAPH::lazy_add_edge_with_property +add_edge(typename BGL_NAMED_GRAPH::vertex_descriptor const& u, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + typename Graph::edge_property_type const& property, + BGL_NAMED_GRAPH& g) +{ + // Resolve local vertex names before building the "lazy" edge + // addition structure. + typedef typename BGL_NAMED_GRAPH::lazy_add_edge_with_property lazy_add_edge; + if (g.named_distribution()(v_name) == process_id(g.process_group())) + return lazy_add_edge(g, u, add_vertex(v_name, g), property); + else + return lazy_add_edge(g, u, v_name, property); +} + +template +typename BGL_NAMED_GRAPH::process_id_type +BGL_NAMED_GRAPH::owner_by_property(const vertex_property_type& property) +{ + return distribution_(derived().base().extract_name(property)); +} + + +/******************************************************************* + * Message handlers * + *******************************************************************/ + +template +void +BGL_NAMED_GRAPH:: +handle_add_vertex_name(int /*source*/, int /*tag*/, + const vertex_name_type& msg, trigger_receive_context) +{ + add_vertex(msg, derived()); +} + +template +typename BGL_NAMED_GRAPH::vertex_descriptor +BGL_NAMED_GRAPH:: +handle_add_vertex_name_with_reply(int source, int /*tag*/, + const vertex_name_type& msg, + trigger_receive_context) +{ + return add_vertex(msg, derived()); +} + +template +boost::parallel::detail::untracked_pair +BGL_NAMED_GRAPH:: +handle_find_vertex(int source, int /*tag*/, const vertex_name_type& msg, + trigger_receive_context) +{ + using boost::parallel::detail::make_untracked_pair; + + optional v = find_vertex(msg, derived()); + if (v) + return make_untracked_pair(*v, true); + else + return make_untracked_pair(graph_traits::null_vertex(), false); +} + +template +template +void +BGL_NAMED_GRAPH:: +handle_add_edge(int source, int /*tag*/, const boost::parallel::detail::untracked_pair& msg, + trigger_receive_context) +{ + add_edge(msg.first, msg.second, derived()); +} + +template +template +boost::parallel::detail::untracked_pair +BGL_NAMED_GRAPH:: +handle_add_edge_with_reply(int source, int /*tag*/, const boost::parallel::detail::untracked_pair& msg, + trigger_receive_context) +{ + std::pair p = + add_edge(msg.first, msg.second, derived()); + return p; +} + +template +template +void +BGL_NAMED_GRAPH:: +handle_add_edge_with_property + (int source, int tag, + const pair_with_property& msg, + trigger_receive_context) +{ + add_edge(msg.first, msg.second, msg.get_property(), derived()); +} + +template +template +boost::parallel::detail::untracked_pair +BGL_NAMED_GRAPH:: +handle_add_edge_with_reply_and_property + (int source, int tag, + const pair_with_property& msg, + trigger_receive_context) +{ + std:: pair p = + add_edge(msg.first, msg.second, msg.get_property(), derived()); + return p; +} + +#undef BGL_NAMED_GRAPH +#undef BGL_NAMED_GRAPH_PARAMS + +/******************************************************************* + * Maybe named graph mixin * + *******************************************************************/ + +/** + * A graph mixin that can provide a mapping from names to vertices, + * and use that mapping to simplify creation and manipulation of + * graphs. + */ +template::type> +struct maybe_named_graph + : public named_graph +{ +private: + typedef named_graph inherited; + typedef typename Config::process_group_type process_group_type; + +public: + /// The type used to distribute named vertices in the graph + typedef typename Config::distribution_type distribution_type; + typedef typename Config::base_distribution_type base_distribution_type; + + explicit maybe_named_graph(const process_group_type& pg) : inherited(pg) { } + + maybe_named_graph(const process_group_type& pg, + const base_distribution_type& distribution) + : inherited(pg, distribution) { } + + distribution_type& distribution() { return this->distribution_; } + const distribution_type& distribution() const { return this->distribution_; } +}; + +/** + * A graph mixin that can provide a mapping from names to vertices, + * and use that mapping to simplify creation and manipulation of + * graphs. This partial specialization turns off this functionality + * when the @c VertexProperty does not have an internal vertex name. + */ +template +struct maybe_named_graph +{ +private: + typedef typename Config::process_group_type process_group_type; + typedef typename Config::vertex_property_type vertex_property_type; + +public: + typedef typename process_group_type::process_id_type process_id_type; + + /// The type used to distribute named vertices in the graph + typedef typename Config::distribution_type distribution_type; + typedef typename Config::base_distribution_type base_distribution_type; + + explicit maybe_named_graph(const process_group_type&) { } + + maybe_named_graph(const process_group_type& pg, + const base_distribution_type& distribution) + : distribution_(pg, distribution) { } + + /// Notify the named_graph that we have added the given vertex. This + /// is a no-op. + void added_vertex(Vertex) { } + + /// Notify the named_graph that we are removing the given + /// vertex. This is a no-op. + void removing_vertex(Vertex) { } + + /// Notify the named_graph that we are clearing the graph + void clearing_graph() { } + + /// Retrieve the owner of a given vertex based on the properties + /// associated with that vertex. This operation just returns the + /// number of the local processor, adding all vertices locally. + process_id_type owner_by_property(const vertex_property_type&) + { + return process_id(pg); + } + + distribution_type& distribution() { return distribution_; } + const distribution_type& distribution() const { return distribution_; } + +protected: + /// The process group of the graph + process_group_type pg; + + /// The distribution used for the graph + distribution_type distribution_; +}; + +} } } // end namespace boost::graph::distributed + +#endif // BOOST_GRAPH_DISTRIBUTED_NAMED_GRAPH_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/page_rank.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/page_rank.hpp new file mode 100644 index 0000000000..9807dffdfe --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/page_rank.hpp @@ -0,0 +1,225 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. +// Copyright (C) 2002 Brad King and Douglas Gregor + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +// Brian Barrett +#ifndef BOOST_PARALLEL_GRAPH_PAGE_RANK_HPP +#define BOOST_PARALLEL_GRAPH_PAGE_RANK_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include + +// #define WANT_MPI_ONESIDED 1 + +namespace boost { namespace graph { namespace distributed { + +namespace detail { +#ifdef WANT_MPI_ONESIDED + template + void page_rank_step(const Graph& g, RankMap from_rank, MPI_Win to_win, + typename property_traits::value_type damping, + owner_map_t owner) + { + typedef typename property_traits::value_type rank_type; + int me, ret; + MPI_Comm_rank(MPI_COMM_WORLD, &me); + + // MPI_Accumulate is not required to store the value of the data + // being sent, only the address. The value of the memory location + // must not change until the end of the access epoch, meaning the + // call to MPI_Fence. We therefore store the updated value back + // into the from_rank map before the accumulate rather than using + // a temporary. We're going to reset the values in the from_rank + // before the end of page_rank_step() anyway, so this isn't a huge + // deal. But MPI-2 One-sided is an abomination. + BGL_FORALL_VERTICES_T(u, g, Graph) { + put(from_rank, u, (damping * get(from_rank, u) / out_degree(u, g))); + BGL_FORALL_ADJ_T(u, v, g, Graph) { + ret = MPI_Accumulate(&(from_rank[u]), + 1, MPI_DOUBLE, + get(owner, v), local(v), + 1, MPI_DOUBLE, MPI_SUM, to_win); + assert(MPI_SUCCESS == ret); + } + } + MPI_Win_fence(0, to_win); + + // Set new rank maps for the other map. Do this now to get around + // the stupid synchronization rules of MPI-2 One-sided + BGL_FORALL_VERTICES_T(v, g, Graph) put(from_rank, v, rank_type(1 - damping)); + } +#endif + + template + struct rank_accumulate_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template + T operator()(const K&) const { return T(0); } + + template + T operator()(const K&, const T& x, const T& y) const { return x + y; } + }; +} // end namespace detail + +template +void +page_rank_impl(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; + + int me; + MPI_Comm_rank(MPI_COMM_WORLD, &me); + + typedef typename property_map + ::const_type vertex_owner_map; + typename property_map::const_type + owner = get(vertex_owner, g); + + typedef typename boost::graph::parallel::process_group_type + ::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + + assert(me == id); + + rank_type initial_rank = rank_type(rank_type(1) / n); + BGL_FORALL_VERTICES_T(v, g, Graph) put(rank_map, v, initial_rank); + +#ifdef WANT_MPI_ONESIDED + + assert(sizeof(rank_type) == sizeof(double)); + + bool to_map_2 = true; + MPI_Win win, win2; + + MPI_Win_create(&(rank_map[*(vertices(g).first)]), + sizeof(double) * num_vertices(g), + sizeof(double), + MPI_INFO_NULL, MPI_COMM_WORLD, &win); + MPI_Win_set_name(win, "rank_map_win"); + MPI_Win_create(&(rank_map2[*(vertices(g).first)]), + sizeof(double) * num_vertices(g), + sizeof(double), + MPI_INFO_NULL, MPI_COMM_WORLD, &win2); + MPI_Win_set_name(win, "rank_map2_win"); + + // set initial rank maps for the first iteration... + BGL_FORALL_VERTICES_T(v, g, Graph) put(rank_map2, v, rank_type(1 - damping)); + + MPI_Win_fence(0, win); + MPI_Win_fence(0, win2); + + while ((to_map_2 && !done(rank_map, g)) || + (!to_map_2 && !done(rank_map2, g))) { + if (to_map_2) { + graph::distributed::detail::page_rank_step(g, rank_map, win2, damping, owner); + to_map_2 = false; + } else { + graph::distributed::detail::page_rank_step(g, rank_map2, win, damping, owner); + to_map_2 = true; + } + } + synchronize(boost::graph::parallel::process_group(g)); + + MPI_Win_free(&win); + MPI_Win_free(&win2); + +#else + // The ranks accumulate after each step. + rank_map.set_reduce(detail::rank_accumulate_reducer()); + rank_map2.set_reduce(detail::rank_accumulate_reducer()); + rank_map.set_consistency_model(boost::parallel::cm_flush | boost::parallel::cm_reset); + rank_map2.set_consistency_model(boost::parallel::cm_flush | boost::parallel::cm_reset); + + bool to_map_2 = true; + while ((to_map_2 && !done(rank_map, g)) || + (!to_map_2 && !done(rank_map2, g))) { + /** + * PageRank can implemented slightly more efficiently on a + * bidirectional graph than on an incidence graph. However, + * distributed PageRank requires that we have the rank of the + * source vertex available locally, so we force the incidence + * graph implementation, which pushes rank from source to + * target. + */ + typedef incidence_graph_tag category; + if (to_map_2) { + graph::detail::page_rank_step(g, rank_map, rank_map2, damping, + category()); + to_map_2 = false; + } else { + graph::detail::page_rank_step(g, rank_map2, rank_map, damping, + category()); + to_map_2 = true; + } + using boost::graph::parallel::process_group; + synchronize(process_group(g)); + } + + rank_map.reset(); +#endif + + 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, + RankMap2 rank_map2 + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, distributed_graph_tag)) +{ + (page_rank_impl)(g, rank_map, done, damping, n, rank_map2); +} + +template +void +remove_dangling_links(MutableGraph& g + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(MutableGraph, + distributed_graph_tag)) +{ + 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 distributed + +using distributed::page_rank; +using distributed::remove_dangling_links; + +} } // end namespace boost::graph + +#endif // BOOST_PARALLEL_GRAPH_PAGE_RANK_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/queue.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/queue.hpp new file mode 100644 index 0000000000..7e84272ab1 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/queue.hpp @@ -0,0 +1,278 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_QUEUE_HPP +#define BOOST_GRAPH_DISTRIBUTED_QUEUE_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include + +namespace boost { namespace graph { namespace distributed { + +/// A unary predicate that always returns "true". +struct always_push +{ + template bool operator()(const T&) const { return true; } +}; + + + +/** A distributed queue adaptor. + * + * Class template @c distributed_queue implements a distributed queue + * across a process group. The distributed queue is an adaptor over an + * existing (local) queue, which must model the @ref Buffer + * concept. Each process stores a distinct copy of the local queue, + * from which it draws or removes elements via the @ref pop and @ref + * top members. + * + * The value type of the local queue must be a model of the @ref + * GlobalDescriptor concept. The @ref push operation of the + * distributed queue passes (via a message) the value to its owning + * processor. Thus, the elements within a particular local queue are + * guaranteed to have the process owning that local queue as an owner. + * + * Synchronization of distributed queues occurs in the @ref empty and + * @ref size functions, which will only return "empty" values (true or + * 0, respectively) when the entire distributed queue is empty. If the + * local queue is empty but the distributed queue is not, the + * operation will block until either condition changes. When the @ref + * size function of a nonempty queue returns, it returns the size of + * the local queue. These semantics were selected so that sequential + * code that processes elements in the queue via the following idiom + * can be parallelized via introduction of a distributed queue: + * + * distributed_queue<...> Q; + * Q.push(x); + * while (!Q.empty()) { + * // do something, that may push a value onto Q + * } + * + * In the parallel version, the initial @ref push operation will place + * the value @c x onto its owner's queue. All processes will + * synchronize at the call to empty, and only the process owning @c x + * will be allowed to execute the loop (@ref Q.empty() returns + * false). This iteration may in turn push values onto other remote + * queues, so when that process finishes execution of the loop body + * and all processes synchronize again in @ref empty, more processes + * may have nonempty local queues to execute. Once all local queues + * are empty, @ref Q.empty() returns @c false for all processes. + * + * The distributed queue can receive messages at two different times: + * during synchronization and when polling @ref empty. Messages are + * always received during synchronization, to ensure that accurate + * local queue sizes can be determines. However, whether @ref empty + * should poll for messages is specified as an option to the + * constructor. Polling may be desired when the order in which + * elements in the queue are processed is not important, because it + * permits fewer synchronization steps and less communication + * overhead. However, when more strict ordering guarantees are + * required, polling may be semantically incorrect. By disabling + * polling, one ensures that parallel execution using the idiom above + * will not process an element at a later "level" before an earlier + * "level". + * + * The distributed queue nearly models the @ref Buffer + * concept. However, the @ref push routine does not necessarily + * increase the result of @c size() by one (although the size of the + * global queue does increase by one). + */ +template +class distributed_queue +{ + typedef distributed_queue self_type; + + enum { + /** Message indicating a remote push. The message contains a + * single value x of type value_type that is to be pushed on the + * receiver's queue. + */ + msg_push, + /** Push many elements at once. */ + msg_multipush + }; + + public: + typedef ProcessGroup process_group_type; + typedef Buffer buffer_type; + typedef typename buffer_type::value_type value_type; + typedef typename buffer_type::size_type size_type; + + /** Construct a new distributed queue. + * + * Build a new distributed queue that communicates over the given @p + * process_group, whose local queue is initialized via @p buffer and + * which may or may not poll for messages. + */ + explicit + distributed_queue(const ProcessGroup& process_group, + const OwnerMap& owner, + const Buffer& buffer, + bool polling = false); + + /** Construct a new distributed queue. + * + * Build a new distributed queue that communicates over the given @p + * process_group, whose local queue is initialized via @p buffer and + * which may or may not poll for messages. + */ + explicit + distributed_queue(const ProcessGroup& process_group = ProcessGroup(), + const OwnerMap& owner = OwnerMap(), + const Buffer& buffer = Buffer(), + const UnaryPredicate& pred = UnaryPredicate(), + bool polling = false); + + /** Construct a new distributed queue. + * + * Build a new distributed queue that communicates over the given @p + * process_group, whose local queue is default-initalized and which + * may or may not poll for messages. + */ + distributed_queue(const ProcessGroup& process_group, const OwnerMap& owner, + const UnaryPredicate& pred, bool polling = false); + + /** Virtual destructor required with virtual functions. + * + */ + virtual ~distributed_queue() {} + + /** Push an element onto the distributed queue. + * + * The element will be sent to its owner process to be added to that + * process's local queue. If polling is enabled for this queue and + * the owner process is the current process, the value will be + * immediately pushed onto the local queue. + * + * Complexity: O(1) messages of size O(sizeof(value_type)) will be + * transmitted. + */ + void push(const value_type& x); + + /** Pop an element off the local queue. + * + * @p @c !empty() + */ + void pop() { buffer.pop(); } + + /** + * Return the element at the top of the local queue. + * + * @p @c !empty() + */ + value_type& top() { return buffer.top(); } + + /** + * \overload + */ + const value_type& top() const { return buffer.top(); } + + /** Determine if the queue is empty. + * + * When the local queue is nonempty, returns @c true. If the local + * queue is empty, synchronizes with all other processes in the + * process group until either (1) the local queue is nonempty + * (returns @c true) (2) the entire distributed queue is empty + * (returns @c false). + */ + bool empty() const; + + /** Determine the size of the local queue. + * + * The behavior of this routine is equivalent to the behavior of + * @ref empty, except that when @ref empty returns true this + * function returns the size of the local queue and when @ref empty + * returns false this function returns zero. + */ + size_type size() const; + + // private: + /** Synchronize the distributed queue and determine if all queues + * are empty. + * + * \returns \c true when all local queues are empty, or false if at least + * one of the local queues is nonempty. + * Defined as virtual for derived classes like depth_limited_distributed_queue. + */ + virtual bool do_synchronize() const; + + private: + // Setup triggers + void setup_triggers(); + + // Message handlers + void + handle_push(int source, int tag, const value_type& value, + trigger_receive_context); + + void + handle_multipush(int source, int tag, const std::vector& values, + trigger_receive_context); + + mutable ProcessGroup process_group; + OwnerMap owner; + mutable Buffer buffer; + UnaryPredicate pred; + bool polling; + + typedef std::vector outgoing_buffer_t; + typedef std::vector outgoing_buffers_t; + shared_ptr outgoing_buffers; +}; + +/// Helper macro containing the normal names for the template +/// parameters to distributed_queue. +#define BOOST_DISTRIBUTED_QUEUE_PARMS \ + typename ProcessGroup, typename OwnerMap, typename Buffer, \ + typename UnaryPredicate + +/// Helper macro containing the normal template-id for +/// distributed_queue. +#define BOOST_DISTRIBUTED_QUEUE_TYPE \ + distributed_queue + +/** Synchronize all processes involved with the given distributed queue. + * + * This function will synchronize all of the local queues for a given + * distributed queue, by ensuring that no additional messages are in + * transit. It is rarely required by the user, because most + * synchronization of distributed queues occurs via the @c empty or @c + * size methods. + */ +template +inline void +synchronize(const BOOST_DISTRIBUTED_QUEUE_TYPE& Q) +{ Q.do_synchronize(); } + +/// Construct a new distributed queue. +template +inline distributed_queue +make_distributed_queue(const ProcessGroup& process_group, + const OwnerMap& owner, + const Buffer& buffer, + bool polling = false) +{ + typedef distributed_queue result_type; + return result_type(process_group, owner, buffer, polling); +} + +} } } // end namespace boost::graph::distributed + +#include + +#undef BOOST_DISTRIBUTED_QUEUE_TYPE +#undef BOOST_DISTRIBUTED_QUEUE_PARMS + +#endif // BOOST_GRAPH_DISTRIBUTED_QUEUE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/reverse_graph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/reverse_graph.hpp new file mode 100644 index 0000000000..615aab8b91 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/reverse_graph.hpp @@ -0,0 +1,38 @@ +// Copyright (C) 2005-2006 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: Nick Edmonds +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_REVERSE_GRAPH_HPP +#define BOOST_GRAPH_DISTRIBUTED_REVERSE_GRAPH_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include + +namespace boost { + namespace graph { + namespace parallel { + /// Retrieve the process group from a reverse graph + template + struct process_group_type > + : process_group_type { }; + } + + } + + /// Retrieve the process group from a reverse graph + template + inline typename graph::parallel::process_group_type::type + process_group(reverse_graph const& g) { + return process_group(g.m_g); + } +} // namespace boost + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/rmat_graph_generator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/rmat_graph_generator.hpp new file mode 100644 index 0000000000..b033e9b904 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/rmat_graph_generator.hpp @@ -0,0 +1,162 @@ +// Copyright 2004, 2005 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: Nick Edmonds +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP +#define BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include + +namespace boost { + + // Memory-scalable (amount of memory required will scale down + // linearly as the number of processes increases) generator, which + // requires an MPI process group. Run-time is slightly worse than + // the unique rmat generator. Edge list generated is sorted and + // unique. + template + class scalable_rmat_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; + + 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; + + // No argument constructor, set to terminating condition + scalable_rmat_iterator() + : gen(), done(true) + { } + + // Initialize for edge generation + scalable_rmat_iterator(ProcessGroup pg, Distribution distrib, + RandomGenerator& gen, vertices_size_type n, + edges_size_type m, double a, double b, double c, + double d, bool permute_vertices = true) + : gen(), done(false) + { + assert(a + b + c + d == 1); + int id = process_id(pg); + + this->gen.reset(new uniform_01(gen)); + + std::vector vertexPermutation; + if (permute_vertices) + generate_permutation_vector(gen, vertexPermutation, n); + + int SCALE = int(floor(log2(n))); + boost::uniform_01 prob(gen); + + std::map edge_map; + + edges_size_type generated = 0, local_edges = 0; + do { + edges_size_type tossed = 0; + do { + vertices_size_type u, v; + tie(u, v) = generate_edge(this->gen, n, SCALE, a, b, c, d); + + if (permute_vertices) { + u = vertexPermutation[u]; + v = vertexPermutation[v]; + } + + // Lowest vertex number always comes first (this + // means we don't have to worry about i->j and j->i + // being in the edge list) + if (u > v && is_same::value) + std::swap(u, v); + + if (distrib(u) == id || distrib(v) == id) { + if (edge_map.find(std::make_pair(u, v)) == edge_map.end()) { + edge_map[std::make_pair(u, v)] = true; + local_edges++; + } else { + tossed++; + + // special case - if both u and v are on same + // proc, ++ twice, since we divide by two (to + // cover the two process case) + if (distrib(u) == id && distrib(v) == id) + tossed++; + } + } + generated++; + + } while (generated < m); + tossed = all_reduce(pg, tossed, boost::parallel::sum()); + generated -= (tossed / 2); + } while (generated < m); + // NGE - Asking for more than n^2 edges will result in an infinite loop here + // Asking for a value too close to n^2 edges may as well + + values.reserve(local_edges); + typename std::map::reverse_iterator em_end = edge_map.rend(); + for (typename std::map::reverse_iterator em_i = edge_map.rbegin(); + em_i != em_end ; + ++em_i) { + values.push_back(em_i->first); + } + + current = values.back(); + values.pop_back(); + } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + scalable_rmat_iterator& operator++() + { + if (!values.empty()) { + current = values.back(); + values.pop_back(); + } else + done = true; + + return *this; + } + + scalable_rmat_iterator operator++(int) + { + scalable_rmat_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const scalable_rmat_iterator& other) const + { + return values.empty() && other.values.empty() && done && other.done; + } + + bool operator!=(const scalable_rmat_iterator& other) const + { return !(*this == other); } + + private: + + // Parameters + shared_ptr > gen; + + // Internal data structures + std::vector values; + value_type current; + bool done; + }; + +} // end namespace boost + +#endif // BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/selector.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/selector.hpp new file mode 100644 index 0000000000..2e26c16901 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/selector.hpp @@ -0,0 +1,36 @@ +// Copyright (C) 2006 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP +#define BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +namespace boost { + + /* The default local selector for a distributedS selector. */ + struct defaultS {}; + + /** + * Selector that specifies that the graph should be distributed + * among different processes organized based on the given process + * group. + */ + template + struct distributedS + { + typedef ProcessGroup process_group_type; + typedef LocalS local_selector; + typedef DistributionS distribution; + }; +} + +#endif // BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/shuffled_distribution.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/shuffled_distribution.hpp new file mode 100644 index 0000000000..92bc0397f2 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/shuffled_distribution.hpp @@ -0,0 +1,113 @@ +// Copyright Daniel Wallin 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) + +#ifndef BOOST_SHUFFLED_DISTRIBUTION_070923_HPP +#define BOOST_SHUFFLED_DISTRIBUTION_070923_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +# include +# include + +namespace boost { namespace graph { namespace distributed { + +template +struct shuffled_distribution : BaseDistribution +{ + typedef std::size_t size_type; + + template + shuffled_distribution(ProcessGroup const& pg, BaseDistribution const& base) + : BaseDistribution(base) + , n(num_processes(pg)) + , mapping_(make_counting_iterator(size_type(0)), make_counting_iterator(n)) + , reverse_mapping(mapping_) + {} + + std::vector const& mapping() const + { + return mapping_; + } + + template + void assign_mapping(InputIterator first, InputIterator last) + { + mapping_.assign(first, last); + assert(mapping_.size() == n); + reverse_mapping.resize(mapping_.size()); + + for (std::vector::iterator i(mapping_.begin()); + i != mapping_.end(); ++i) + { + reverse_mapping[*i] = i - mapping_.begin(); + } + } + + BaseDistribution& base() + { + return *this; + } + + BaseDistribution const& base() const + { + return *this; + } + + template + size_type block_size(ProcessID id, size_type n) const + { + return base().block_size(reverse_mapping[id], n); + } + + template + size_type operator()(T const& value) const + { + return mapping_[base()(value)]; + } + + template + size_type start(ProcessID id) const + { + return base().start(reverse_mapping[id]); + } + + size_type local(size_type i) const + { + return base().local(i); + } + + size_type global(size_type i) const + { + return base().global(i); + } + + template + size_type global(ProcessID id, size_type n) const + { + return base().global(reverse_mapping[id], n); + } + + template + void serialize(Archive& ar, unsigned long /*version*/) + { + ar & serialization::make_nvp("base", base()); + } + + void clear() + { + base().clear(); + } + +private: + size_type n; + std::vector mapping_; + std::vector reverse_mapping; +}; + +}}} // namespace boost::graph::distributed + +#endif // BOOST_SHUFFLED_DISTRIBUTION_070923_HPP + diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/st_connected.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/st_connected.hpp new file mode 100644 index 0000000000..b007442615 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/st_connected.hpp @@ -0,0 +1,186 @@ +// Copyright (C) 2006 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_ST_CONNECTED_HPP +#define BOOST_GRAPH_DISTRIBUTED_ST_CONNECTED_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace graph { namespace distributed { + +namespace detail { + struct pair_and_or + { + std::pair + operator()(std::pair x, std::pair y) const + { + return std::pair(x.first && y.first, + x.second || y.second); + } + }; + +} // end namespace detail + +template +bool +st_connected(const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + typename graph_traits::vertex_descriptor t, + ColorMap color, OwnerMap owner) +{ + using boost::graph::parallel::process_group; + using boost::graph::parallel::process_group_type; + using boost::parallel::all_reduce; + + typedef typename property_traits::value_type Color; + typedef color_traits ColorTraits; + typedef typename process_group_type::type ProcessGroup; + typedef typename ProcessGroup::process_id_type ProcessID; + typedef typename graph_traits::vertex_descriptor Vertex; + + // Set all vertices to white (unvisited) + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) + put(color, v, ColorTraits::white()); + + // "color" plays the role of a color map, with no synchronization. + set_property_map_role(vertex_color, color); + color.set_consistency_model(0); + + // Vertices found from the source are grey + put(color, s, ColorTraits::gray()); + + // Vertices found from the target are green + put(color, t, ColorTraits::green()); + + ProcessGroup pg = process_group(g); + ProcessID rank = process_id(pg); + + // Build a local queue + queue Q; + if (get(owner, s) == rank) Q.push(s); + if (get(owner, t) == rank) Q.push(t); + + queue other_Q; + + while (true) { + bool found = false; + + // Process all vertices in the local queue + while (!found && !Q.empty()) { + Vertex u = Q.top(); Q.pop(); + Color u_color = get(color, u); + + BGL_FORALL_OUTEDGES_T(u, e, g, DistributedGraph) { + Vertex v = target(e, g); + Color v_color = get(color, v); + if (v_color == ColorTraits::white()) { + // We have not seen "v" before; mark it with the same color as u + Color u_color = get(color, u); + put(color, v, u_color); + + // Either push v into the local queue or send it off to its + // owner. + ProcessID v_owner = get(owner, v); + if (v_owner == rank) + other_Q.push(v); + else + send(pg, v_owner, 0, + std::make_pair(v, u_color == ColorTraits::gray())); + } else if (v_color != ColorTraits::black() && u_color != v_color) { + // Colors have collided. We're done! + found = true; + break; + } + } + + // u is done, so mark it black + put(color, u, ColorTraits::black()); + } + + // Ensure that all transmitted messages have been received. + synchronize(pg); + + // Move all of the send-to-self values into the local Q. + other_Q.swap(Q); + + if (!found) { + // Receive all messages + while (optional > msg = probe(pg)) { + std::pair data; + receive(pg, msg->first, msg->second, data); + + // Determine the colors of u and v, the source and target + // vertices (v is local). + Vertex v = data.first; + Color v_color = get(color, v); + Color u_color = data.second? ColorTraits::gray() : ColorTraits::green(); + if (v_color == ColorTraits::white()) { + // v had no color before, so give it u's color and push it + // into the queue. + Q.push(v); + put(color, v, u_color); + } else if (v_color != ColorTraits::black() && u_color != v_color) { + // Colors have collided. We're done! + found = true; + break; + } + } + } + + // Check if either all queues are empty or + std::pair results = all_reduce(pg, + boost::parallel::detail::make_untracked_pair(Q.empty(), found), + detail::pair_and_or()); + + // If someone found the answer, we're done! + if (results.second) + return true; + + // If all queues are empty, we're done. + if (results.first) + return false; + } +} + +template +inline bool +st_connected(const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + typename graph_traits::vertex_descriptor t, + ColorMap color) +{ + return st_connected(g, s, t, color, get(vertex_owner, g)); +} + +template +inline bool +st_connected(const DistributedGraph& g, + typename graph_traits::vertex_descriptor s, + typename graph_traits::vertex_descriptor t) +{ + return st_connected(g, s, t, + make_two_bit_color_map(num_vertices(g), + get(vertex_index, g))); +} + +} } } // end namespace boost::graph::distributed + +#endif // BOOST_GRAPH_DISTRIBUTED_ST_CONNECTED_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/strong_components.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/strong_components.hpp new file mode 100644 index 0000000000..408cc64389 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/strong_components.hpp @@ -0,0 +1,985 @@ +// Copyright (C) 2004-2008 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: Nick Edmonds +// Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_SCC_HPP +#define BOOST_GRAPH_DISTRIBUTED_SCC_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +// #define PBGL_SCC_DEBUG + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef PBGL_SCC_DEBUG + #include + #include + #include + #include + #include // for ostringstream +#endif +#include +#include +#include + +#ifdef PBGL_SCC_DEBUG +# include +#endif /* PBGL_SCC_DEBUG */ + +// If your graph is likely to have large numbers of small strongly connected +// components then running the sequential SCC algorithm on the local subgraph +// and filtering components with no remote edges may increase performance +// #define FILTER_LOCAL_COMPONENTS + +namespace boost { namespace graph { namespace distributed { namespace detail { + +template +struct v_sets{ + std::vector pred, succ, intersect, ps_union; +}; + +/* Serialize vertex set */ +template +void +marshal_set( std::vector::vertex_descriptor> > in, + std::vector::vertex_descriptor>& out ) +{ + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + for( std::size_t i = 0; i < in.size(); ++i ) { + out.insert( out.end(), graph_traits::null_vertex() ); + out.insert( out.end(), in[i].begin(), in[i].end() ); + } +} + +/* Un-serialize vertex set */ +template +void +unmarshal_set( std::vector::vertex_descriptor> in, + std::vector::vertex_descriptor> >& out ) +{ + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::vertex_iterator vertex_iterator; + + while( !in.empty() ) { + typename std::vector::iterator end + = std::find( in.begin(), in.end(), graph_traits::null_vertex() ); + + if( end == in.begin() ) + in.erase( in.begin() ); + else { + out.push_back(std::vector()); + out[out.size() - 1].insert( out[out.size() - 1].end(), in.begin(), end ); + in.erase( in.begin(), end ); + } + } +} + +/* Determine if vertex is in subset */ +template +struct in_subset { + in_subset() : m_s(0) { } + in_subset(const Set& s) : m_s(&s) { } + + template + bool operator()(const Elt& x) const { + return ((*m_s).find(x) != (*m_s).end()); + } + +private: + const Set* m_s; +}; + +template +struct vertex_identity_property_map + : public boost::put_get_helper > +{ + typedef T key_type; + typedef T value_type; + typedef T reference; + typedef boost::readable_property_map_tag category; + + inline value_type operator[](const key_type& v) const { return v; } + inline void clear() { } +}; + +template +inline void synchronize( vertex_identity_property_map & ) { } + +/* BFS visitor for SCC */ +template +struct scc_discovery_visitor : bfs_visitor<> +{ + scc_discovery_visitor(SourceMap& sourceM) + : sourceM(sourceM) {} + + template + void tree_edge(Edge e, const Graph& g) + { + put(sourceM, target(e,g), get(sourceM, source(e,g))); + } + + private: + SourceMap& sourceM; +}; + +} } } } /* End namespace boost::graph::distributed::detail */ + +namespace boost { namespace graph { namespace distributed { + enum fhp_message_tags { fhp_edges_size_msg, fhp_add_edges_msg, fhp_pred_size_msg, + fhp_pred_msg, fhp_succ_size_msg, fhp_succ_msg }; + + template + void + fleischer_hendrickson_pinar_strong_components(const Graph& g, + VertexComponentMap c, + const ReverseGraph& gr, + IsoMapFR fr, IsoMapRF rf, + VertexIndexMap vertex_index_map) + { + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::vertex_iterator rev_vertex_iterator; + typedef typename graph_traits::vertex_descriptor rev_vertex_descriptor; + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef iterator_property_map::iterator, + VertexIndexMap> ParentMap; + typedef iterator_property_map::iterator, + VertexIndexMap> ColorMap; + typedef iterator_property_map::iterator, + VertexIndexMap> Rev_ParentMap; + typedef std::vector > VertexPairVec; + + typedef typename property_map::const_type + OwnerMap; + + OwnerMap owner = get(vertex_owner, g); + + using boost::graph::parallel::process_group; + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + int num_procs = num_processes(pg); + int n = 0; + + int my_n = num_vertices(g); + all_reduce(pg, &my_n, &my_n+1, &n, std::plus()); + + // + // Initialization + // + +#ifdef PBGL_SCC_DEBUG + accounting::time_type start = accounting::get_time(); +#endif + + vertex_iterator vstart, vend; + rev_vertex_iterator rev_vstart, rev_vend; + std::vector > vertex_sets, new_vertex_sets; + + vertex_sets.push_back(std::vector()); + + // Remove vertices that do not have at least one in edge and one out edge + new_vertex_sets.push_back(std::vector()); + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + if( out_degree( get(fr, *vstart), gr) > 0 && out_degree(*vstart, g) > 0 ) + new_vertex_sets[0].push_back( *vstart ); + + // Perform sequential SCC on local subgraph, filter all components with external + // edges, mark remaining components and remove them from vertex_sets +#ifdef FILTER_LOCAL_COMPONENTS + // This doesn't actually speed up SCC in connected graphs it seems, but it does work + // and may help in the case where there are lots of small strong components. + { + local_subgraph ls(g); + typedef typename property_map, vertex_index_t>::type + local_index_map_type; + local_index_map_type local_index = get(vertex_index, ls); + + std::vector ls_components_vec(num_vertices(ls)); + typedef iterator_property_map::iterator, local_index_map_type> + ls_components_map_type; + ls_components_map_type ls_component(ls_components_vec.begin(), local_index); + int num_comp = boost::strong_components(ls, ls_component); + + // Create map of components + std::map > local_comp_map; + typedef typename graph_traits >::vertex_iterator ls_vertex_iterator; + ls_vertex_iterator vstart, vend; + for( tie(vstart,vend) = vertices(ls); vstart != vend; vstart++ ) + local_comp_map[get(ls_component, *vstart)].push_back( *vstart ); + + // Filter components that have no non-local edges + typedef typename graph_traits::adjacency_iterator adjacency_iterator; + typedef typename graph_traits::adjacency_iterator rev_adjacency_iterator; + adjacency_iterator abegin, aend; + rev_adjacency_iterator rev_abegin, rev_aend; + for( std::size_t i = 0; i < num_comp; ++i ) { + bool local = true; + for( std::size_t j = 0; j < local_comp_map[i].size(); j++ ) { + for( tie(abegin,aend) = adjacent_vertices(local_comp_map[i][j], g); + abegin != aend; abegin++ ) + if( get(owner, *abegin) != id ) { + local = false; + break; + } + + if( local ) + for( tie(rev_abegin,rev_aend) = adjacent_vertices(get(fr, local_comp_map[i][j]), gr); + rev_abegin != rev_aend; rev_abegin++ ) + if( get(owner, *rev_abegin) != id ) { + local = false; + break; + } + + if( !local ) break; + } + + if( local ) // Mark and remove from new_vertex_sets + for( std::size_t j = 0; j < local_comp_map[i].size(); j++ ) { + put( c, local_comp_map[i][j], local_comp_map[i][0] ); + typename std::vector::iterator pos = + std::find(new_vertex_sets[0].begin(), new_vertex_sets[0].end(), local_comp_map[i][j]); + if( pos != new_vertex_sets[0].end() ) + new_vertex_sets[0].erase(pos); + } + } + } +#endif // FILTER_LOCAL_COMPONENTS + + all_gather( pg, new_vertex_sets[0].begin(), new_vertex_sets[0].end(), vertex_sets[0] ); + new_vertex_sets.clear(); + +#ifdef PBGL_SCC_DEBUG + accounting::time_type end = accounting::get_time(); + if(id == 0) + std::cerr << "Trim local SCCs time = " << accounting::print_time(end - start) << " seconds.\n"; +#endif + + if( vertex_sets[0].empty() ) return; + + // + // Recursively determine SCCs + // + +#ifdef PBGL_SCC_DEBUG + int iterations = 0; +#endif + + // Only need to be able to map starting vertices for BFS from now on + fr.clear(); + + do { + +#ifdef PBGL_SCC_DEBUG + if(id == 0) { + printf("\n\nIteration %d:\n\n", iterations++); + + if( iterations > 1 ) { + end = accounting::get_time(); + std::cerr << "Running main loop destructors time = " << accounting::print_time(end - start) << " seconds.\n"; + } + + start = accounting::get_time(); + } +#endif + + // Get forward->reverse mappings for BFS start vertices + for (std::size_t i = 0; i < vertex_sets.size(); ++i) + get(fr, vertex_sets[i][0]); + synchronize(fr); + + // Determine local vertices to start BFS from + std::vector local_start; + for( std::size_t i = id; i < vertex_sets.size(); i += num_procs ) + local_start.push_back(vertex_sets[i][0]); + + if( local_start.empty() ) + local_start.push_back(vertex_sets[0][0]); + + + // Make filtered graphs + typedef std::set VertexSet; + typedef std::set Rev_VertexSet; + + VertexSet filter_set_g; + Rev_VertexSet filter_set_gr; + typename VertexSet::iterator fs; + + int active_vertices = 0; + for (std::size_t i = 0; i < vertex_sets.size(); i++) + active_vertices += vertex_sets[i].size(); + + // This is a completely random bound + if ( active_vertices < 0.05*n ) { + // TODO: This set insertion is ridiculously inefficient, make it an in-place-merge? + for (std::size_t i = 0; i < vertex_sets.size(); i++) + filter_set_g.insert(vertex_sets[i].begin(), vertex_sets[i].end()); + + for (fs = filter_set_g.begin(); fs != filter_set_g.end(); ++fs ) + filter_set_gr.insert(get(fr, *fs)); + } + + filtered_graph > + fg(g, keep_all(), detail::in_subset(filter_set_g)); + + filtered_graph > + fgr(gr, keep_all(), detail::in_subset(filter_set_gr)); + + // Add additional starting vertices to BFS queue + typedef filtered_queue, boost::detail::has_not_been_seen > + local_queue_type; + typedef boost::graph::distributed::distributed_queue + queue_t; + + typedef typename property_map::const_type + RevOwnerMap; + + typedef filtered_queue, boost::detail::has_not_been_seen > + rev_local_queue_type; + typedef boost::graph::distributed::distributed_queue + rev_queue_t; + + queue_t Q(process_group(g), + owner, + make_filtered_queue(queue(), + boost::detail::has_not_been_seen + (num_vertices(g), vertex_index_map)), + false); + + rev_queue_t Qr(process_group(gr), + get(vertex_owner, gr), + make_filtered_queue(queue(), + boost::detail::has_not_been_seen + (num_vertices(gr), vertex_index_map)), + false); + + for( std::size_t i = 1; i < local_start.size(); ++i ) { + Q.push(local_start[i]); + Qr.push(get(fr, local_start[i])); + } + +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) + std::cerr << " Initialize BFS time = " << accounting::print_time(end - start) << " seconds.\n"; + start = accounting::get_time(); +#endif + +#ifdef PBGL_SCC_DEBUG + accounting::time_type start2 = accounting::get_time(); +#endif + + // Forward BFS + std::vector color_map_s(num_vertices(g)); + ColorMap color_map(color_map_s.begin(), vertex_index_map); + std::vector succ_map_s(num_vertices(g), graph_traits::null_vertex()); + ParentMap succ_map(succ_map_s.begin(), vertex_index_map); + + for( std::size_t i = 0; i < vertex_sets.size(); ++i ) + put(succ_map, vertex_sets[i][0], vertex_sets[i][0]); + +#ifdef PBGL_SCC_DEBUG + accounting::time_type end2 = accounting::get_time(); + if(id == 0) + std::cerr << " Initialize forward BFS time = " << accounting::print_time(end2 - start2) << " seconds.\n"; +#endif + + if (active_vertices < 0.05*n) + breadth_first_search(fg, local_start[0], Q, + detail::scc_discovery_visitor >, ParentMap> + (succ_map), + color_map); + else + breadth_first_search(g, local_start[0], Q, + detail::scc_discovery_visitor(succ_map), + color_map); + +#ifdef PBGL_SCC_DEBUG + start2 = accounting::get_time(); +#endif + + // Reverse BFS + color_map.clear(); // reuse color map since g and gr have same vertex index + std::vector pred_map_s(num_vertices(gr), graph_traits::null_vertex()); + Rev_ParentMap pred_map(pred_map_s.begin(), vertex_index_map); + + for( std::size_t i = 0; i < vertex_sets.size(); ++i ) + put(pred_map, get(fr, vertex_sets[i][0]), vertex_sets[i][0]); + +#ifdef PBGL_SCC_DEBUG + end2 = accounting::get_time(); + if(id == 0) + std::cerr << " Initialize reverse BFS time = " << accounting::print_time(end2 - start2) << " seconds.\n"; +#endif + + if (active_vertices < 0.05*n) + breadth_first_search(fgr, get(fr, local_start[0]), + Qr, + detail::scc_discovery_visitor >, Rev_ParentMap> + (pred_map), + color_map); + else + breadth_first_search(gr, get(fr, local_start[0]), + Qr, + detail::scc_discovery_visitor(pred_map), + color_map); + +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) + std::cerr << " Perform forward and reverse BFS time = " << accounting::print_time(end - start) << " seconds.\n"; + start = accounting::get_time(); +#endif + + // Send predecessors and successors discovered by this proc to the proc responsible for + // this BFS tree + typedef struct detail::v_sets Vsets; + std::map set_map; + + std::map dest_map; + + std::vector successors(num_procs); + std::vector predecessors(num_procs); + + // Calculate destinations for messages + for (std::size_t i = 0; i < vertex_sets.size(); ++i) + dest_map[vertex_sets[i][0]] = i % num_procs; + + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) { + vertex_descriptor v = get(succ_map, *vstart); + if( v != graph_traits::null_vertex() ) + if (dest_map[v] == id) + set_map[v].succ.push_back(*vstart); + else + successors[dest_map[v]].push_back( std::make_pair(v, *vstart) ); + } + + for( tie(rev_vstart, rev_vend) = vertices(gr); rev_vstart != rev_vend; rev_vstart++ ) { + vertex_descriptor v = get(pred_map, *rev_vstart); + if( v != graph_traits::null_vertex() ) + if (dest_map[v] == id) + set_map[v].pred.push_back(get(rf, *rev_vstart)); + else + predecessors[dest_map[v]].push_back( std::make_pair(v, get(rf, *rev_vstart)) ); + } + + // Send predecessor and successor messages + for (process_id_type i = 0; i < num_procs; ++i) { + if (!successors[i].empty()) { + send(pg, i, fhp_succ_size_msg, successors[i].size()); + send(pg, i, fhp_succ_msg, &successors[i][0], successors[i].size()); + } + if (!predecessors[i].empty()) { + send(pg, i, fhp_pred_size_msg, predecessors[i].size()); + send(pg, i, fhp_pred_msg, &predecessors[i][0], predecessors[i].size()); + } + } + synchronize(pg); + + // Receive predecessor and successor messages and handle them + while (optional > m = probe(pg)) { + assert(m->second == fhp_succ_size_msg || m->second == fhp_pred_size_msg); + std::size_t num_requests; + receive(pg, m->first, m->second, num_requests); + VertexPairVec requests(num_requests); + if (m->second == fhp_succ_size_msg) { + receive(pg, m->first, fhp_succ_msg, &requests[0], + num_requests); + + std::map added; + for (std::size_t i = 0; i < requests.size(); ++i) { + set_map[requests[i].first].succ.push_back(requests[i].second); + added[requests[i].first]++; + } + + // If order of vertex traversal in vertices() is std::less, + // then the successor sets will be in order + for (std::size_t i = 0; i < local_start.size(); ++i) + if (added[local_start[i]] > 0) + std::inplace_merge(set_map[local_start[i]].succ.begin(), + set_map[local_start[i]].succ.end() - added[local_start[i]], + set_map[local_start[i]].succ.end(), + std::less()); + + } else { + receive(pg, m->first, fhp_pred_msg, &requests[0], + num_requests); + + std::map added; + for (std::size_t i = 0; i < requests.size(); ++i) { + set_map[requests[i].first].pred.push_back(requests[i].second); + added[requests[i].first]++; + } + + if (boost::is_same, IsoMapRF>::value) + for (std::size_t i = 0; i < local_start.size(); ++i) + if (added[local_start[i]] > 0) + std::inplace_merge(set_map[local_start[i]].pred.begin(), + set_map[local_start[i]].pred.end() - added[local_start[i]], + set_map[local_start[i]].pred.end(), + std::less()); + } + } + +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) + std::cerr << " All gather successors and predecessors time = " << accounting::print_time(end - start) << " seconds.\n"; + start = accounting::get_time(); +#endif + + // + // Filter predecessor and successor sets and perform set arithmetic + // + new_vertex_sets.clear(); + + if( std::size_t(id) < vertex_sets.size() ) { //If this proc has one or more unique starting points + + for( std::size_t i = 0; i < local_start.size(); ++i ) { + + vertex_descriptor v = local_start[i]; + + // Replace this sort with an in-place merges during receive step if possible + if (!boost::is_same, IsoMapRF>::value) + std::sort(set_map[v].pred.begin(), set_map[v].pred.end(), std::less()); + + // Limit predecessor and successor sets to members of the original set + std::vector temp; + + std::set_intersection( vertex_sets[id + i*num_procs].begin(), vertex_sets[id + i*num_procs].end(), + set_map[v].pred.begin(), set_map[v].pred.end(), + back_inserter(temp), + std::less()); + set_map[v].pred.clear(); + std::swap(set_map[v].pred, temp); + + std::set_intersection( vertex_sets[id + i*num_procs].begin(), vertex_sets[id + i*num_procs].end(), + set_map[v].succ.begin(), set_map[v].succ.end(), + back_inserter(temp), + std::less()); + set_map[v].succ.clear(); + std::swap(set_map[v].succ, temp); + + // Intersection(pred, succ) + std::set_intersection(set_map[v].pred.begin(), set_map[v].pred.end(), + set_map[v].succ.begin(), set_map[v].succ.end(), + back_inserter(set_map[v].intersect), + std::less()); + + // Union(pred, succ) + std::set_union(set_map[v].pred.begin(), set_map[v].pred.end(), + set_map[v].succ.begin(), set_map[v].succ.end(), + back_inserter(set_map[v].ps_union), + std::less()); + + new_vertex_sets.push_back(std::vector()); + // Original set - Union(pred, succ) + std::set_difference(vertex_sets[id + i*num_procs].begin(), vertex_sets[id + i*num_procs].end(), + set_map[v].ps_union.begin(), set_map[v].ps_union.end(), + back_inserter(new_vertex_sets[new_vertex_sets.size() - 1]), + std::less()); + + set_map[v].ps_union.clear(); + + new_vertex_sets.push_back(std::vector()); + // Pred - Intersect(pred, succ) + std::set_difference(set_map[v].pred.begin(), set_map[v].pred.end(), + set_map[v].intersect.begin(), set_map[v].intersect.end(), + back_inserter(new_vertex_sets[new_vertex_sets.size() - 1]), + std::less()); + + set_map[v].pred.clear(); + + new_vertex_sets.push_back(std::vector()); + // Succ - Intersect(pred, succ) + std::set_difference(set_map[v].succ.begin(), set_map[v].succ.end(), + set_map[v].intersect.begin(), set_map[v].intersect.end(), + back_inserter(new_vertex_sets[new_vertex_sets.size() - 1]), + std::less()); + + set_map[v].succ.clear(); + + // Label SCC just identified with the 'first' vertex in that SCC + for( std::size_t j = 0; j < set_map[v].intersect.size(); j++ ) + put(c, set_map[v].intersect[j], set_map[v].intersect[0]); + + set_map[v].intersect.clear(); + } + } + +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) + std::cerr << " Perform set arithemetic time = " << accounting::print_time(end - start) << " seconds.\n"; + start = accounting::get_time(); +#endif + + // Remove sets of size 1 from new_vertex_sets + typename std::vector >::iterator vviter; + for( vviter = new_vertex_sets.begin(); vviter != new_vertex_sets.end(); /*in loop*/ ) + if( (*vviter).size() < 2 ) + vviter = new_vertex_sets.erase( vviter ); + else + vviter++; + + // All gather new sets and recur (gotta marshal and unmarshal sets first) + vertex_sets.clear(); + std::vector serial_sets, all_serial_sets; + detail::marshal_set( new_vertex_sets, serial_sets ); + all_gather( pg, serial_sets.begin(), serial_sets.end(), all_serial_sets ); + detail::unmarshal_set( all_serial_sets, vertex_sets ); + +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) { + std::cerr << " Serialize and gather new vertex sets time = " << accounting::print_time(end - start) << " seconds.\n\n\n"; + + printf("Vertex sets: %d\n", (int)vertex_sets.size() ); + for( std::size_t i = 0; i < vertex_sets.size(); ++i ) + printf(" %d: %d\n", i, (int)vertex_sets[i].size() ); + } + start = accounting::get_time(); +#endif + + // HACK!?! -- This would be more properly implemented as a topological sort + // Remove vertices without an edge to another vertex in the set and an edge from another + // vertex in the set + typedef typename graph_traits::out_edge_iterator out_edge_iterator; + out_edge_iterator estart, eend; + typedef typename graph_traits::out_edge_iterator r_out_edge_iterator; + r_out_edge_iterator restart, reend; + for (std::size_t i = 0; i < vertex_sets.size(); ++i) { + std::vector new_set; + for (std::size_t j = 0; j < vertex_sets[i].size(); ++j) { + vertex_descriptor v = vertex_sets[i][j]; + if (get(owner, v) == id) { + tie(estart, eend) = out_edges(v, g); + while (estart != eend && find(vertex_sets[i].begin(), vertex_sets[i].end(), + target(*estart,g)) == vertex_sets[i].end()) estart++; + if (estart != eend) { + tie(restart, reend) = out_edges(get(fr, v), gr); + while (restart != reend && find(vertex_sets[i].begin(), vertex_sets[i].end(), + get(rf, target(*restart,g))) == vertex_sets[i].end()) restart++; + if (restart != reend) + new_set.push_back(v); + } + } + } + vertex_sets[i].clear(); + all_gather(pg, new_set.begin(), new_set.end(), vertex_sets[i]); + std::sort(vertex_sets[i].begin(), vertex_sets[i].end(), std::less()); + } +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) + std::cerr << " Trim vertex sets time = " << accounting::print_time(end - start) << " seconds.\n\n\n"; + start = accounting::get_time(); +#endif + + } while ( !vertex_sets.empty() ); + + + // Label vertices not in a SCC as their own SCC + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + if( get(c, *vstart) == graph_traits::null_vertex() ) + put(c, *vstart, *vstart); + + synchronize(c); + } + + template + void + build_reverse_graph( const Graph& g, ReverseGraph& gr, IsoMap& fr, IsoMap& rf ) + { + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::out_edge_iterator out_edge_iterator; + typedef typename boost::graph::parallel::process_group_type::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef std::vector > VertexPairVec; + + typedef typename graph_traits::directed_category directed_category; + + typename property_map::const_type + owner = get(vertex_owner, g); + + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + + int n; + vertex_iterator vstart, vend; + int num_procs = num_processes(pg); + + vertex_descriptor v; + out_edge_iterator oestart, oeend; + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + { + v = add_vertex(gr); + put(fr, *vstart, v); + put(rf, v, *vstart); + } + + gr.distribution() = g.distribution(); + + int my_n = num_vertices(g); + all_reduce(pg, &my_n, &my_n+1, &n, std::plus()); + + for (int i = 0; i < n; ++i) + get(fr, vertex(i,g)); + synchronize(fr); + + // Add edges to gr + std::vector > new_edges; + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + for( tie(oestart, oeend) = out_edges(*vstart, g); oestart != oeend; oestart++ ) + new_edges.push_back( std::make_pair(get(fr, target(*oestart,g)), get(fr, source(*oestart, g))) ); + + std::vector edge_requests(num_procs); + + typename std::vector >::iterator iter; + for( iter = new_edges.begin(); iter != new_edges.end(); iter++ ) { + std::pair p1 = *iter; + if( get(owner, p1.first ) == id ) + add_edge( p1.first, p1.second, gr ); + else + edge_requests[get(owner, p1.first)].push_back(p1); + } + new_edges.clear(); + + // Send edge addition requests + for (process_id_type p = 0; p < num_procs; ++p) { + if (!edge_requests[p].empty()) { + VertexPairVec reqs(edge_requests[p].begin(), edge_requests[p].end()); + send(pg, p, fhp_edges_size_msg, reqs.size()); + send(pg, p, fhp_add_edges_msg, &reqs[0], reqs.size()); + } + } + synchronize(pg); + + // Receive edge addition requests and handle them + while (optional > m = probe(pg)) { + assert(m->second == fhp_edges_size_msg); + std::size_t num_requests; + receive(pg, m->first, m->second, num_requests); + VertexPairVec requests(num_requests); + receive(pg, m->first, fhp_add_edges_msg, &requests[0], + num_requests); + for( std::size_t i = 0; i < requests.size(); ++i ) + add_edge( requests[i].first, requests[i].second, gr ); + } + synchronize(gr); + } + + template + typename property_traits::value_type + number_components(const Graph& g, VertexComponentMap r, ComponentMap c) + { + typedef typename boost::graph::parallel::process_group_type::type process_group_type; + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename property_traits::value_type ComponentMapType; + std::vector my_roots, all_roots; + vertex_iterator vstart, vend; + + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + if( find( my_roots.begin(), my_roots.end(), get(r, *vstart) ) == my_roots.end() ) + my_roots.push_back( get(r, *vstart) ); + + all_gather( process_group(g), my_roots.begin(), my_roots.end(), all_roots ); + + /* Number components */ + std::map comp_numbers; + ComponentMapType c_num = 0; + + // Compute component numbers + for (std::size_t i = 0; i < all_roots.size(); ++i ) + if ( comp_numbers.count(all_roots[i]) == 0 ) + comp_numbers[all_roots[i]] = c_num++; + + // Broadcast component numbers + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + put( c, *vstart, comp_numbers[get(r,*vstart)] ); + + // Broadcast number of components + if (process_id(process_group(g)) == 0) { + typedef typename process_group_type::process_size_type + process_size_type; + for (process_size_type dest = 1, n = num_processes(process_group(g)); + dest != n; ++dest) + send(process_group(g), dest, 0, c_num); + } + + synchronize(process_group(g)); + + if (process_id(process_group(g)) != 0) receive(process_group(g), 0, 0, c_num); + + synchronize(c); + return c_num; + } + + + template + typename property_traits::value_type + fleischer_hendrickson_pinar_strong_components_impl + (const Graph& g, + ComponentMap c, + VertexComponentMap r, + VertexIndexMap vertex_index_map, + incidence_graph_tag) + { + typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef iterator_property_map::iterator, + VertexIndexMap> IsoMap; + typename boost::graph::parallel::process_group_type::type pg = process_group(g); + +#ifdef PBGL_SCC_DEBUG + accounting::time_type start = accounting::get_time(); +#endif + + typedef adjacency_list::type, vecS>, + directedS > ReverseGraph; + + ReverseGraph gr(0, pg); + std::vector fr_s(num_vertices(g)); + std::vector rf_s(num_vertices(g)); + IsoMap fr(fr_s.begin(), vertex_index_map); // fr = forward->reverse + IsoMap rf(rf_s.begin(), vertex_index_map); // rf = reverse->forward + + build_reverse_graph(g, gr, fr, rf); + +#ifdef PBGL_SCC_DEBUG + accounting::time_type end = accounting::get_time(); + if(process_id(process_group(g)) == 0) + std::cerr << "Reverse graph initialization time = " << accounting::print_time(end - start) << " seconds.\n"; +#endif + + fleischer_hendrickson_pinar_strong_components(g, r, gr, fr, rf, + vertex_index_map); + + typename property_traits::value_type c_num = number_components(g, r, c); + + return c_num; + } + + template + typename property_traits::value_type + fleischer_hendrickson_pinar_strong_components_impl + (const Graph& g, + ComponentMap c, + VertexComponentMap r, + VertexIndexMap vertex_index_map, + bidirectional_graph_tag) + { + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + reverse_graph gr(g); + detail::vertex_identity_property_map fr, rf; + + fleischer_hendrickson_pinar_strong_components(g, r, gr, fr, rf, + vertex_index_map); + + typename property_traits::value_type c_num + = number_components(g, r, c); + + return c_num; + } + + template + inline typename property_traits::value_type + fleischer_hendrickson_pinar_strong_components + (const Graph& g, + ComponentMap c, + VertexIndexMap vertex_index_map) + { + typedef typename graph_traits::vertex_descriptor + vertex_descriptor; + typedef iterator_property_map::iterator, + VertexIndexMap> VertexComponentMap; + typename boost::graph::parallel::process_group_type::type pg + = process_group(g); + + if (num_processes(pg) == 1) { + local_subgraph ls(g); + return boost::strong_components(ls, c); + } + + // Create a VertexComponentMap for intermediate labeling of SCCs + std::vector r_s(num_vertices(g), graph_traits::null_vertex()); + VertexComponentMap r(r_s.begin(), vertex_index_map); + + return fleischer_hendrickson_pinar_strong_components_impl + (g, c, r, vertex_index_map, + typename graph_traits::traversal_category()); + } + + template + inline typename property_traits::value_type + fleischer_hendrickson_pinar_strong_components(const Graph& g, + ComponentMap c) + { + return fleischer_hendrickson_pinar_strong_components(g, c, get(vertex_index, g)); + } + +} // end namespace distributed + +using distributed::fleischer_hendrickson_pinar_strong_components; + +} // end namespace graph + +template +inline typename property_traits::value_type +strong_components + (const Graph& g, ComponentMap comp, + const bgl_named_params& + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, distributed_graph_tag)) +{ + return graph::fleischer_hendrickson_pinar_strong_components(g, comp); +} + +template +inline typename property_traits::value_type +strong_components + (const Graph& g, ComponentMap comp + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, distributed_graph_tag)) +{ + return graph::fleischer_hendrickson_pinar_strong_components(g, comp); +} + +} /* end namespace boost */ + +#endif // BOOST_GRAPH_DISTRIBUTED_SCC_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/two_bit_color_map.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/two_bit_color_map.hpp new file mode 100644 index 0000000000..eb8e29e3ea --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/two_bit_color_map.hpp @@ -0,0 +1,116 @@ +// Copyright (C) 2006 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 +// Jeremiah Willcock +// Andrew Lumsdaine + +// Distributed version of the two-bit color map +#ifndef BOOST_DISTRIBUTED_TWO_BIT_COLOR_MAP_HPP +#define BOOST_DISTRIBUTED_TWO_BIT_COLOR_MAP_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include + +namespace boost { + +template +class two_bit_color_map > + : public parallel::distributed_property_map > +{ + typedef two_bit_color_map local_map; + + typedef parallel::distributed_property_map + inherited; + + typedef local_property_map + index_map_type; + +public: + two_bit_color_map(std::size_t inital_size, + const index_map_type& index = index_map_type()) + : inherited(index.process_group(), index.global(), + local_map(inital_size, index.base())) { } + + inherited& base() { return *this; } + const inherited& base() const { return *this; } +}; + +template +inline two_bit_color_type +get(two_bit_color_map > + const& pm, + typename two_bit_color_map::key_type key) +{ + return get(pm.base(), key); +} + +template +inline void +put(two_bit_color_map > + const& pm, + typename two_bit_color_map::key_type key, + two_bit_color_type value) +{ + put(pm.base(), key, value); +} + +template +class two_bit_color_map > + : public parallel::distributed_property_map< + ProcessGroup, GlobalMap, two_bit_color_map > +{ + typedef two_bit_color_map local_map; + + typedef parallel::distributed_property_map + inherited; + + typedef parallel::distributed_property_map + index_map_type; + +public: + two_bit_color_map(std::size_t inital_size, + const index_map_type& index = index_map_type()) + : inherited(index.process_group(), index.global(), + local_map(inital_size, index.base())) { } + + inherited& base() { return *this; } + const inherited& base() const { return *this; } +}; + +template +inline two_bit_color_type +get(two_bit_color_map< + parallel::distributed_property_map< + ProcessGroup, GlobalMap, two_bit_color_map > > const& pm, + typename two_bit_color_map::key_type key) +{ + return get(pm.base(), key); +} + +template +inline void +put(two_bit_color_map< + parallel::distributed_property_map< + ProcessGroup, GlobalMap, two_bit_color_map > > const& pm, + typename two_bit_color_map::key_type key, + two_bit_color_type value) +{ + put(pm.base(), key, value); +} + +} // end namespace boost + +#endif // BOOST_DISTRIBUTED_TWO_BIT_COLOR_MAP_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/unsafe_serialize.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/unsafe_serialize.hpp new file mode 100644 index 0000000000..1dccef84a1 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/unsafe_serialize.hpp @@ -0,0 +1,75 @@ +// Copyright (C) 2006 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 + +// This file contains the "unsafe_serialize" routine, which transforms +// types they may not be serializable (such as void*) into +// serializable equivalents. +#ifndef PBGL_UNSAFE_SERIALIZE_HPP +#define PBGL_UNSAFE_SERIALIZE_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include + +BOOST_IS_BITWISE_SERIALIZABLE(void*) +namespace boost { namespace mpi { + template<> struct is_mpi_datatype : mpl::true_ { }; +} } // end namespace boost::mpi + +namespace boost { + typedef mpl::if_c<(sizeof(int) == sizeof(void*)), + int, + mpl::if_c<(sizeof(long) == sizeof(void*)), long, void>::type + >::type ptr_serialize_type; + + template inline T& unsafe_serialize(T& x) { return x; } + + inline ptr_serialize_type& unsafe_serialize(void*& x) + { return reinterpret_cast(x); } + + // Force Boost.MPI to serialize a void* like a ptr_serialize_type + namespace mpi { + template<> inline MPI_Datatype get_mpi_datatype(void* const& x) + { + return get_mpi_datatype(); + } + } + + template + struct unsafe_pair + { + unsafe_pair() { } + unsafe_pair(const T& t, const U& u) : first(t), second(u) { } + unsafe_pair(const std::pair& p) : first(p.first), second(p.second) { } + T first; + U second; + + template + void serialize(Archiver& ar, const unsigned /*version*/) + { + ar & unsafe_serialize(first) & unsafe_serialize(second); + } + }; + + template + bool operator<(unsafe_pair const& x, unsafe_pair const& y) + { + return std::make_pair(x.first, x.second) < + std::make_pair(y.first, y.second); + } + +} // end namespace boost + +#endif // PBGL_UNSAFE_SERIALIZE_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/vertex_list_adaptor.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/vertex_list_adaptor.hpp new file mode 100644 index 0000000000..8928479a7a --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/distributed/vertex_list_adaptor.hpp @@ -0,0 +1,403 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Douglas Gregor +// Andrew Lumsdaine + +#ifndef BOOST_VERTEX_LIST_ADAPTOR_HPP +#define BOOST_VERTEX_LIST_ADAPTOR_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless has been included" +#endif + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace graph { + +// -------------------------------------------------------------------------- +// Global index map built from a distribution +// -------------------------------------------------------------------------- +template +class distribution_global_index_map +{ + public: + typedef std::size_t value_type; + typedef value_type reference; + typedef typename property_traits::key_type key_type; + typedef readable_property_map_tag category; + + distribution_global_index_map(const Distribution& distribution, + const OwnerPropertyMap& owner, + const LocalPropertyMap& local) + : distribution_(distribution), owner(owner), local(local) { } + + Distribution distribution_; + OwnerPropertyMap owner; + LocalPropertyMap local; +}; + +template +inline +typename distribution_global_index_map::value_type +get(const distribution_global_index_map& p, + typename distribution_global_index_map::key_type x) +{ + using boost::get; + return p.distribution_.global(get(p.owner, x), get(p.local, x)); +} + +template +inline +distribution_global_index_map< + Distribution, + typename property_map::const_type, + typename property_map::const_type> +make_distribution_global_index_map(const Graph& g, const Distribution& d) +{ + typedef distribution_global_index_map< + Distribution, + typename property_map::const_type, + typename property_map::const_type> + result_type; + return result_type(d, get(vertex_owner, g), get(vertex_local, g)); +} + +// -------------------------------------------------------------------------- +// Global index map built from a distributed index map and list of vertices +// -------------------------------------------------------------------------- +template +class stored_global_index_map : public IndexMap +{ + public: + typedef readable_property_map_tag category; + + stored_global_index_map(const IndexMap& index_map) : IndexMap(index_map) { + // When we have a global index, we need to always have the indices + // of every key we've seen + this->set_max_ghost_cells(0); + } +}; + +// -------------------------------------------------------------------------- +// Global index map support code +// -------------------------------------------------------------------------- +namespace detail { + template + inline void + initialize_global_index_map(const PropertyMap&, + ForwardIterator, ForwardIterator) + { } + + template + void + initialize_global_index_map(stored_global_index_map& p, + ForwardIterator first, ForwardIterator last) + { + using std::distance; + + typedef typename property_traits::value_type size_t; + + size_t n = distance(first, last); + for (size_t i = 0; i < n; ++i, ++first) local_put(p, *first, i); + } +} + +// -------------------------------------------------------------------------- +// Adapts a Distributed Vertex List Graph to a Vertex List Graph +// -------------------------------------------------------------------------- +template +class vertex_list_adaptor : public graph_traits +{ + typedef graph_traits inherited; + + typedef typename inherited::traversal_category base_traversal_category; + + public: + typedef typename inherited::vertex_descriptor vertex_descriptor; + typedef typename std::vector::iterator vertex_iterator; + typedef typename std::vector::size_type + vertices_size_type; + + struct traversal_category + : public virtual base_traversal_category, + public virtual vertex_list_graph_tag {}; + + vertex_list_adaptor(const Graph& g, + const GlobalIndexMap& index_map = GlobalIndexMap()) + : g(&g), index_map(index_map) + { + using boost::vertices; + + all_vertices_.reset(new std::vector()); + all_gather(process_group(), vertices(g).first, vertices(g).second, + *all_vertices_); + detail::initialize_global_index_map(this->index_map, + all_vertices_->begin(), + all_vertices_->end()); + } + + const Graph& base() const { return *g; } + + // -------------------------------------------------------------------------- + // Distributed Container + // -------------------------------------------------------------------------- + typedef typename boost::graph::parallel::process_group_type::type + process_group_type; + + process_group_type process_group() const + { + using boost::graph::parallel::process_group; + return process_group(*g); + } + + std::pair vertices() const + { return std::make_pair(all_vertices_->begin(), all_vertices_->end()); } + + vertices_size_type num_vertices() const { return all_vertices_->size(); } + + GlobalIndexMap get_index_map() const { return index_map; } + + private: + const Graph* g; + GlobalIndexMap index_map; + shared_ptr > all_vertices_; +}; + +template +inline vertex_list_adaptor +make_vertex_list_adaptor(const Graph& g, const GlobalIndexMap& index_map) +{ return vertex_list_adaptor(g, index_map); } + +namespace detail { + template + class default_global_index_map + { + typedef typename graph_traits::vertices_size_type value_type; + typedef typename property_map::const_type local_map; + + public: + typedef vector_property_map distributed_map; + typedef stored_global_index_map type; + }; +} + +template +inline +vertex_list_adaptor::type> +make_vertex_list_adaptor(const Graph& g) +{ + typedef typename detail::default_global_index_map::type + GlobalIndexMap; + typedef typename detail::default_global_index_map::distributed_map + DistributedMap; + typedef vertex_list_adaptor result_type; + return result_type(g, + GlobalIndexMap(DistributedMap(num_vertices(g), + get(vertex_index, g)))); +} + +// -------------------------------------------------------------------------- +// Incidence Graph +// -------------------------------------------------------------------------- +template +inline typename vertex_list_adaptor::vertex_descriptor +source(typename vertex_list_adaptor::edge_descriptor e, + const vertex_list_adaptor& g) +{ return source(e, g.base()); } + +template +inline typename vertex_list_adaptor::vertex_descriptor +target(typename vertex_list_adaptor::edge_descriptor e, + const vertex_list_adaptor& g) +{ return target(e, g.base()); } + +template +inline +std::pair::out_edge_iterator, + typename vertex_list_adaptor::out_edge_iterator> +out_edges(typename vertex_list_adaptor::vertex_descriptor v, + const vertex_list_adaptor& g) +{ return out_edges(v, g.base()); } + +template +inline typename vertex_list_adaptor::degree_size_type +out_degree(typename vertex_list_adaptor::vertex_descriptor v, + const vertex_list_adaptor& g) +{ return out_degree(v, g.base()); } + +// -------------------------------------------------------------------------- +// Bidirectional Graph +// -------------------------------------------------------------------------- +template +inline +std::pair::in_edge_iterator, + typename vertex_list_adaptor::in_edge_iterator> +in_edges(typename vertex_list_adaptor::vertex_descriptor v, + const vertex_list_adaptor& g) +{ return in_edges(v, g.base()); } + +template +inline typename vertex_list_adaptor::degree_size_type +in_degree(typename vertex_list_adaptor::vertex_descriptor v, + const vertex_list_adaptor& g) +{ return in_degree(v, g.base()); } + +template +inline typename vertex_list_adaptor::degree_size_type +degree(typename vertex_list_adaptor::vertex_descriptor v, + const vertex_list_adaptor& g) +{ return degree(v, g.base()); } + +// -------------------------------------------------------------------------- +// Adjacency Graph +// -------------------------------------------------------------------------- +template +inline +std::pair::adjacency_iterator, + typename vertex_list_adaptor::adjacency_iterator> +adjacent_vertices(typename vertex_list_adaptor::vertex_descriptor v, + const vertex_list_adaptor& g) +{ return adjacent_vertices(v, g.base()); } + + +// -------------------------------------------------------------------------- +// Vertex List Graph +// -------------------------------------------------------------------------- +template +inline +std::pair::vertex_iterator, + typename vertex_list_adaptor::vertex_iterator> +vertices(const vertex_list_adaptor& g) +{ return g.vertices(); } + +template +inline +typename vertex_list_adaptor::vertices_size_type +num_vertices(const vertex_list_adaptor& g) +{ return g.num_vertices(); } + +// -------------------------------------------------------------------------- +// Edge List Graph +// -------------------------------------------------------------------------- +template +inline +std::pair::edge_iterator, + typename vertex_list_adaptor::edge_iterator> +edges(const vertex_list_adaptor& g) +{ return edges(g.base()); } + +template +inline +typename vertex_list_adaptor::edges_size_type +num_edges(const vertex_list_adaptor& g) +{ return num_edges(g.base()); } + +// -------------------------------------------------------------------------- +// Property Graph +// -------------------------------------------------------------------------- +template +inline typename property_map::type +get(PropertyTag p, vertex_list_adaptor& g) +{ return get(p, g.base()); } + +template +inline typename property_map::const_type +get(PropertyTag p, const vertex_list_adaptor& g) +{ return get(p, g.base()); } + +template +inline typename property_traits< + typename property_map::type + >::value_type +get(PropertyTag p, const vertex_list_adaptor& g, + typename property_traits< + typename property_map::type + >::key_type const& x) +{ return get(p, g.base(), x); } + +template +inline void +put(PropertyTag p, vertex_list_adaptor& g, + typename property_traits< + typename property_map::type + >::key_type const& x, + typename property_traits< + typename property_map::type + >::value_type const& v) +{ return put(p, g.base(), x, v); } + +// -------------------------------------------------------------------------- +// Property Graph: vertex_index property +// -------------------------------------------------------------------------- +template +inline GlobalIndexMap +get(vertex_index_t, const vertex_list_adaptor& g) +{ return g.get_index_map(); } + +template +inline typename vertex_list_adaptor::vertices_size_type +get(vertex_index_t, const vertex_list_adaptor& g, + typename vertex_list_adaptor::vertex_descriptor x) +{ return get(g.get_index_map(), x); } + +// -------------------------------------------------------------------------- +// Adjacency Matrix Graph +// -------------------------------------------------------------------------- +template +std::pair::edge_descriptor, + bool> +edge(typename vertex_list_adaptor::vertex_descriptor u, + typename vertex_list_adaptor::vertex_descriptor v, + vertex_list_adaptor& g) +{ return edge(u, v, g.base()); } + +} } // end namespace boost::graph + +namespace boost { + +// -------------------------------------------------------------------------- +// Property Graph: vertex_index property +// -------------------------------------------------------------------------- +template +class property_map > +{ +public: + typedef GlobalIndexMap type; + typedef type const_type; +}; + +template +class property_map > +{ +public: + typedef GlobalIndexMap type; + typedef type const_type; +}; + +using graph::distribution_global_index_map; +using graph::make_distribution_global_index_map; +using graph::stored_global_index_map; +using graph::make_vertex_list_adaptor; +using graph::vertex_list_adaptor; + +} // end namespace boost + +#endif // BOOST_VERTEX_LIST_ADAPTOR_HPP diff --git a/deal.II/contrib/boost/include/boost/graph/dominator_tree.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/dominator_tree.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/graph/dominator_tree.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/dominator_tree.hpp index bb34bbe96a..cf0d310ef8 100644 --- a/deal.II/contrib/boost/include/boost/graph/dominator_tree.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/dominator_tree.hpp @@ -1,11 +1,11 @@ //======================================================================= -// Copyright (C) 2005 Jong Soo Park +// Copyright (C) 2005-2009 Jongsoo 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 @@ -14,6 +14,8 @@ #include #include +// Dominator tree computation + namespace boost { namespace detail { /** @@ -26,13 +28,13 @@ namespace boost { { public : typedef Tag event_filter; - time_stamper_with_vertex_vector(TimeMap timeMap, VertexVector& v, + 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, + void + operator()(const typename property_traits::key_type& v, const Graph& g) { timeStamper_(v, g); @@ -52,7 +54,7 @@ namespace boost { stamp_times_with_vertex_vector(TimeMap timeMap, VertexVector& v, TimeT& t, Tag) { - return time_stamper_with_vertex_vector(timeMap, v, t); } @@ -76,29 +78,29 @@ namespace boost { ancestor_(num_vertices(g), graph_traits::null_vertex()), samedom_(ancestor_), best_(semi_), - semiMap_(make_iterator_property_map(semi_.begin(), + semiMap_(make_iterator_property_map(semi_.begin(), get(vertex_index, g))), - ancestorMap_(make_iterator_property_map(ancestor_.begin(), + ancestorMap_(make_iterator_property_map(ancestor_.begin(), get(vertex_index, g))), - bestMap_(make_iterator_property_map(best_.begin(), + bestMap_(make_iterator_property_map(best_.begin(), get(vertex_index, g))), buckets_(num_vertices(g)), - bucketMap_(make_iterator_property_map(buckets_.begin(), + bucketMap_(make_iterator_property_map(buckets_.begin(), get(vertex_index, g))), entry_(entry), domTreePredMap_(domTreePredMap), - samedomMap(make_iterator_property_map(samedom_.begin(), + numOfVertices_(num_vertices(g)), + samedomMap(make_iterator_property_map(samedom_.begin(), get(vertex_index, g))) { } - - void - operator()(const Vertex& n, const TimeMap& dfnumMap, + + 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); @@ -113,14 +115,14 @@ namespace boost { // 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) + if (get(dfnumMap, v) < 0 || get(dfnumMap, v) >= numOfVertices_) continue; Vertex s2; @@ -147,7 +149,7 @@ namespace boost { // * 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; @@ -171,7 +173,7 @@ namespace boost { /** * Evaluate function in Tarjan's path compression */ - const Vertex + const Vertex ancestor_with_lowest_semi_(const Vertex& v, const TimeMap& dfnumMap) { const Vertex a(get(ancestorMap_, v)); @@ -199,9 +201,10 @@ namespace boost { const Vertex& entry_; DomTreePredMap domTreePredMap_; + const VerticesSizeType numOfVertices_; public : - + PredMap samedomMap; }; @@ -219,7 +222,7 @@ namespace boost { * 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) * @@ -227,7 +230,7 @@ namespace boost { * * @todo : Optimization in Finding Dominators in Practice, Loukas Georgiadis */ - template void lengauer_tarjan_dominator_tree_without_dfs @@ -274,7 +277,7 @@ namespace boost { } } } - + /** * Unlike lengauer_tarjan_dominator_tree_without_dfs, * dfs is run in this function and @@ -283,7 +286,7 @@ namespace boost { * If the result of dfs required after this algorithm, * this function can eliminate the need of rerunning dfs. */ - template void lengauer_tarjan_dominator_tree @@ -304,7 +307,7 @@ namespace boost { VerticesSizeType time = (std::numeric_limits::max)(); - std::vector + std::vector colors(numOfVertices, color_traits::white()); depth_first_visit (g, entry, @@ -315,8 +318,8 @@ namespace boost { make_iterator_property_map(colors.begin(), indexMap)); // 2. Run main algorithm. - lengauer_tarjan_dominator_tree_without_dfs(g, entry, indexMap, dfnumMap, - parentMap, verticesByDFNum, + lengauer_tarjan_dominator_tree_without_dfs(g, entry, indexMap, dfnumMap, + parentMap, verticesByDFNum, domTreePredMap); } @@ -353,7 +356,7 @@ namespace boost { std::vector dfnum(numOfVertices, 0); TimeMap dfnumMap(make_iterator_property_map(dfnum.begin(), indexMap)); - std::vector parent(numOfVertices, + std::vector parent(numOfVertices, graph_traits::null_vertex()); PredMap parentMap(make_iterator_property_map(parent.begin(), indexMap)); @@ -361,7 +364,7 @@ namespace boost { // Run main algorithm lengauer_tarjan_dominator_tree(g, entry, - indexMap, dfnumMap, parentMap, + indexMap, dfnumMap, parentMap, verticesByDFNum, domTreePredMap); } @@ -397,7 +400,7 @@ namespace boost { 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(); @@ -411,15 +414,15 @@ namespace boost { 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(), + std::set_intersection(T.begin(), T.end(), + get(domMap, p).begin(), get(domMap, p).end(), std::inserter(tempSet, tempSet.begin())); T.swap(tempSet); @@ -480,7 +483,7 @@ namespace boost { { typename property_map::const_type indexMap = get(vertex_index, g); - + iterative_bit_vector_dominator_tree(g, entry, indexMap, domTreePredMap); } } // namespace boost diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/eccentricity.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/eccentricity.hpp new file mode 100644 index 0000000000..4d4ddbc4d3 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/eccentricity.hpp @@ -0,0 +1,111 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_ECCENTRICITY_HPP +#define BOOST_GRAPH_ECCENTRICITY_HPP + +#include +#include +#include + +namespace boost +{ +template +inline typename property_traits::value_type +eccentricity(const Graph& g, DistanceMap dist, Combinator combine) +{ + function_requires< GraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type Distance; + + return detail::combine_distances(g, dist, combine, Distance(0)); +} + +template +inline typename property_traits::value_type +eccentricity(const Graph& g, DistanceMap dist) +{ + function_requires< GraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type Distance; + + return eccentricity(g, dist, detail::maximize()); +} + +template +inline std::pair::value_type, + typename property_traits::value_type> +all_eccentricities(const Graph& g, const DistanceMatrix& dist, EccentricityMap ecc) +{ + function_requires< VertexListGraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertex_iterator VertexIterator; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type DistanceMap; + function_requires< WritablePropertyMapConcept >(); + typedef typename property_traits::value_type Eccentricity; + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); + + Eccentricity + r = numeric_values::infinity(), + d = numeric_values::zero(); + VertexIterator i, end; + tie(i, end) = vertices(g); + for(tie(i, end) = vertices(g); i != end; ++i) { + DistanceMap dm = get(dist, *i); + Eccentricity e = eccentricity(g, dm); + put(ecc, *i, e); + + // track the radius and diameter at the same time + r = min BOOST_PREVENT_MACRO_SUBSTITUTION (r, e); + d = max BOOST_PREVENT_MACRO_SUBSTITUTION (d, e); + } + return make_pair(r, d); +} + +template +inline std::pair::value_type, + typename property_traits::value_type> +radius_and_diameter(const Graph& g, EccentricityMap ecc) +{ + function_requires< VertexListGraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertex_iterator VertexIterator; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type Eccentricity; + + VertexIterator i, end; + tie(i, end) = vertices(g); + Eccentricity radius = get(ecc, *i); + Eccentricity diameter = get(ecc, *i); + for(i = boost::next(i); i != end; ++i) { + Eccentricity cur = get(ecc, *i); + radius = min BOOST_PREVENT_MACRO_SUBSTITUTION (radius, cur); + diameter = max BOOST_PREVENT_MACRO_SUBSTITUTION (diameter, cur); + } + return std::make_pair(radius, diameter); +} + + +template +inline typename property_traits::value_type +radius(const Graph& g, EccentricityMap ecc) +{ return radius_and_diameter(g, ecc).first; } + + +template +inline typename property_traits::value_type +diameter(const Graph& g, EccentricityMap ecc) +{ return radius_and_diameter(g, ecc).second; } + +} /* namespace boost */ + +#endif diff --git a/deal.II/contrib/boost/include/boost/graph/edge_connectivity.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/edge_connectivity.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/graph/edge_connectivity.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/edge_connectivity.hpp index d78e3ee41a..383ad6351e 100644 --- a/deal.II/contrib/boost/include/boost/graph/edge_connectivity.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/edge_connectivity.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include namespace boost { @@ -132,14 +132,15 @@ namespace boost { detail::neighbors(g, S.begin(), S.end(), std::inserter(neighbor_S, neighbor_S.begin())); - std::set_difference(vertices(g).first, vertices(g).second, + tie(vi, vi_end) = vertices(g); + std::set_difference(vi, vi_end, 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 + alpha_S_k = edmonds_karp_max_flow (flow_g, p, k, cap, res_cap, rev_edge, &color[0], &pred[0]); if (alpha_S_k < alpha_star) { @@ -153,7 +154,8 @@ namespace boost { 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, + tie(vi, vi_end) = vertices(g); + std::set_difference(vi, vi_end, neighbor_S.begin(), neighbor_S.end(), std::back_inserter(non_neighbor_S)); } diff --git a/deal.II/contrib/boost/include/boost/graph/edge_list.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/edge_list.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/edge_list.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/edge_list.hpp diff --git a/deal.II/contrib/boost/include/boost/graph/edmunds_karp_max_flow.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/edmonds_karp_max_flow.hpp similarity index 91% rename from deal.II/contrib/boost/include/boost/graph/edmunds_karp_max_flow.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/edmonds_karp_max_flow.hpp index ddb49dc6d6..fed4d69fbe 100644 --- a/deal.II/contrib/boost/include/boost/graph/edmunds_karp_max_flow.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/edmonds_karp_max_flow.hpp @@ -7,15 +7,15 @@ // http://www.boost.org/LICENSE_1_0.txt) //======================================================================= -#ifndef EDMUNDS_KARP_MAX_FLOW_HPP -#define EDMUNDS_KARP_MAX_FLOW_HPP +#ifndef EDMONDS_KARP_MAX_FLOW_HPP +#define EDMONDS_KARP_MAX_FLOW_HPP #include #include #include // for std::min and std::max #include #include -#include +#include #include #include #include @@ -25,7 +25,7 @@ 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. + // Edmonds-Karp algorithm. This solves the maximum flow problem. namespace detail { @@ -76,7 +76,7 @@ namespace boost { class CapacityEdgeMap, class ResidualCapacityEdgeMap, class ReverseEdgeMap, class ColorMap, class PredEdgeMap> typename property_traits::value_type - edmunds_karp_max_flow + edmonds_karp_max_flow (Graph& g, typename graph_traits::vertex_descriptor src, typename graph_traits::vertex_descriptor sink, @@ -111,7 +111,7 @@ namespace boost { for (tie(ei, e_end) = out_edges(src, g); ei != e_end; ++ei) flow += (cap[*ei] - res[*ei]); return flow; - } // edmunds_karp_max_flow() + } // edmonds_karp_max_flow() namespace detail { //------------------------------------------------------------------------- @@ -119,7 +119,7 @@ namespace boost { // use of class here is a VC++ workaround template - struct edmunds_karp_dispatch2 { + struct edmonds_karp_dispatch2 { template static typename edge_capacity_value::type apply @@ -130,7 +130,7 @@ namespace boost { const bgl_named_params& params, ColorMap color) { - return edmunds_karp_max_flow + return edmonds_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), @@ -140,7 +140,7 @@ namespace boost { } }; template<> - struct edmunds_karp_dispatch2 { + struct edmonds_karp_dispatch2 { template static typename edge_capacity_value::type apply @@ -156,7 +156,7 @@ namespace boost { 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 + return edmonds_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), @@ -174,7 +174,7 @@ namespace boost { // use of class here is a VC++ workaround template - struct edmunds_karp_dispatch1 { + struct edmonds_karp_dispatch1 { template static typename edge_capacity_value::type apply(Graph& g, @@ -184,12 +184,12 @@ namespace boost { PredMap pred) { typedef typename property_value< bgl_named_params, vertex_color_t>::type C; - return edmunds_karp_dispatch2::apply + return edmonds_karp_dispatch2::apply (g, src, sink, pred, params, get_param(params, vertex_color)); } }; template<> - struct edmunds_karp_dispatch1 { + struct edmonds_karp_dispatch1 { template static typename edge_capacity_value::type @@ -207,7 +207,7 @@ namespace boost { std::vector pred_vec(n); typedef typename property_value< bgl_named_params, vertex_color_t>::type C; - return edmunds_karp_dispatch2::apply + return edmonds_karp_dispatch2::apply (g, src, sink, make_iterator_property_map(pred_vec.begin(), choose_const_pmap (get_param(params, vertex_index), @@ -221,14 +221,14 @@ namespace boost { template typename detail::edge_capacity_value::type - edmunds_karp_max_flow + edmonds_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 + return detail::edmonds_karp_dispatch1::apply (g, src, sink, params, get_param(params, vertex_predecessor)); } @@ -236,15 +236,15 @@ namespace boost { typename property_traits< typename property_map::const_type >::value_type - edmunds_karp_max_flow + edmonds_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); + return edmonds_karp_max_flow(g, src, sink, params); } } // namespace boost -#endif // EDMUNDS_KARP_MAX_FLOW_HPP +#endif // EDMONDS_KARP_MAX_FLOW_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/edmunds_karp_max_flow.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/edmunds_karp_max_flow.hpp new file mode 100644 index 0000000000..3697db2080 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/edmunds_karp_max_flow.hpp @@ -0,0 +1,19 @@ +//======================================================================= +// (c) Copyright Juergen Hunold 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) +//======================================================================= + +#ifndef BOOST_DEPRECATED_INCLUDE_EDMONDS_KARP_MAX_FLOW_HPP +#define BOOST_DEPRECATED_INCLUDE_EDMONDS_KARP_MAX_FLOW_HPP + +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +# pragma message ("Warning: This header is deprecated. Please use: boost/graph/edmonds_karp_max_flow.hpp") +#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) +# warning "This header is deprecated. Please use: boost/graph/edmonds_karp_max_flow.hpp" +#endif + +#include + +#endif // BOOST_DEPRECATED_INCLUDE_EDMONDS_KARP_MAX_FLOW_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/erdos_renyi_generator.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/erdos_renyi_generator.hpp new file mode 100644 index 0000000000..a459441683 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/erdos_renyi_generator.hpp @@ -0,0 +1,195 @@ +// 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 +#include + +namespace boost { + + template + class erdos_renyi_iterator + : public iterator_facade< + erdos_renyi_iterator, + std::pair::vertices_size_type, + typename graph_traits::vertices_size_type>, + std::input_iterator_tag, + const + std::pair::vertices_size_type, + typename graph_traits::vertices_size_type>&> + { + 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_of::value)); + + public: + 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(); + } + + const std::pair& + dereference() const { return current; } + + void increment() { + --edges; + next(); + } + + bool equal(const erdos_renyi_iterator& other) const + { return edges == other.edges; } + + 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; + std::pair current; + }; + + template + class sorted_erdos_renyi_iterator + : public iterator_facade< + sorted_erdos_renyi_iterator, + std::pair::vertices_size_type, + typename graph_traits::vertices_size_type>, + std::input_iterator_tag, + const + std::pair::vertices_size_type, + typename graph_traits::vertices_size_type>&> + { + 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_of::value)); + + public: + sorted_erdos_renyi_iterator() + : gen(), rand_vertex(0.5), n(0), allow_self_loops(false) + , src((std::numeric_limits::max)()), + tgt_index(vertices_size_type(-1)), prob(.5) + { } + + // NOTE: The default probability has been changed to be the same as that + // used by the geometic distribution. It was previously 0.0, which would + // cause an assertion. + sorted_erdos_renyi_iterator(RandomGenerator& gen, vertices_size_type n, + double prob = 0.5, + bool loops = false) + : gen(), rand_vertex(1. - prob), n(n), allow_self_loops(loops), src(0) + , tgt_index(vertices_size_type(-1)), prob(prob) + { + this->gen.reset(new uniform_01(&gen)); + + if (prob == 0.0) {src = (std::numeric_limits::max)(); return;} + next(); + } + + const std::pair& + dereference() const { + return current; + } + + bool equal(const sorted_erdos_renyi_iterator& o) const { + return src == o.src && tgt_index == o.tgt_index; + } + + void increment() { + next(); + } + + private: + void next() + { + // 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_index) pair. Because of + // the O(|V|^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. + assert (src != (std::numeric_limits::max)() && + src != n); + while (src != n) { + vertices_size_type increment = rand_vertex(*gen); + size_t tgt_index_limit = + (is_undirected ? src + 1 : n) + + (allow_self_loops ? 0 : -1); + if (tgt_index + increment >= tgt_index_limit) { + // Overflowed this source; go to the next one and try again. + ++src; + // This bias is because the geometric distribution always returns + // values >=1, and we want to allow 0 as a valid target. + tgt_index = vertices_size_type(-1); + continue; + } else { + tgt_index += increment; + current.first = src; + current.second = + tgt_index + + (!allow_self_loops && !is_undirected && tgt_index >= src ? 1 : 0); + break; + } + } + if (src == n) src = (std::numeric_limits::max)(); + } + + shared_ptr > gen; + geometric_distribution rand_vertex; + vertices_size_type n; + bool allow_self_loops; + vertices_size_type src, tgt_index; + std::pair current; + double prob; + }; + +} // end namespace boost + +#endif // BOOST_GRAPH_ERDOS_RENYI_GENERATOR_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/exception.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/exception.hpp new file mode 100644 index 0000000000..382d671928 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/exception.hpp @@ -0,0 +1,55 @@ +//======================================================================= +// 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.") + { } + }; + + struct not_complete : public bad_graph { + not_complete() + : bad_graph("The graph must be complete.") + { } + }; + +} // namespace boost + +#endif // BOOST_GRAPH_EXCEPTION_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/exterior_property.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/exterior_property.hpp new file mode 100644 index 0000000000..af6df8180b --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/exterior_property.hpp @@ -0,0 +1,117 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_EXTERIOR_PROPERTY_HPP +#define BOOST_GRAPH_EXTERIOR_PROPERTY_HPP + +#include +#include +#include + +namespace boost { +namespace detail { + // The vector matrix provides a little abstraction over vector + // types that makes matrices easier to work with. Note that it's + // non-copyable, meaning you should be passing it by value. + template + struct vector_matrix + { + typedef std::vector container_type; + typedef std::vector matrix_type; + + typedef container_type value_type; + typedef container_type& reference; + typedef const container_type const_reference; + typedef container_type* pointer; + typedef typename matrix_type::size_type size_type; + + // Instantiate the matrix over n elements (creates an nxn matrix). + // The graph has to be passed in order to ensure the index maps + // are constructed correctly when returning indexible elements. + inline vector_matrix(size_type n) + : m_matrix(n, container_type(n)) + { } + + inline reference operator [](size_type n) + { return m_matrix[n]; } + + inline const_reference operator [](size_type n) const + { return m_matrix[n]; } + + matrix_type m_matrix; + }; +} /* namespace detail */ + +/** + * The exterior_property metafunction defines an appropriate set of types for + * creating an exterior property. An exterior property is comprised of a both + * a container and a property map that acts as its abstraction. An extension + * of this metafunction will select an appropriate "matrix" property that + * records values for pairs of vertices. + * + * @todo This does not currently support the ability to define exterior + * properties for graph types that do not model the IndexGraph concepts. A + * solution should not be especially difficult, but will require an extension + * of type traits to affect the type selection. + */ +template +struct exterior_property +{ + typedef Key key_type; + typedef Value value_type; + + typedef std::vector container_type; + typedef container_property_map map_type; + + typedef detail::vector_matrix matrix_type; + typedef matrix_property_map matrix_map_type; + +private: + exterior_property() { } + exterior_property(const exterior_property&) { } +}; + +/** + * Define a the container and property map types requried to create an exterior + * vertex property for the given value type. The Graph parameter is required to + * model the VertexIndexGraph concept. + */ +template +struct exterior_vertex_property +{ + typedef exterior_property< + Graph, typename graph_traits::vertex_descriptor, Value + > property_type; + typedef typename property_type::key_type key_type; + typedef typename property_type::value_type value_type; + typedef typename property_type::container_type container_type; + typedef typename property_type::map_type map_type; + typedef typename property_type::matrix_type matrix_type; + typedef typename property_type::matrix_map_type matrix_map_type; +}; + +/** + * Define a the container and property map types requried to create an exterior + * edge property for the given value type. The Graph parameter is required to + * model the EdgeIndexGraph concept. + */ +template +struct exterior_edge_property +{ + typedef exterior_property< + Graph, typename graph_traits::edge_descriptor, Value + > property_type; + typedef typename property_type::key_type key_type; + typedef typename property_type::value_type value_type; + typedef typename property_type::container_type container_type; + typedef typename property_type::map_type map_type; + typedef typename property_type::matrix_type matrix_type; + typedef typename property_type::matrix_map_type matrix_map_type; +}; + +} /* namespace boost */ + +#endif diff --git a/deal.II/contrib/boost/include/boost/graph/filtered_graph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/filtered_graph.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/graph/filtered_graph.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/filtered_graph.hpp index 2a30a7127c..94b634dff2 100644 --- a/deal.II/contrib/boost/include/boost/graph/filtered_graph.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/filtered_graph.hpp @@ -500,6 +500,23 @@ namespace boost { return Filter(g, keep_all(), p); } + // Filter that uses a property map whose value_type is a boolean + template + struct property_map_filter { + + property_map_filter() { } + + property_map_filter(const PropertyMap& property_map) : + m_property_map(property_map) { } + + template + bool operator()(const Key& key) const { + return (get(m_property_map, key)); + } + + private : + PropertyMap m_property_map; + }; } // namespace boost diff --git a/deal.II/contrib/boost/include/boost/graph/floyd_warshall_shortest.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/floyd_warshall_shortest.hpp similarity index 95% rename from deal.II/contrib/boost/include/boost/graph/floyd_warshall_shortest.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/floyd_warshall_shortest.hpp index 6204ca0e32..d57f13c1ec 100644 --- a/deal.II/contrib/boost/include/boost/graph/floyd_warshall_shortest.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/floyd_warshall_shortest.hpp @@ -29,7 +29,7 @@ #ifndef BOOST_GRAPH_FLOYD_WARSHALL_HPP #define BOOST_GRAPH_FLOYD_WARSHALL_HPP -#include +#include #include #include #include @@ -59,13 +59,13 @@ namespace boost 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); + 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++) diff --git a/deal.II/contrib/boost/include/boost/graph/fruchterman_reingold.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/fruchterman_reingold.hpp similarity index 52% rename from deal.II/contrib/boost/include/boost/graph/fruchterman_reingold.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/fruchterman_reingold.hpp index f5ea6af7b3..0da35167c3 100644 --- a/deal.II/contrib/boost/include/boost/graph/fruchterman_reingold.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/fruchterman_reingold.hpp @@ -1,4 +1,4 @@ -// Copyright 2004 The Trustees of Indiana University. +// 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 @@ -12,10 +12,14 @@ #include #include #include -#include +#include +#include // For topology concepts #include #include #include // for std::min and std::max +#include // for std::accumulate +#include // for std::sqrt and std::fabs +#include namespace boost { @@ -84,18 +88,20 @@ struct all_force_pairs } }; -template +template struct grid_force_pairs { + typedef typename property_traits::value_type Point; + BOOST_STATIC_ASSERT (Point::dimensions == 2); + typedef typename Topology::point_difference_type point_difference_type; + template explicit - grid_force_pairs(Dim width, Dim height, PositionMap position, const Graph& g) - : width(width), height(height), position(position) + grid_force_pairs(const Topology& topology, + PositionMap position, const Graph& g) + : topology(topology), 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)); + two_k = 2. * this->topology.volume(this->topology.extent()) / std::sqrt((double)num_vertices(g)); } template @@ -106,13 +112,15 @@ struct grid_force_pairs 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)); + std::size_t columns = std::size_t(topology.extent()[0] / two_k + 1.); + std::size_t rows = std::size_t(topology.extent()[1] / two_k + 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); + std::size_t column = + std::size_t((get(position, *v)[0] + topology.extent()[0] / 2) / two_k); + std::size_t row = + std::size_t((get(position, *v)[1] + topology.extent()[1] / 2) / two_k); if (column >= columns) column = columns - 1; if (row >= rows) row = rows - 1; @@ -137,146 +145,162 @@ struct grid_force_pairs 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; + 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 + bucket_t& other_bucket = buckets[other_row * columns + other_column]; - for (v = other_bucket.begin(); v != other_bucket.end(); ++v) - apply_force(*u, *v); + for (v = other_bucket.begin(); v != other_bucket.end(); ++v) { + double dist = + topology.distance(get(position, *u), get(position, *v)); + if (dist < two_k) apply_force(*u, *v); + } } } } } private: - Dim width; - Dim height; + const Topology& topology; PositionMap position; - Dim two_k; + double 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 +inline grid_force_pairs +make_grid_force_pairs + (const Topology& topology, + const PositionMap& position, const Graph& g) +{ return grid_force_pairs(topology, position, g); } -template +template void -scale_graph(const Graph& g, PositionMap position, - Dim left, Dim top, Dim right, Dim bottom) +scale_graph(const Graph& g, PositionMap position, const Topology& topology, + typename Topology::point_type upper_left, typename Topology::point_type lower_right) { if (num_vertices(g) == 0) return; - if (bottom > top) { - using std::swap; - swap(bottom, top); - } - - typedef typename graph_traits::vertex_iterator vertex_iterator; + typedef typename Topology::point_type Point; + typedef typename Topology::point_difference_type point_difference_type; // 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); + Point min_point = get(position, *vertices(g).first), max_point = min_point; + BGL_FORALL_VERTICES_T(v, g, Graph) { + min_point = topology.pointwise_min(min_point, get(position, v)); + max_point = topology.pointwise_max(max_point, get(position, v)); } + Point old_origin = topology.move_position_toward(min_point, 0.5, max_point); + Point new_origin = topology.move_position_toward(upper_left, 0.5, lower_right); + point_difference_type old_size = topology.difference(max_point, min_point); + point_difference_type new_size = topology.difference(lower_right, upper_left); + // 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; + BGL_FORALL_VERTICES_T(v, g, Graph) { + point_difference_type relative_loc = topology.difference(get(position, v), old_origin); + relative_loc = (relative_loc / old_size) * new_size; + put(position, v, topology.adjust(new_origin, relative_loc)); } } namespace detail { - template + template + void + maybe_jitter_point(const Topology& topology, + const PropMap& pm, Vertex v, + const typename Topology::point_type& p2) + { + double too_close = topology.norm(topology.extent()) / 10000.; + if (topology.distance(get(pm, v), p2) < too_close) { + put(pm, v, + topology.move_position_toward(get(pm, v), 1./200, + topology.random_point())); + } + } + + template struct fr_apply_force { typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename Topology::point_type Point; + typedef typename Topology::point_difference_type PointDiff; - fr_apply_force(const PositionMap& position, + fr_apply_force(const Topology& topology, + const PositionMap& position, const DisplacementMap& displacement, - RepulsiveForce repulsive_force, Dim k, const Graph& g) - : position(position), displacement(displacement), + RepulsiveForce repulsive_force, double k, const Graph& g) + : topology(topology), 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; + // When the vertices land on top of each other, move the + // first vertex away from the boundaries. + maybe_jitter_point(topology, position, u, get(position, v)); + + double dist = topology.distance(get(position, u), get(position, v)); + typename Topology::point_difference_type dispv = get(displacement, v); + if (dist == 0.) { + for (std::size_t i = 0; i < Point::dimensions; ++i) { + dispv[i] += 0.01; + } + } else { + double fr = repulsive_force(u, v, k, dist, g); + dispv += (fr / dist) * + topology.difference(get(position, v), get(position, u)); + } + put(displacement, v, dispv); } } private: + const Topology& topology; PositionMap position; DisplacementMap displacement; RepulsiveForce repulsive_force; - Dim k; + double k; const Graph& g; }; } // end namespace detail -template void fruchterman_reingold_force_directed_layout (const Graph& g, PositionMap position, - Dim width, - Dim height, + const Topology& topology, AttractiveForce attractive_force, RepulsiveForce repulsive_force, ForcePairs force_pairs, Cooling cool, DisplacementMap displacement) { + typedef typename Topology::point_type Point; 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 + double volume = topology.volume(topology.extent()); - Dim area = width * height; // assume positions are initialized randomly - Dim k = sqrt(area / num_vertices(g)); + double k = pow(volume / num_vertices(g), 1. / (double)(Topology::point_difference_type::dimensions)); - detail::fr_apply_force - apply_force(position, displacement, repulsive_force, k, g); + detail::fr_apply_force + apply_force(topology, position, displacement, repulsive_force, k, g); - Dim temp = cool(); - if (temp) do { + 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; - } + for (tie(v, v_end) = vertices(g); v != v_end; ++v) + put(displacement, *v, typename Topology::point_difference_type()); force_pairs(g, apply_force); // Calculate attractive forces @@ -284,52 +308,47 @@ fruchterman_reingold_force_directed_layout 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; + + // When the vertices land on top of each other, move the + // first vertex away from the boundaries. + ::boost::detail::maybe_jitter_point(topology, position, u, get(position, v)); + + typename Topology::point_difference_type delta = + topology.difference(get(position, v), get(position, u)); + double dist = topology.distance(get(position, u), get(position, v)); + double fa = attractive_force(*e, k, dist, g); + + put(displacement, v, get(displacement, v) - (fa / dist) * delta); + put(displacement, u, get(displacement, u) + (fa / dist) * delta); } - // 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)); + if (double temp = cool()) { + // Update positions + BGL_FORALL_VERTICES_T (v, g, Graph) { + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); + double disp_size = topology.norm(get(displacement, v)); + put(position, v, topology.adjust(get(position, v), get(displacement, v) * (min BOOST_PREVENT_MACRO_SUBSTITUTION (disp_size, temp) / disp_size))); + put(position, v, topology.bound(get(position, v))); + } + } else { + break; } - } while (temp = cool()); + } while (true); } namespace detail { template struct fr_force_directed_layout { - template static void run(const Graph& g, PositionMap position, - Dim width, - Dim height, + const Topology& topology, AttractiveForce attractive_force, RepulsiveForce repulsive_force, ForcePairs force_pairs, @@ -338,7 +357,7 @@ namespace detail { const bgl_named_params&) { fruchterman_reingold_force_directed_layout - (g, position, width, height, attractive_force, repulsive_force, + (g, position, topology, attractive_force, repulsive_force, force_pairs, cool, displacement); } }; @@ -346,15 +365,14 @@ namespace detail { template<> struct fr_force_directed_layout { - template static void run(const Graph& g, PositionMap position, - Dim width, - Dim height, + const Topology& topology, AttractiveForce attractive_force, RepulsiveForce repulsive_force, ForcePairs force_pairs, @@ -362,59 +380,63 @@ namespace detail { error_property_not_found, const bgl_named_params& params) { - std::vector > displacements(num_vertices(g)); + typedef typename Topology::point_difference_type PointDiff; + std::vector displacements(num_vertices(g)); fruchterman_reingold_force_directed_layout - (g, position, width, height, attractive_force, repulsive_force, + (g, position, topology, 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())); + PointDiff())); } }; } // end namespace detail -template void fruchterman_reingold_force_directed_layout (const Graph& g, PositionMap position, - Dim width, - Dim height, + const Topology& topology, const bgl_named_params& params) { typedef typename property_value, vertex_displacement_t>::type D; detail::fr_force_directed_layout::run - (g, position, width, height, + (g, position, topology, 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)), + make_grid_force_pairs(topology, position, g)), choose_param(get_param(params, cooling_t()), - linear_cooling(100)), + linear_cooling(100)), get_param(params, vertex_displacement_t()), params); } -template +template void -fruchterman_reingold_force_directed_layout(const Graph& g, - PositionMap position, - Dim width, - Dim height) +fruchterman_reingold_force_directed_layout + (const Graph& g, + PositionMap position, + const Topology& topology) { fruchterman_reingold_force_directed_layout - (g, position, width, height, + (g, position, topology, attractive_force(square_distance_attractive_force())); } } // end namespace boost +#ifdef BOOST_GRAPH_USE_MPI +# include +#endif + #endif // BOOST_GRAPH_FRUCHTERMAN_REINGOLD_FORCE_DIRECTED_LAYOUT_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/geodesic_distance.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/geodesic_distance.hpp new file mode 100644 index 0000000000..042d39e40f --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/geodesic_distance.hpp @@ -0,0 +1,210 @@ +// (C) Copyright Andrew Sutton 2007 +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_GEODESIC_DISTANCE_HPP +#define BOOST_GRAPH_GEODESIC_DISTANCE_HPP + +#include +#include + +namespace boost +{ +template > +struct mean_geodesic_measure + : public geodesic_measure +{ + typedef geodesic_measure base_type; + typedef typename base_type::distance_type distance_type; + typedef typename base_type::result_type result_type; + + result_type operator ()(distance_type d, const Graph& g) + { + function_requires< VertexListGraphConcept >(); + function_requires< NumericValueConcept >(); + function_requires< NumericValueConcept >(); + function_requires< AdaptableBinaryFunctionConcept >(); + + return (d == base_type::infinite_distance()) + ? base_type::infinite_result() + : div(result_type(d), result_type(num_vertices(g) - 1)); + } + Divides div; +}; + +template +inline mean_geodesic_measure::value_type, double> +measure_mean_geodesic(const Graph&, DistanceMap) +{ + return mean_geodesic_measure::value_type, double>(); +} + +template +inline mean_geodesic_measure::value_type, T> +measure_mean_geodesic(const Graph&, DistanceMap) +{ + return mean_geodesic_measure::value_type, T>(); +} + +// This is a little different because it's expected that the result type +// should (must?) be the same as the distance type. There's a type of +// transitivity in this thinking... If the average of distances has type +// X then the average of x's should also be type X. Is there a case where this +// is not true? +// +// This type is a little under-genericized... It needs generic parameters +// for addition and division. +template +struct mean_graph_distance_measure + : public geodesic_measure +{ + typedef geodesic_measure base_type; + typedef typename base_type::distance_type distance_type; + typedef typename base_type::result_type result_type; + + inline result_type operator ()(distance_type d, const Graph& g) + { + function_requires< VertexListGraphConcept >(); + function_requires< NumericValueConcept >(); + + if(d == base_type::infinite_distance()) { + return base_type::infinite_result(); + } + else { + return d / result_type(num_vertices(g)); + } + } +}; + +template +inline mean_graph_distance_measure::value_type> +measure_graph_mean_geodesic(const Graph& g, DistanceMap dist) +{ + typedef typename property_traits::value_type T; + return mean_graph_distance_measure(); +} + +template +inline typename Measure::result_type +mean_geodesic(const Graph& g, + DistanceMap dist, + Measure measure, + Combinator combine) +{ + function_requires< DistanceMeasureConcept >(); + typedef typename Measure::distance_type Distance; + + Distance n = detail::combine_distances(g, dist, combine, Distance(0)); + return measure(n, g); +} + +template +inline typename Measure::result_type +mean_geodesic(const Graph& g, DistanceMap dist, Measure measure) +{ + function_requires< DistanceMeasureConcept >(); + typedef typename Measure::distance_type Distance; + + return mean_geodesic(g, dist, measure, std::plus()); +} + +template +inline double +mean_geodesic(const Graph& g, DistanceMap dist) +{ return mean_geodesic(g, dist, measure_mean_geodesic(g, dist)); } + +template +inline T +mean_geodesic(const Graph& g, DistanceMap dist) +{ return mean_geodesic(g, dist, measure_mean_geodesic(g, dist)); } + + +template +inline typename property_traits::value_type +all_mean_geodesics(const Graph& g, + DistanceMatrixMap dist, + GeodesicMap geo, + Measure measure) +{ + function_requires< VertexListGraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename graph_traits::vertex_iterator VertexIterator; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type DistanceMap; + function_requires< DistanceMeasureConcept >(); + typedef typename Measure::result_type Result; + function_requires< WritablePropertyMapConcept >(); + function_requires< NumericValueConcept >(); + + // NOTE: We could compute the mean geodesic here by performing additional + // computations (i.e., adding and dividing). However, I don't really feel + // like fully genericizing the entire operation yet so I'm not going to. + + Result inf = numeric_values::infinity(); + Result sum = numeric_values::zero(); + VertexIterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + DistanceMap dm = get(dist, *i); + Result r = mean_geodesic(g, dm, measure); + put(geo, *i, r); + + // compute the sum along with geodesics + if(r == inf) { + sum = inf; + } + else if(sum != inf) { + sum += r; + } + } + + // return the average of averages. + return sum / Result(num_vertices(g)); +} + +template +inline typename property_traits::value_type +all_mean_geodesics(const Graph& g, DistanceMatrixMap dist, GeodesicMap geo) +{ + function_requires< GraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept >(); + typedef typename property_traits::value_type DistanceMap; + function_requires< WritablePropertyMapConcept >(); + typedef typename property_traits::value_type Result; + + return all_mean_geodesics(g, dist, geo, measure_mean_geodesic(g, DistanceMap())); +} + + +template +inline typename Measure::result_type +small_world_distance(const Graph& g, GeodesicMap geo, Measure measure) +{ + function_requires< DistanceMeasureConcept >(); + typedef typename Measure::result_type Result; + + Result sum = detail::combine_distances(g, geo, std::plus(), Result(0)); + return measure(sum, g); +} + +template +inline typename property_traits::value_type +small_world_distance(const Graph& g, GeodesicMap geo) +{ return small_world_distance(g, geo, measure_graph_mean_geodesic(g, geo)); } + +} + +#endif diff --git a/deal.II/contrib/boost/include/boost/graph/graph_archetypes.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_archetypes.hpp similarity index 98% rename from deal.II/contrib/boost/include/boost/graph/graph_archetypes.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/graph_archetypes.hpp index ce4c85fd08..9b364bb814 100644 --- a/deal.II/contrib/boost/include/boost/graph/graph_archetypes.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_archetypes.hpp @@ -10,8 +10,10 @@ #ifndef BOOST_GRAPH_ARCHETYPES_HPP #define BOOST_GRAPH_ARCHETYPES_HPP -#include +#include #include +#include +#include namespace boost { // should use a different namespace for this diff --git a/deal.II/contrib/boost/include/boost/graph/graph_as_tree.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_as_tree.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/graph/graph_as_tree.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/graph_as_tree.hpp index 7619dfcc0a..3758c3f009 100644 --- a/deal.II/contrib/boost/include/boost/graph/graph_as_tree.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_as_tree.hpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include #include diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_concepts.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_concepts.hpp new file mode 100644 index 0000000000..fe33133607 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_concepts.hpp @@ -0,0 +1,626 @@ +// +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// +// Copyright 2009, Andrew Sutton +// +// Distributed under the 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 + +#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; + }; + + // The *IndexGraph concepts are "semantic" graph concpepts. These can be + // applied to describe any graph that has an index map that can be accessed + // using the get(*_index, g) method. For example, adjacency lists with + // VertexSet == vecS are implicitly models of this concept. + // + // NOTE: We could require an associated type vertex_index_type, but that + // would mean propagating that type name into graph_traits and all of the + // other graph implementations. Much easier to simply call it unsigned. + + BOOST_concept(VertexIndexGraph,(Graph)) + { + BOOST_CONCEPT_USAGE(VertexIndexGraph) + { + typedef typename graph_traits::vertex_descriptor Vertex; + typedef typename property_map::type Map; + typedef unsigned Index; // This could be Graph::vertex_index_type + Map m = get(vertex_index, g); + Index x = get(vertex_index, g, Vertex()); + ignore_unused_variable_warning(x); + + // This is relaxed + renumber_vertex_indices(g); + + const_constraints(g); + } + void const_constraints(const Graph& g) + { + typedef typename property_map::const_type Map; + Map m = get(vertex_index, g); + ignore_unused_variable_warning(m); + } + private: + Graph g; + }; + + BOOST_concept(EdgeIndexGraph,(Graph)) + { + BOOST_CONCEPT_USAGE(EdgeIndexGraph) + { + typedef typename graph_traits::edge_descriptor Edge; + typedef typename property_map::type Map; + typedef unsigned Index; // This could be Graph::vertex_index_type + Map m = get(edge_index, g); + Index x = get(edge_index, g, Edge()); + ignore_unused_variable_warning(x); + + // This is relaxed + renumber_edge_indices(g); + + const_constraints(g); + } + void const_constraints(const Graph& g) + { + typedef typename property_map::const_type Map; + Map m = get(edge_index, g); + ignore_unused_variable_warning(m); + } + private: + Graph g; + }; + + // 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; + }; + + // The following concepts describe aspects of numberic values and measure + // functions. We're extending the notion of numeric values to include + // emulation for zero and infinity. + + BOOST_concept(NumericValue,(Numeric)) + { + BOOST_CONCEPT_USAGE(NumericValue) + { + function_requires< DefaultConstructible >(); + function_requires< CopyConstructible >(); + numeric_values::zero(); + numeric_values::infinity(); + } + }; + + BOOST_concept(DegreeMeasure,(Measure)(Graph)) + { + BOOST_CONCEPT_USAGE(DegreeMeasure) + { + typedef typename Measure::degree_type Degree; + typedef typename Measure::vertex_type Vertex; + + Degree d = m(Vertex(), g); + ignore_unused_variable_warning(d); + } + private: + Measure m; + Graph g; + }; + + BOOST_concept(DistanceMeasure,(Measure)(Graph)) + { + BOOST_CONCEPT_USAGE(DistanceMeasure) + { + typedef typename Measure::distance_type Distance; + typedef typename Measure::result_type Result; + Result r = m(Distance(), g); + ignore_unused_variable_warning(r); + } + private: + Measure m; + Graph g; + }; + +} /* namespace concepts */ + +using boost::concepts::MultiPassInputIteratorConcept; + +// Graph concepts +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::VertexIndexGraphConcept; +using boost::concepts::EdgeIndexGraphConcept; + +// Utility concepts +using boost::concepts::BufferConcept; +using boost::concepts::ColorValueConcept; +using boost::concepts::BasicMatrixConcept; +using boost::concepts::NumericValueConcept; +using boost::concepts::DistanceMeasureConcept; +using boost::concepts::DegreeMeasureConcept; + + +} /* namespace boost */ +#include + +#endif /* BOOST_GRAPH_CONCEPTS_H */ diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_mutability_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_mutability_traits.hpp new file mode 100644 index 0000000000..726d8d1411 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_mutability_traits.hpp @@ -0,0 +1,204 @@ +// Copyright (C) 2009 Andrew Sutton +// +// 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 BOOST_GRAPH_MUTABILITY_TRAITS_HPP +#define BOOST_GRAPH_MUTABILITY_TRAITS_HPP + +#include +#include +#include +#include +#include + +namespace boost { + +// The mutabiltiy categories classify graphs by their mutating operations +// on the edge and vertex sets. This is a substantially more refined +// categorization than the MutableGraph and MutablePropertyGraph denote. +// Currently, this framework is only used in the graph tests to help +// dispatch test to the correct places. However, there are probably some +// constructive or destructive algorithms (i.e., graph generators) that +// may use these to describe requirements on graph inputs. + +struct add_vertex_tag { }; +struct add_vertex_property_tag : virtual add_vertex_tag { }; +struct add_edge_tag { }; +struct add_edge_property_tag : virtual add_edge_tag { }; +struct remove_vertex_tag { }; +struct remove_edge_tag { }; + +struct mutable_vertex_graph_tag + : virtual add_vertex_tag, virtual remove_vertex_tag +{ }; +struct mutable_vertex_property_graph_tag + : virtual add_vertex_property_tag, virtual remove_vertex_tag +{ }; + +struct mutable_edge_graph_tag + : virtual add_edge_tag, virtual remove_edge_tag +{ }; +struct mutable_edge_property_graph_tag + : virtual add_edge_property_tag, virtual remove_edge_tag +{ }; + +struct mutable_graph_tag + : virtual mutable_vertex_graph_tag + , virtual mutable_edge_graph_tag +{ }; +struct mutable_property_graph_tag + : virtual mutable_vertex_property_graph_tag + , virtual mutable_edge_property_graph_tag +{ }; + +// Some graphs just don't like to be torn down. Note this only restricts +// teardown to the set of vertices, not the vertex set. +// TODO: Find a better name for this tag. +struct add_only_property_graph_tag + : virtual add_vertex_property_tag + , virtual mutable_edge_property_graph_tag +{ }; + +/** + * The graph_mutability_traits provide methods for determining the + * interfaces supported by graph classes for adding and removing vertices + * and edges. + */ +template +struct graph_mutability_traits { + typedef typename Graph::mutability_category category; +}; + +template +struct graph_has_add_vertex + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + add_vertex_tag + >::value + > +{ }; + +template +struct graph_has_add_vertex_with_property + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + add_vertex_property_tag + >::value + > +{ }; + + +template +struct graph_has_remove_vertex + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + remove_vertex_tag + >::value + > +{ }; + +template +struct graph_has_add_edge + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + add_edge_tag + >::value + > +{ }; + +template +struct graph_has_add_edge_with_property + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + add_edge_property_tag + >::value + > +{ }; + + +template +struct graph_has_remove_edge + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + remove_edge_tag + >::value + > +{ }; + + +template +struct is_mutable_vertex_graph + : mpl::and_< + graph_has_add_vertex, + graph_has_remove_vertex + > +{ }; + +template +struct is_mutable_vertex_property_graph + : mpl::and_< + graph_has_add_vertex_with_property, + graph_has_remove_vertex + > +{ }; + + +template +struct is_mutable_edge_graph + : mpl::and_< + graph_has_add_edge, + graph_has_remove_edge + > +{ }; + +template +struct is_mutable_edge_property_graph + : mpl::and_< + graph_has_add_edge_with_property, + graph_has_remove_edge + > +{ }; + + +template +struct is_mutable_graph + : mpl::and_< + is_mutable_vertex_graph, + is_mutable_edge_graph + > +{ }; + +template +struct is_mutable_property_graph + : mpl::and_< + is_mutable_vertex_property_graph, + is_mutable_edge_property_graph + > +{ }; + +template +struct is_add_only_property_graph + : mpl::bool_< + is_convertible< + typename graph_mutability_traits::category, + add_only_property_graph_tag + >::value + > +{ }; + +/** @name Mutability Traits Specializations */ +//@{ + +//@} + +} // namespace boost + +#endif diff --git a/deal.II/contrib/boost/include/boost/graph/graph_selectors.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_selectors.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/graph_selectors.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/graph_selectors.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_stats.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_stats.hpp new file mode 100644 index 0000000000..47c0502524 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_stats.hpp @@ -0,0 +1,136 @@ +// Copyright 2005 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: Alex Breuer +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_GRAPH_STATS_HPP +#define BOOST_GRAPH_GRAPH_STATS_HPP + +#include +#include +#include + +namespace boost { namespace graph { + +template +struct sort_edge_by_origin { +public: + typedef typename graph_traits::edge_descriptor edge_type; + + explicit sort_edge_by_origin( Graph& g ) : g(g) {} + + inline bool operator()( edge_type a, edge_type b ) { + return source( a, g ) == source( b, g ) ? target( a, g ) < target( b, g ) : + source( a, g ) < source( b, g ); + } + +private: + Graph& g; +}; + +template +struct equal_edge { +public: + typedef typename graph_traits::edge_descriptor edge_type; + + explicit equal_edge( Graph& g ) : g(g) {} + + inline bool operator()( edge_type a, edge_type b ) { + return source( a, g ) == source( b, g ) && + target( a, g ) == target( b, g ); + } + +private: + Graph& g; +}; + +template +unsigned long num_dup_edges( Graph& g ) { + typedef typename graph_traits::edge_iterator e_iterator_type; + typedef typename graph_traits::edge_descriptor edge_type; + + std::list all_edges; + + BGL_FORALL_EDGES_T( e, g, Graph ) { + all_edges.push_back( e ); + } + + sort_edge_by_origin cmp1( g ); + all_edges.sort( cmp1 ); + equal_edge cmp2( g ); + all_edges.unique( cmp2 ); + + return num_edges( g ) - all_edges.size(); +} + + +template +std::map dup_edge_dist( Graph& g ) { + std::map dist; + typedef typename graph_traits::adjacency_iterator a_iterator_type; + typedef typename graph_traits::vertex_descriptor vertex_type; + + + BGL_FORALL_VERTICES_T( v, g, Graph ) { + std::list front_neighbors; + a_iterator_type a_iter, a_end; + for( tie( a_iter, a_end ) = adjacent_vertices( v, g ); + a_iter != a_end; ++a_iter ) { + front_neighbors.push_back( *a_iter ); + } + + front_neighbors.sort(); + front_neighbors.unique(); + dist[out_degree( v, g ) - front_neighbors.size()] += 1; + } + return dist; +} + +template +std::map degree_dist( Graph& g ) { + std::map dist; + typedef typename graph_traits::adjacency_iterator a_iterator_type; + typedef typename graph_traits::vertex_descriptor vertex_type; + + BGL_FORALL_VERTICES_T( v, g, Graph ) { + dist[out_degree( v, g )] += 1; + } + + return dist; +} + +template +std::map weight_degree_dist( Graph& g ) { + std::map dist, n; + typedef typename graph_traits::adjacency_iterator a_iterator_type; + typedef typename graph_traits::vertex_descriptor vertex_type; + typedef typename property_map::const_type edge_map_type; + typedef typename property_traits::value_type + edge_weight_type; + + typename property_map::type em = get( edge_weight, g ); + + BGL_FORALL_VERTICES_T( v, g, Graph ) { + edge_weight_type tmp = 0; + BGL_FORALL_OUTEDGES_T( v, e, g, Graph ) { + tmp += em[e]; + } + n[out_degree( v, g )] += 1.; + dist[out_degree( v, g )] += tmp; + } + + for( std::map::iterator iter = dist.begin(); + iter != dist.end(); ++iter ) { + assert( n[iter->first] != 0 ); + dist[iter->first] /= n[iter->first]; + } + + return dist; +} + +}} + +#endif diff --git a/deal.II/contrib/boost/include/boost/graph/graph_test.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_test.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/graph_test.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/graph_test.hpp diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_traits.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_traits.hpp new file mode 100644 index 0000000000..b86ef0a8f8 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_traits.hpp @@ -0,0 +1,319 @@ +//======================================================================= +// 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 +#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; } + } + + /** Return true if the given graph is directed. */ + template + bool is_directed(const Graph&) { + typedef typename graph_traits::directed_category Cat; + return detail::is_directed(Cat()); + } + + /** Return false if the given graph is undirected. */ + template + bool is_undirected(const Graph& g) { + return !is_directed(g); + } + + /** @name Directed/Undirected Graph Traits */ + //@{ + namespace graph_detail { + template + struct is_directed_tag + : mpl::bool_::value> + { }; + } // namespace graph_detail + + template + struct is_directed_graph + : graph_detail::is_directed_tag< + typename graph_traits::directed_category + > + { }; + + template + struct is_undirected_graph + : mpl::not_< is_directed_graph > + { }; + //@} + + // 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()); + } + + /** @name Parallel Edges Traits */ + //@{ + /** + * The is_multigraph metafunction returns true if the graph allows + * parallel edges. Technically, a multigraph is a simple graph that + * allows parallel edges, but since there are no traits for the allowance + * or disallowance of loops, this is a moot point. + */ + template + struct is_multigraph + : mpl::bool_< + is_same< + typename graph_traits::edge_parallel_category, + allow_parallel_edge_tag + >::value + > + { }; + //@} + + // traversal_category tags + struct incidence_graph_tag { }; + struct adjacency_graph_tag { }; + struct bidirectional_graph_tag : virtual incidence_graph_tag { }; + struct vertex_list_graph_tag { }; + struct edge_list_graph_tag { }; + struct adjacency_matrix_tag { }; + + /** @name Taversal Category Traits + * These traits classify graph types by their supported methods of + * vertex and edge traversal. + */ + //@{ + template + struct is_incidence_graph + : mpl::bool_< + is_convertible< + typename graph_traits::traversal_category, + incidence_graph_tag + >::value + > + { }; + + template + struct is_bidirectional_graph + : mpl::bool_< + is_convertible< + typename graph_traits::traversal_category, + bidirectional_graph_tag + >::value + > + { }; + + template + struct is_vertex_list_graph + : mpl::bool_< + is_convertible< + typename graph_traits::traversal_category, + vertex_list_graph_tag + >::value + > + { }; + + template + struct is_edge_list_graph + : mpl::bool_< + is_convertible< + typename graph_traits::traversal_category, + edge_list_graph_tag + >::value + > + { }; + //@} + + /** @name Directed Graph Traits + * These metafunctions are used to fully classify directed vs. undirected + * graphs. Recall that an undirected graph is also bidirectional, but it + * cannot be both undirected and directed at the same time. + */ + //@{ + template + struct is_directed_unidirectional_graph + : mpl::and_< + is_directed_graph, mpl::not_< is_bidirectional_graph > + > + { }; + + template + struct is_directed_bidirectional_graph + : mpl::and_< + is_directed_graph, is_bidirectional_graph + > + { }; + //@} + + //?? 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_bundle { }; + struct no_vertex_bundle : no_bundle { }; + struct no_edge_bundle : no_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; + }; + + } } // namespace graph::detail + + namespace graph_detail { + // A helper metafunction for determining whether or not a type is + // bundled. + template + struct is_no_bundle + : mpl::bool_::value> + { }; + } // namespace graph_detail + + /** @name Graph Property Traits + * These metafunctions (along with those above), can be used to access the + * vertex and edge properties (bundled or otherwise) of vertices and + * edges. + */ + //@{ + template + struct has_vertex_property + : mpl::not_< + typename detail::is_no_property::type> + >::type + { }; + template + struct has_edge_property + : mpl::not_< + typename detail::is_no_property::type> + >::type + { }; + template + struct has_bundled_vertex_property + : mpl::not_< + graph_detail::is_no_bundle::type> + > + { }; + template + struct has_bundled_edge_property + : mpl::not_< + graph_detail::is_no_bundle::type> + > + { }; + //@} + +} // 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/graph/graph_utility.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_utility.hpp similarity index 84% rename from deal.II/contrib/boost/include/boost/graph/graph_utility.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/graph_utility.hpp index 018442b91b..9976074c1a 100644 --- a/deal.II/contrib/boost/include/boost/graph/graph_utility.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/graph_utility.hpp @@ -420,6 +420,91 @@ namespace boost { 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 graph { + + // Functor for remove_parallel_edges: edge property of the removed edge is added to the remaining + template + struct add_removed_edge_property + { + add_removed_edge_property(EdgeProperty ep) : ep(ep) {} + + template + void operator() (Edge stay, Edge away) + { + put(ep, stay, get(ep, stay) + get(ep, away)); + } + EdgeProperty ep; + }; + + // Same as above: edge property is capacity here + template + struct add_removed_edge_capacity + : add_removed_edge_property::type> + { + typedef add_removed_edge_property::type> base; + add_removed_edge_capacity(Graph& g) : base(get(edge_capacity, g)) {} + }; + + template + bool has_no_vertices(const Graph& g) { + typedef typename boost::graph_traits::vertex_iterator vi; + std::pair p = vertices(g); + return (p.first == p.second); + } + + template + bool has_no_edges(const Graph& g) { + typedef typename boost::graph_traits::edge_iterator ei; + std::pair p = edges(g); + return (p.first == p.second); + } + + template + bool has_no_out_edges(const typename boost::graph_traits::vertex_descriptor& v, const Graph& g) { + typedef typename boost::graph_traits::out_edge_iterator ei; + std::pair p = out_edges(v, g); + return (p.first == p.second); + } + + } // namespace graph + + #include + + template + void copy_vertex_property(PropertyIn p_in, PropertyOut p_out, Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + put(p_out, u, get(p_in, g)); + } + + template + void copy_edge_property(PropertyIn p_in, PropertyOut p_out, Graph& g) + { + BGL_FORALL_EDGES_T(e, g, Graph) + put(p_out, e, get(p_in, g)); + } + + // Return true if property_map1 and property_map2 differ + // for any of the vertices in graph. + template + bool are_property_maps_different + (const PropertyMapFirst property_map1, + const PropertyMapSecond property_map2, + const Graph& graph) { + + BGL_FORALL_VERTICES_T(vertex, graph, Graph) { + if (get(property_map1, vertex) != + get(property_map2, vertex)) { + + return (true); + } + } + + return (false); + } + } /* namespace boost */ #endif /* BOOST_GRAPH_UTILITY_HPP*/ diff --git a/deal.II/contrib/boost/include/boost/graph/graphml.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/graphml.hpp similarity index 74% rename from deal.II/contrib/boost/include/boost/graph/graphml.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/graphml.hpp index be7a804e3f..f6256a0fe2 100644 --- a/deal.II/contrib/boost/include/boost/graph/graphml.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/graphml.hpp @@ -22,21 +22,74 @@ #include #include #include +#if 0 // Change this back later +#include +#endif #include #include -namespace boost +namespace boost { + // FIXME: Remove this once property_tree is stable + namespace graph_detail_from_property_tree { + +// ---------------------------------------------------------------------------- +// Copyright (C) 2002-2006 Marcin Kalicinski +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see www.boost.org +// ---------------------------------------------------------------------------- + + // Naively convert narrow string to another character type + template + std::basic_string widen(const char *text) + { + std::basic_string result; + while (*text) + { + result += Ch(*text); + ++text; + } + return result; + } + + template + std::basic_string encode_char_entities(const std::basic_string &s) + { + typedef typename std::basic_string Str; + Str r; + typename Str::const_iterator end = s.end(); + for (typename Str::const_iterator it = s.begin(); it != end; ++it) + { + switch (*it) + { + case Ch('<'): r += boost::graph_detail_from_property_tree::widen("<"); break; + case Ch('>'): r += boost::graph_detail_from_property_tree::widen(">"); break; + case Ch('&'): r += boost::graph_detail_from_property_tree::widen("&"); break; + case Ch('"'): r += boost::graph_detail_from_property_tree::widen("""); break; + case Ch('\''): r += boost::graph_detail_from_property_tree::widen("'"); break; + default: r += *it; break; + } + } + return r; + } + + } + ///////////////////////////////////////////////////////////////////////////// // Graph reader exceptions ///////////////////////////////////////////////////////////////////////////// -struct parse_error: public graph_exception +struct parse_error: public graph_exception { - parse_error(const std::string& error) {statement = "parse error: " + error;} + parse_error(const std::string& err) {error = err; statement = "parse error: " + error;} virtual ~parse_error() throw() {} virtual const char* what() const throw() {return statement.c_str();} std::string statement; + std::string error; }; @@ -48,14 +101,14 @@ public: virtual boost::any do_add_vertex() = 0; virtual std::pair do_add_edge(boost::any source, boost::any target) = 0; - - virtual void + + virtual void set_graph_property(const std::string& name, const std::string& value, const std::string& value_type) = 0; - virtual void + virtual void set_vertex_property(const std::string& name, boost::any vertex, const std::string& value, const std::string& value_type) = 0; - - virtual void + + virtual void set_edge_property(const std::string& name, boost::any edge, const std::string& value, const std::string& value_type) = 0; }; @@ -87,27 +140,27 @@ class mutate_graph_impl : public mutate_graph return std::make_pair(any(retval.first), retval.second); } - virtual void + 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)); + (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 " + + throw parse_error("invalid value \"" + value + "\" for key " + name + " of type " + value_type); } if (!type_found) - throw parse_error("unrecognized type \"" + value_type + + throw parse_error("unrecognized type \"" + value_type + "\" for key " + name); - + } - - virtual void + + virtual void set_vertex_property(const std::string& name, any vertex, const std::string& value, const std::string& value_type) { bool type_found = false; @@ -115,20 +168,20 @@ class mutate_graph_impl : public mutate_graph { mpl::for_each(put_property (name, m_dp, any_cast(vertex), - value, value_type, m_type_names, type_found)); + value, value_type, m_type_names, type_found)); } catch (bad_lexical_cast) { - throw parse_error("invalid value \"" + value + "\" for key " + + throw parse_error("invalid value \"" + value + "\" for key " + name + " of type " + value_type); } if (!type_found) - throw parse_error("unrecognized type \"" + value_type + + throw parse_error("unrecognized type \"" + value_type + "\" for key " + name); - + } - - virtual void + + virtual void set_edge_property(const std::string& name, any edge, const std::string& value, const std::string& value_type) { bool type_found = false; @@ -136,15 +189,15 @@ class mutate_graph_impl : public mutate_graph { mpl::for_each(put_property (name, m_dp, any_cast(edge), - value, value_type, m_type_names, type_found)); + value, value_type, m_type_names, type_found)); } catch (bad_lexical_cast) { - throw parse_error("invalid value \"" + value + "\" for key " + + throw parse_error("invalid value \"" + value + "\" for key " + name + " of type " + value_type); } if (!type_found) - throw parse_error("unrecognized type \"" + value_type + + throw parse_error("unrecognized type \"" + value_type + "\" for key " + name); } @@ -152,11 +205,11 @@ class mutate_graph_impl : public mutate_graph 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), + put_property(const std::string& name, dynamic_properties& dp, const Key& key, + const std::string& value, const std::string& value_type, + const 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) @@ -173,27 +226,27 @@ class mutate_graph_impl : public mutate_graph const Key& m_key; const std::string& m_value; const std::string& m_value_type; - char** m_type_names; + const 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[]; + static const char* m_type_names[]; }; template -char* mutate_graph_impl::m_type_names[] = {"boolean", "int", "long", "float", "double", "string"}; +const char* mutate_graph_impl::m_type_names[] = {"boolean", "int", "long", "float", "double", "string"}; -void +void BOOST_GRAPH_DECL 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); } @@ -202,7 +255,7 @@ template class get_type_name { public: - get_type_name(const std::type_info& type, char** type_names, std::string& type_name) + get_type_name(const std::type_info& type, const char** type_names, std::string& type_name) : m_type(type), m_type_names(type_names), m_type_name(type_name) {} template void operator()(Type) @@ -212,7 +265,7 @@ public: } private: const std::type_info &m_type; - char** m_type_names; + const char** m_type_names; std::string &m_type_name; }; @@ -226,22 +279,25 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, typedef typename graph_traits::edge_descriptor edge_descriptor; typedef typename graph_traits::vertex_descriptor vertex_descriptor; - BOOST_STATIC_CONSTANT(bool, - graph_is_directed = + // using boost::property_tree::xml_parser::encode_char_entities; + using boost::graph_detail_from_property_tree::encode_char_entities; + + 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"}; + const 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) + 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)) @@ -254,14 +310,14 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, 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"; @@ -269,13 +325,13 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, // Output graph data for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) { - if (i->second->key() == typeid(Graph)) + if (i->second->key() == typeid(Graph)) { out << " first] << "\">" - << i->second->get_string(g) << "\n"; + << encode_char_entities(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) @@ -284,10 +340,10 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, // Output data for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) { - if (i->second->key() == typeid(vertex_descriptor)) + if (i->second->key() == typeid(vertex_descriptor)) { out << " first] << "\">" - << i->second->get_string(*v) << "\n"; + << encode_char_entities(i->second->get_string(*v)) << "\n"; } } out << " \n"; @@ -296,7 +352,7 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, 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) + for (tie(e, e_end) = edges(g); e != e_end; ++e) { out << " second->key() == typeid(edge_descriptor)) + if (i->second->key() == typeid(edge_descriptor)) { out << " first] << "\">" - << i->second->get_string(*e) << "\n"; + << encode_char_entities(i->second->get_string(*e)) << "\n"; } } out << " \n"; @@ -321,7 +377,7 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, template void -write_graphml(std::ostream& out, const Graph& g, const dynamic_properties& dp, +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); diff --git a/deal.II/contrib/boost/include/boost/graph/graphviz.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/graphviz.hpp similarity index 87% rename from deal.II/contrib/boost/include/boost/graph/graphviz.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/graphviz.hpp index b010dd8450..c1f87375be 100644 --- a/deal.II/contrib/boost/include/boost/graph/graphviz.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/graphviz.hpp @@ -1,7 +1,7 @@ //======================================================================= // Copyright 2001 University of Notre Dame. // Copyright 2003 Jeremy Siek -// Authors: Lie-Quan Lee and Jeremy Siek +// Authors: Lie-Quan Lee, Jeremy Siek, and Douglas Gregor // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -16,13 +16,14 @@ #include #include #include // for FILE -#include +#include #include #include #include #include #include -#include +#include +#include #ifdef BOOST_HAS_DECLSPEC # if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_GRAPH_DYN_LINK) @@ -236,12 +237,17 @@ namespace boost { template - inline void write_graphviz(std::ostream& out, const Graph& g, - VertexPropertiesWriter vpw, - EdgePropertiesWriter epw, - GraphPropertiesWriter gpw, - VertexID vertex_id) + inline void + write_graphviz + (std::ostream& out, const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw, + GraphPropertiesWriter gpw, + VertexID vertex_id + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { + BOOST_CONCEPT_ASSERT((EdgeListGraphConcept)); + typedef typename graph_traits::directed_category cat_type; typedef graphviz_io_traits Traits; std::string name = "G"; @@ -267,17 +273,21 @@ namespace boost { template - inline void write_graphviz(std::ostream& out, const Graph& g, - VertexPropertiesWriter vpw, - EdgePropertiesWriter epw, - GraphPropertiesWriter gpw) + inline void + write_graphviz(std::ostream& out, const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw, + GraphPropertiesWriter gpw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { 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) { + write_graphviz(std::ostream& out, const Graph& g + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) + { default_writer dw; default_writer gw; write_graphviz(out, g, dw, dw, gw); @@ -286,7 +296,9 @@ namespace boost { template inline void - write_graphviz(std::ostream& out, const Graph& g, VertexWriter vw) { + write_graphviz(std::ostream& out, const Graph& g, VertexWriter vw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) + { default_writer dw; default_writer gw; write_graphviz(out, g, vw, dw, gw); @@ -295,7 +307,9 @@ namespace boost { template inline void write_graphviz(std::ostream& out, const Graph& g, - VertexWriter vw, EdgeWriter ew) { + VertexWriter vw, EdgeWriter ew + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) + { default_writer gw; write_graphviz(out, g, vw, ew, gw); } @@ -404,7 +418,7 @@ namespace boost { detail::write_graphviz_subgraph(out, g, vertex_marker.begin(), - edge_marker.begin(), + edge_marker.begin(), get(vertex_index, g)); } @@ -422,20 +436,20 @@ namespace boost { template void write_graphviz(std::ostream& out, const subgraph& g, - VertexID vertex_id) + 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(), + edge_marker.begin(), vertex_id); } template void write_graphviz(const std::string& filename, const subgraph& g, - VertexID vertex_id) + VertexID vertex_id) { std::ofstream out(filename.c_str()); std::vector edge_marker(num_edges(g), true); @@ -479,11 +493,12 @@ namespace boost { // 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); + // Library has not existed for a while + // 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 { @@ -494,7 +509,7 @@ namespace boost { void operator()(std::ostream& out, Descriptor key) const { bool first = true; - for (dynamic_properties::const_iterator i = dp->begin(); + for (dynamic_properties::const_iterator i = dp->begin(); i != dp->end(); ++i) { if (typeid(key) == i->second->key()) { if (first) out << " ["; @@ -516,14 +531,14 @@ namespace boost { { public: dynamic_vertex_properties_writer(const dynamic_properties& dp, - const std::string& node_id) + 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(); + for (dynamic_properties::const_iterator i = dp->begin(); i != dp->end(); ++i) { if (typeid(key) == i->second->key() && i->first != *node_id) { @@ -564,8 +579,8 @@ namespace boost { }; template - inline std::string - get(node_id_property_map pm, + 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); } @@ -574,8 +589,9 @@ namespace boost { template inline void write_graphviz(std::ostream& out, const Graph& g, - const dynamic_properties& dp, - const std::string& node_id = "node_id") + const dynamic_properties& dp, + const std::string& node_id = "node_id" + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { typedef typename graph_traits::vertex_descriptor Vertex; write_graphviz(out, g, dp, node_id, @@ -586,7 +602,8 @@ namespace boost { void write_graphviz(std::ostream& out, const Graph& g, const dynamic_properties& dp, const std::string& node_id, - VertexID id) + VertexID id + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { write_graphviz (out, g, @@ -640,6 +657,14 @@ struct undirected_graph_error : public graph_exception { } }; +struct bad_graphviz_syntax: public graph_exception { + std::string errmsg; + bad_graphviz_syntax(const std::string& errmsg) + : errmsg(errmsg) {} + const char* what() const throw () {return errmsg.c_str();} + ~bad_graphviz_syntax() throw () {}; +}; + namespace detail { namespace graph { typedef std::string id_t; @@ -654,7 +679,7 @@ public: static int idx = 0; return edge_t(idx++); }; - + bool operator==(const edge_t& rhs) const { return idx_ == rhs.idx_; } @@ -670,14 +695,14 @@ class mutate_graph virtual bool is_directed() const = 0; virtual void do_add_vertex(const node_t& node) = 0; - virtual void + virtual void do_add_edge(const edge_t& edge, const node_t& source, const node_t& target) = 0; - virtual void + virtual void set_node_property(const id_t& key, const node_t& node, const id_t& value) = 0; - virtual void + 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 @@ -699,7 +724,7 @@ class mutate_graph_impl : public mutate_graph bool is_directed() const { - return + return boost::is_convertible< typename boost::graph_traits::directed_category, boost::directed_tag>::value; @@ -712,20 +737,20 @@ class mutate_graph_impl : public mutate_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 + 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); + boost::throw_exception(bad_parallel_edge(source, target)); } else { bgl_edges.insert(std::make_pair(edge, result.first)); } @@ -750,7 +775,7 @@ class mutate_graph_impl : public mutate_graph put(key, dp_, &graph_, value); } - + protected: MutableGraph& graph_; dynamic_properties& dp_; @@ -768,16 +793,29 @@ bool read_graphviz(std::istream& in, mutate_graph& graph); template bool read_graphviz(std::istream& in, MutableGraph& graph, dynamic_properties& dp, - std::string const& node_id = "node_id") + 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); + std::string data; + in >> std::noskipws; + std::copy(std::istream_iterator(in), + std::istream_iterator(), + std::back_inserter(data)); + return read_graphviz(data,graph,dp,node_id); } } // namespace boost -#ifdef BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +#ifdef BOOST_GRAPH_USE_SPIRIT_PARSER +# ifndef BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +# define BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +# endif # include -#endif // BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +#else // New default parser +# include +#endif // BOOST_GRAPH_USE_SPIRIT_PARSER + +#ifdef BOOST_GRAPH_USE_MPI +# include +#endif #endif // BOOST_GRAPHVIZ_HPP diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/grid_graph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/grid_graph.hpp new file mode 100644 index 0000000000..27cc256b25 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/grid_graph.hpp @@ -0,0 +1,991 @@ +//======================================================================= +// Copyright 2009 Trustees of Indiana University. +// Authors: Michael Hansen, 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) +//======================================================================= + +#ifndef BOOST_GRAPH_GRID_GRAPH_HPP +#define BOOST_GRAPH_GRID_GRAPH_HPP + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BOOST_GRID_GRAPH_TEMPLATE_PARAMS \ + std::size_t DimensionsT, typename VertexIndexT, \ + typename EdgeIndexT + +#define BOOST_GRID_GRAPH_TYPE \ + grid_graph + +#define BOOST_GRID_GRAPH_TYPE_MEM typename BOOST_GRID_GRAPH_TYPE:: + +#define BOOST_GRID_GRAPH_TYPE_TD(mem) \ + typedef typename BOOST_GRID_GRAPH_TYPE::mem mem + +#define BOOST_GRID_GRAPH_TRAITS_T \ + typename graph_traits + +namespace boost { + + // Class prototype for grid_graph + template + class grid_graph; + + //=================== + // Index Property Map + //=================== + + template + struct grid_graph_index_map { + public: + typedef Index value_type; + typedef Index reference_type; + typedef reference_type reference; + typedef Descriptor key_type; + typedef readable_property_map_tag category; + + grid_graph_index_map() { } + + grid_graph_index_map(const Graph& graph) : + m_graph(make_shared(graph)) { } + + value_type operator[](key_type key) const { + return (m_graph->index_of(key)); + } + + protected: + shared_ptr m_graph; + }; + + template + struct property_map { + typedef grid_graph_index_map type; + typedef type const_type; + }; + + template + struct property_map { + typedef grid_graph_index_map type; + typedef type const_type; + }; + + //================= + // Function Objects + //================= + + namespace detail { + + // vertex_at + template + struct grid_graph_vertex_at { + + typedef typename graph_traits::vertex_descriptor result_type; + + grid_graph_vertex_at(const Graph* graph) : + m_graph(graph) { } + + result_type + operator() + (typename graph_traits::vertices_size_type vertex_index) const { + return (vertex(vertex_index, *m_graph)); + } + + private: + const Graph* m_graph; + }; + + // out_edge_at + template + struct grid_graph_out_edge_at { + + private: + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + public: + typedef typename graph_traits::edge_descriptor result_type; + + grid_graph_out_edge_at(vertex_descriptor source_vertex, + const Graph* graph) : + m_vertex(source_vertex), + m_graph(graph) { } + + result_type + operator() + (typename graph_traits::degree_size_type out_edge_index) const { + return (out_edge_at(m_vertex, out_edge_index, *m_graph)); + } + + private: + vertex_descriptor m_vertex; + const Graph* m_graph; + }; + + // in_edge_at + template + struct grid_graph_in_edge_at { + + private: + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + + public: + typedef typename graph_traits::edge_descriptor result_type; + + grid_graph_in_edge_at(vertex_descriptor target_vertex, + const Graph* graph) : + m_vertex(target_vertex), + m_graph(graph) { } + + result_type + operator() + (typename graph_traits::degree_size_type in_edge_index) const { + return (in_edge_at(m_vertex, in_edge_index, *m_graph)); + } + + private: + vertex_descriptor m_vertex; + const Graph* m_graph; + }; + + // edge_at + template + struct grid_graph_edge_at { + + typedef typename graph_traits::edge_descriptor result_type; + + grid_graph_edge_at(const Graph* graph) : + m_graph(graph) { } + + result_type + operator() + (typename graph_traits::edges_size_type edge_index) const { + return (edge_at(edge_index, *m_graph)); + } + + private: + const Graph* m_graph; + }; + + // adjacent_vertex_at + template + struct grid_graph_adjacent_vertex_at { + + public: + typedef typename graph_traits::vertex_descriptor result_type; + + grid_graph_adjacent_vertex_at(result_type source_vertex, + const Graph* graph) : + m_vertex(source_vertex), + m_graph(graph) { } + + result_type + operator() + (typename graph_traits::degree_size_type adjacent_index) const { + return (target(out_edge_at(m_vertex, adjacent_index, *m_graph), *m_graph)); + } + + private: + result_type m_vertex; + const Graph* m_graph; + }; + + }; // namespace detail + + //=========== + // Grid Graph + //=========== + + template + class grid_graph { + + private: + typedef boost::array WrapDimensionArray; + grid_graph() { }; + + public: + + typedef grid_graph type; + + // sizes + typedef VertexIndex vertices_size_type; + typedef EdgeIndex edges_size_type; + typedef EdgeIndex degree_size_type; + + // descriptors + typedef boost::array vertex_descriptor; + typedef std::pair edge_descriptor; + + // vertex_iterator + typedef counting_iterator vertex_index_iterator; + typedef detail::grid_graph_vertex_at vertex_function; + typedef transform_iterator vertex_iterator; + + // edge_iterator + typedef counting_iterator edge_index_iterator; + typedef detail::grid_graph_edge_at edge_function; + typedef transform_iterator edge_iterator; + + // out_edge_iterator + typedef counting_iterator degree_iterator; + typedef detail::grid_graph_out_edge_at out_edge_function; + typedef transform_iterator out_edge_iterator; + + // in_edge_iterator + typedef detail::grid_graph_in_edge_at in_edge_function; + typedef transform_iterator in_edge_iterator; + + // adjacency_iterator + typedef detail::grid_graph_adjacent_vertex_at adjacent_vertex_function; + typedef transform_iterator adjacency_iterator; + + // categories + typedef undirected_tag directed_category; + typedef disallow_parallel_edge_tag edge_parallel_category; + struct traversal_category : virtual public incidence_graph_tag, + virtual public adjacency_graph_tag, + virtual public vertex_list_graph_tag, + virtual public edge_list_graph_tag, + virtual public bidirectional_graph_tag, + virtual public adjacency_matrix_tag { }; + + static inline vertex_descriptor null_vertex() + { + vertex_descriptor maxed_out_vertex; + std::fill(maxed_out_vertex.begin(), maxed_out_vertex.end(), + (std::numeric_limits::max)()); + + return (maxed_out_vertex); + } + + // Constructor that defaults to no wrapping for all dimensions. + grid_graph(vertex_descriptor dimension_lengths) : + m_dimension_lengths(dimension_lengths) { + + std::fill(m_wrap_dimension.begin(), + m_wrap_dimension.end(), false); + + precalculate(); + } + + // Constructor that allows for wrapping to be specified for all + // dimensions at once. + grid_graph(vertex_descriptor dimension_lengths, + bool wrap_all_dimensions) : + m_dimension_lengths(dimension_lengths) { + + std::fill(m_wrap_dimension.begin(), + m_wrap_dimension.end(), + wrap_all_dimensions); + + precalculate(); + } + + // Constructor that allows for individual dimension wrapping to be + // specified. + grid_graph(vertex_descriptor dimension_lengths, + WrapDimensionArray wrap_dimension) : + m_dimension_lengths(dimension_lengths), + m_wrap_dimension(wrap_dimension) { + + precalculate(); + } + + // Returns the number of dimensions in the graph + inline std::size_t dimensions() const { + return (Dimensions); + } + + // Returns the length of dimension [dimension_index] + inline vertices_size_type length(std::size_t dimension) const { + return (m_dimension_lengths[dimension]); + } + + // Returns a value indicating if dimension [dimension_index] wraps + inline bool wrapped(std::size_t dimension) const { + return (m_wrap_dimension[dimension]); + } + + // Gets the vertex that is [distance] units ahead of [vertex] in + // dimension [dimension_index]. + vertex_descriptor next + (vertex_descriptor vertex, + std::size_t dimension_index, + vertices_size_type distance = 1) const { + + vertices_size_type new_position = + vertex[dimension_index] + distance; + + if (wrapped(dimension_index)) { + new_position %= length(dimension_index); + } + else { + // Stop at the end of this dimension if necessary. + new_position = + (std::min)(new_position, + length(dimension_index) - 1); + } + + vertex[dimension_index] = new_position; + + return (vertex); + } + + // Gets the vertex that is [distance] units behind [vertex] in + // dimension [dimension_index]. + vertex_descriptor previous + (vertex_descriptor vertex, + std::size_t dimension_index, + vertices_size_type distance = 1) const { + + // We're assuming that vertices_size_type is unsigned, so we + // need to be careful about the math. + vertex[dimension_index] = + (distance > vertex[dimension_index]) ? + (wrapped(dimension_index) ? + (length(dimension_index) - (distance % length(dimension_index))) : 0) : + vertex[dimension_index] - distance; + + return (vertex); + } + + protected: + + // Returns the number of vertices in the graph + inline vertices_size_type num_vertices() const { + return (m_num_vertices); + } + + // Returns the number of edges in the graph + inline edges_size_type num_edges() const { + return (m_num_edges); + } + + // Returns the number of edges in dimension [dimension_index] + inline edges_size_type num_edges + (std::size_t dimension_index) const { + return (m_edge_count[dimension_index]); + } + + // Returns the index of [vertex] (See also vertex_at) + vertices_size_type index_of(vertex_descriptor vertex) const { + + vertices_size_type vertex_index = 0; + vertices_size_type index_multiplier = 1; + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + vertex_index += (vertex[dimension_index] * index_multiplier); + index_multiplier *= length(dimension_index); + } + + return (vertex_index); + } + + // Returns the vertex whose index is [vertex_index] (See also + // index_of(vertex_descriptor)) + vertex_descriptor vertex_at + (vertices_size_type vertex_index) const { + + array vertex; + vertices_size_type index_divider = 1; + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + vertex[dimension_index] = (vertex_index / index_divider) % + length(dimension_index); + + index_divider *= length(dimension_index); + } + + return (vertex); + } + + // Returns the edge whose index is [edge_index] (See also + // index_of(edge_descriptor)). NOTE: The index mapping is + // dependent upon dimension wrapping. + edge_descriptor edge_at(edges_size_type edge_index) const { + + // Edge indices are sorted into bins by dimension + std::size_t dimension_index = 0; + edges_size_type dimension_edges = num_edges(0); + + while (edge_index >= dimension_edges) { + edge_index -= dimension_edges; + ++dimension_index; + dimension_edges = num_edges(dimension_index); + } + + vertex_descriptor vertex_source, vertex_target; + bool is_forward = ((edge_index / (num_edges(dimension_index) / 2)) == 0); + + if (wrapped(dimension_index)) { + vertex_source = vertex_at(edge_index % num_vertices()); + vertex_target = is_forward ? + next(vertex_source, dimension_index) : + previous(vertex_source, dimension_index); + } + else { + + // Dimensions can wrap arbitrarily, so an index needs to be + // computed in a more complex manner. This is done by + // grouping the edges for each dimension together into "bins" + // and considering [edge_index] as an offset into the bin. + // Each bin consists of two parts: the "forward" looking edges + // and the "backward" looking edges for the dimension. + + edges_size_type vertex_offset = edge_index % num_edges(dimension_index); + + // Consider vertex_offset an index into the graph's vertex + // space but with the dimension [dimension_index] reduced in + // size by one. + vertices_size_type index_divider = 1; + + for (std::size_t dimension_index_iter = 0; + dimension_index_iter < Dimensions; + ++dimension_index_iter) { + + std::size_t dimension_length = (dimension_index_iter == dimension_index) ? + length(dimension_index_iter) - 1 : + length(dimension_index_iter); + + vertex_source[dimension_index_iter] = (vertex_offset / index_divider) % + dimension_length; + + index_divider *= dimension_length; + } + + if (is_forward) { + vertex_target = next(vertex_source, dimension_index); + } + else { + // Shift forward one more unit in the dimension for backward + // edges since the algorithm above will leave us one behind. + vertex_target = vertex_source; + ++vertex_source[dimension_index]; + } + + } // if (wrapped(dimension_index)) + + return (std::make_pair(vertex_source, vertex_target)); + } + + // Returns the index for [edge] (See also edge_at) + edges_size_type index_of(edge_descriptor edge) const { + vertex_descriptor source_vertex = source(edge, *this); + vertex_descriptor target_vertex = target(edge, *this); + + // Determine the dimension where the source and target vertices + // differ (should only be one if this is a valid edge). + std::size_t different_dimension_index = 0; + + while (source_vertex[different_dimension_index] == + target_vertex[different_dimension_index]) { + + ++different_dimension_index; + } + + edges_size_type edge_index = 0; + + // Offset the edge index into the appropriate "bin" (see edge_at + // for a more in-depth description). + for (std::size_t dimension_index = 0; + dimension_index < different_dimension_index; + ++dimension_index) { + + edge_index += num_edges(dimension_index); + } + + // Get the position of both vertices in the differing dimension. + vertices_size_type source_position = source_vertex[different_dimension_index]; + vertices_size_type target_position = target_vertex[different_dimension_index]; + + // Determine if edge is forward or backward + bool is_forward = true; + + if (wrapped(different_dimension_index)) { + + // If the dimension is wrapped, an edge is going backward if + // either A: its target precedes the source in the differing + // dimension and the vertices are adjacent or B: its source + // precedes the target and they're not adjacent. + if (((target_position < source_position) && + ((source_position - target_position) == 1)) || + ((source_position < target_position) && + ((target_position - source_position) > 1))) { + + is_forward = false; + } + } + else if (target_position < source_position) { + is_forward = false; + } + + // "Backward" edges are in the second half of the bin. + if (!is_forward) { + edge_index += (num_edges(different_dimension_index) / 2); + } + + // Finally, apply the vertex offset + if (wrapped(different_dimension_index)) { + edge_index += index_of(source_vertex); + } + else { + vertices_size_type index_multiplier = 1; + + if (!is_forward) { + --source_vertex[different_dimension_index]; + } + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + edge_index += (source_vertex[dimension_index] * index_multiplier); + index_multiplier *= (dimension_index == different_dimension_index) ? + length(dimension_index) - 1 : + length(dimension_index); + } + } + + return (edge_index); + } + + // Returns the number of out-edges for [vertex] + degree_size_type out_degree(vertex_descriptor vertex) const { + + degree_size_type out_edge_count = 0; + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + // If the vertex is on the edge of this dimension, then its + // number of out edges is dependent upon whether the dimension + // wraps or not. + if ((vertex[dimension_index] == 0) || + (vertex[dimension_index] == (length(dimension_index) - 1))) { + out_edge_count += (wrapped(dimension_index) ? 2 : 1); + } + else { + // Next and previous edges, regardless or wrapping + out_edge_count += 2; + } + } + + return (out_edge_count); + } + + // Returns an out-edge for [vertex] by index. Indices are in the + // range [0, out_degree(vertex)). + edge_descriptor out_edge_at + (vertex_descriptor vertex, + degree_size_type out_edge_index) const { + + edges_size_type edges_left = out_edge_index + 1; + std::size_t dimension_index = 0; + bool is_forward = false; + + // Walks the out edges of [vertex] and accommodates for dimension + // wrapping. + while (edges_left > 0) { + + if (!wrapped(dimension_index)) { + if (!is_forward && (vertex[dimension_index] == 0)) { + is_forward = true; + continue; + } + else if (is_forward && + (vertex[dimension_index] == (length(dimension_index) - 1))) { + is_forward = false; + ++dimension_index; + continue; + } + } + + --edges_left; + + if (edges_left > 0) { + is_forward = !is_forward; + + if (!is_forward) { + ++dimension_index; + } + } + } + + return (std::make_pair(vertex, is_forward ? + next(vertex, dimension_index) : + previous(vertex, dimension_index))); + } + + // Returns the number of in-edges for [vertex] + inline degree_size_type in_degree(vertex_descriptor vertex) const { + return (out_degree(vertex)); + } + + // Returns an in-edge for [vertex] by index. Indices are in the + // range [0, in_degree(vertex)). + edge_descriptor in_edge_at + (vertex_descriptor vertex, + edges_size_type in_edge_index) const { + + edge_descriptor out_edge = out_edge_at(vertex, in_edge_index); + return (std::make_pair(target(out_edge, *this), source(out_edge, *this))); + + } + + // Pre-computes the number of vertices and edges + void precalculate() { + m_num_vertices = + std::accumulate(m_dimension_lengths.begin(), + m_dimension_lengths.end(), 1, + std::multiplies()); + + // Calculate number of edges in each dimension + m_num_edges = 0; + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + if (wrapped(dimension_index)) { + m_edge_count[dimension_index] = num_vertices() * 2; + } + else { + m_edge_count[dimension_index] = + (num_vertices() - (num_vertices() / length(dimension_index))) * 2; + } + + m_num_edges += num_edges(dimension_index); + } + } + + const vertex_descriptor m_dimension_lengths; + WrapDimensionArray m_wrap_dimension; + vertices_size_type m_num_vertices; + + boost::array m_edge_count; + edges_size_type m_num_edges; + + public: + + //================ + // VertexListGraph + //================ + + template + friend inline std::pair + vertices(const BOOST_GRID_GRAPH_TYPE& graph) { + BOOST_GRID_GRAPH_TYPE_TD(vertex_iterator); + BOOST_GRID_GRAPH_TYPE_TD(vertex_function); + BOOST_GRID_GRAPH_TYPE_TD(vertex_index_iterator); + + return (std::make_pair + (vertex_iterator(vertex_index_iterator(0), + vertex_function(&graph)), + vertex_iterator(vertex_index_iterator(graph.num_vertices()), + vertex_function(&graph)))); + } + + template + friend inline BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type + num_vertices(const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.num_vertices()); + } + + template + friend inline BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor + vertex(BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type vertex_index, + const BOOST_GRID_GRAPH_TYPE& graph) { + + return (graph.vertex_at(vertex_index)); + } + + //=============== + // IncidenceGraph + //=============== + + template + friend inline std::pair + out_edges(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); + BOOST_GRID_GRAPH_TYPE_TD(out_edge_function); + BOOST_GRID_GRAPH_TYPE_TD(out_edge_iterator); + + return (std::make_pair + (out_edge_iterator(degree_iterator(0), + out_edge_function(vertex, &graph)), + out_edge_iterator(degree_iterator(graph.out_degree(vertex)), + out_edge_function(vertex, &graph)))); + } + + template + friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type + out_degree + (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.out_degree(vertex)); + } + + template + friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor + out_edge_at(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + BOOST_GRID_GRAPH_TYPE_MEM degree_size_type out_edge_index, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.out_edge_at(vertex, out_edge_index)); + } + + //=============== + // AdjacencyGraph + //=============== + + template + friend typename std::pair + adjacent_vertices (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); + BOOST_GRID_GRAPH_TYPE_TD(adjacent_vertex_function); + BOOST_GRID_GRAPH_TYPE_TD(adjacency_iterator); + + return (std::make_pair + (adjacency_iterator(degree_iterator(0), + adjacent_vertex_function(vertex, &graph)), + adjacency_iterator(degree_iterator(graph.out_degree(vertex)), + adjacent_vertex_function(vertex, &graph)))); + } + + //============== + // EdgeListGraph + //============== + + template + friend inline BOOST_GRID_GRAPH_TYPE_MEM edges_size_type + num_edges(const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.num_edges()); + } + + template + friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor + edge_at(BOOST_GRID_GRAPH_TYPE_MEM edges_size_type edge_index, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.edge_at(edge_index)); + } + + template + friend inline std::pair + edges(const BOOST_GRID_GRAPH_TYPE& graph) { + BOOST_GRID_GRAPH_TYPE_TD(edge_index_iterator); + BOOST_GRID_GRAPH_TYPE_TD(edge_function); + BOOST_GRID_GRAPH_TYPE_TD(edge_iterator); + + return (std::make_pair + (edge_iterator(edge_index_iterator(0), + edge_function(&graph)), + edge_iterator(edge_index_iterator(graph.num_edges()), + edge_function(&graph)))); + } + + //=================== + // BiDirectionalGraph + //=================== + + template + friend inline std::pair + in_edges(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + BOOST_GRID_GRAPH_TYPE_TD(in_edge_function); + BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); + BOOST_GRID_GRAPH_TYPE_TD(in_edge_iterator); + + return (std::make_pair + (in_edge_iterator(degree_iterator(0), + in_edge_function(vertex, &graph)), + in_edge_iterator(degree_iterator(graph.in_degree(vertex)), + in_edge_function(vertex, &graph)))); + } + + template + friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type + in_degree (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.in_degree(vertex)); + } + + template + friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type + degree (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.out_degree(vertex) * 2); + } + + template + friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor + in_edge_at(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + BOOST_GRID_GRAPH_TYPE_MEM degree_size_type in_edge_index, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.in_edge_at(vertex, in_edge_index)); + } + + + //================== + // Adjacency Matrix + //================== + + template + friend std::pair + edge (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor source_vertex, + BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor destination_vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + + std::pair edge_exists = + std::make_pair(std::make_pair(source_vertex, destination_vertex), false); + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type dim_difference = 0; + BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type + source_dim = source_vertex[dimension_index], + dest_dim = destination_vertex[dimension_index]; + + dim_difference = (source_dim > dest_dim) ? + (source_dim - dest_dim) : (dest_dim - source_dim); + + if (dim_difference > 0) { + + // If we've already found a valid edge, this would mean that + // the vertices are really diagonal across dimensions and + // therefore not connected. + if (edge_exists.second) { + edge_exists.second = false; + break; + } + + // If the difference is one, the vertices are right next to + // each other and the edge is valid. The edge is still + // valid, though, if the dimension wraps and the vertices + // are on opposite ends. + if ((dim_difference == 1) || + (graph.wrapped(dimension_index) && + (((source_dim == 0) && (dest_dim == (graph.length(dimension_index) - 1))) || + ((dest_dim == 0) && (source_dim == (graph.length(dimension_index) - 1)))))) { + + edge_exists.second = true; + // Stay in the loop to check for diagonal vertices. + } + else { + + // Stop checking - the vertices are too far apart. + edge_exists.second = false; + break; + } + } + + } // for dimension_index + + return (edge_exists); + } + + + //============================= + // Index Property Map Functions + //============================= + + template + friend inline BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type + get(vertex_index_t, + const BOOST_GRID_GRAPH_TYPE& graph, + BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex) { + return (graph.index_of(vertex)); + } + + template + friend inline BOOST_GRID_GRAPH_TYPE_MEM edges_size_type + get(edge_index_t, + const BOOST_GRID_GRAPH_TYPE& graph, + BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor edge) { + return (graph.index_of(edge)); + } + + template + friend inline grid_graph_index_map< + BOOST_GRID_GRAPH_TYPE, + BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor, + BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type> + get(vertex_index_t, const BOOST_GRID_GRAPH_TYPE& graph) { + return (grid_graph_index_map< + BOOST_GRID_GRAPH_TYPE, + BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor, + BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type>(graph)); + } + + template + friend inline grid_graph_index_map< + BOOST_GRID_GRAPH_TYPE, + BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, + BOOST_GRID_GRAPH_TYPE_MEM edges_size_type> + get(edge_index_t, const BOOST_GRID_GRAPH_TYPE& graph) { + return (grid_graph_index_map< + BOOST_GRID_GRAPH_TYPE, + BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, + BOOST_GRID_GRAPH_TYPE_MEM edges_size_type>(graph)); + } + + template + friend inline Index + get(const grid_graph_index_map& index_map, + const typename grid_graph_index_map::key_type& key) + { + return (index_map[key]); + } + + template + friend struct grid_graph_index_map; + + }; // grid_graph + +} // namespace boost + +#undef BOOST_GRID_GRAPH_TYPE +#undef BOOST_GRID_GRAPH_TYPE_TD +#undef BOOST_GRID_GRAPH_TYPE_MEM +#undef BOOST_GRID_GRAPH_TEMPLATE_PARAMS +#undef BOOST_GRID_GRAPH_TRAITS_T + +#endif // BOOST_GRAPH_GRID_GRAPH_HPP diff --git a/deal.II/contrib/boost/include/boost/graph/gursoy_atun_layout.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/gursoy_atun_layout.hpp similarity index 63% rename from deal.II/contrib/boost/include/boost/graph/gursoy_atun_layout.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/gursoy_atun_layout.hpp index 7cc1f9738d..ed5e0509e3 100644 --- a/deal.II/contrib/boost/include/boost/graph/gursoy_atun_layout.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/gursoy_atun_layout.hpp @@ -28,6 +28,7 @@ #include #include #include +#include namespace boost { @@ -351,281 +352,6 @@ gursoy_atun_layout(const VertexListAndIncidenceGraph& graph, 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-1.41.0/include/boost/graph/howard_cycle_ratio.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/howard_cycle_ratio.hpp new file mode 100644 index 0000000000..709499ff02 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/howard_cycle_ratio.hpp @@ -0,0 +1,634 @@ +// Copyright (C) 2006-2009 Dmitry Bufistov and Andrey Parfenov + +// 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 BOOST_GRAPH_CYCLE_RATIO_HOWARD_HPP +#define BOOST_GRAPH_CYCLE_RATIO_HOWARD_HPP + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/** @file howard_cycle_ratio.hpp + * @brief The implementation of the maximum/minimum cycle ratio/mean algorithm. + * @author Dmitry Bufistov + * @author Andrey Parfenov + */ + +namespace boost { + + /** + * The mcr_float is like numeric_limits, but only for floating point types + * and only defines infinity() and epsilon(). This class is primarily used + * to encapsulate a less-precise epsilon than natively supported by the + * floating point type. + */ + template struct mcr_float { + typedef Float value_type; + + static Float infinity() + { return std::numeric_limits::infinity(); } + + static Float epsilon() + { return Float(-0.005); } + }; + + namespace detail { + + template struct + min_comparator_props { + typedef std::greater comparator; + static const int multiplier = 1; + }; + + template struct + max_comparator_props { + typedef std::less comparator; + static const int multiplier = -1; + }; + + template + struct float_wrapper { + typedef typename FloatTraits::value_type value_type; + typedef ComparatorProps comparator_props_t; + typedef typename ComparatorProps::comparator comparator; + + static value_type infinity() + { return FloatTraits::infinity() * ComparatorProps::multiplier; } + + static value_type epsilon() + { return FloatTraits::epsilon() * ComparatorProps::multiplier; } + + }; + + /*! @class mcr_howard + * @brief Calculates optimum (maximum/minimum) cycle ratio of a directed graph. + * Uses Howard's iteration policy algorithm.
(It is described in the paper + * "Experimental Analysis of the Fastest Optimum Cycle Ratio and Mean Algorithm" + * by Ali Dasdan). + */ + template + class mcr_howard + { + public: + typedef typename FloatTraits::value_type float_t; + typedef typename FloatTraits::comparator_props_t cmp_props_t; + typedef typename FloatTraits::comparator comparator_t; + typedef enum{ my_white = 0, my_black } my_color_type; + typedef typename graph_traits::vertex_descriptor vertex_t; + typedef typename graph_traits::edge_descriptor edge_t; + typedef typename graph_traits::vertices_size_type vn_t; + typedef std::vector vp_t; + typedef typename boost::iterator_property_map< + typename vp_t::iterator, VertexIndexMap + > distance_map_t; //V -> float_t + + typedef typename std::vector ve_t; + typedef std::vector vcol_t; + typedef typename ::boost::iterator_property_map< + typename ve_t::iterator, VertexIndexMap + > policy_t; //Vertex -> Edge + typedef typename ::boost::iterator_property_map< + typename vcol_t::iterator, VertexIndexMap + > color_map_t; + + typedef typename std::list pinel_t;// The in_edges list of the policy graph + typedef typename std::vector inedges1_t; + typedef typename ::boost::iterator_property_map< + typename inedges1_t::iterator, VertexIndexMap + > inedges_t; + typedef typename std::vector critical_cycle_t; + + //Bad vertex flag. If true, then the vertex is "bad". + // Vertex is "bad" if its out_degree is equal to zero. + typedef typename boost::iterator_property_map< + std::vector::iterator, VertexIndexMap + > badv_t; + + /*! + * Constructor + * \param g = (V, E) - a directed multigraph. + * \param vim Vertex Index Map. Read property Map: V -> [0, num_vertices(g)). + * \param ewm edge weight map. Read property map: E -> R + * \param ew2m edge weight map. Read property map: E -> R+ + * \param infty A big enough value to guaranty that there exist a cycle with + * better ratio. + * \param cmp The compare operator for float_ts. + */ + mcr_howard(const Graph &g, VertexIndexMap vim, + EdgeWeight1 ewm, EdgeWeight2 ew2m) : + m_g(g), m_vim(vim), m_ew1m(ewm), m_ew2m(ew2m), + m_bound(mcr_bound()), + m_cr(m_bound), + m_V(num_vertices(m_g)), + m_dis(m_V, 0), m_dm(m_dis.begin(), m_vim), + m_policyc(m_V), m_policy(m_policyc.begin(), m_vim), + m_inelc(m_V), m_inel(m_inelc.begin(), m_vim), + m_badvc(m_V, false), m_badv(m_badvc.begin(), m_vim), + m_colcv(m_V), + m_col_bfs(m_V) + { } + + /*! + * \return maximum/minimum_{for all cycles C} + * [sum_{e in C} w1(e)] / [sum_{e in C} w2(e)], + * or FloatTraits::infinity() if graph has no cycles. + */ + float_t ocr_howard() + { + construct_policy_graph(); + int k = 0; + float_t mcr = 0; + do + { + mcr = policy_mcr(); + ++k; + } + while (try_improve_policy(mcr) && k < 100); //To avoid infinite loop + + const float_t eps_ = -0.00000001 * cmp_props_t::multiplier; + if (m_cmp(mcr, m_bound + eps_)) + { + return FloatTraits::infinity(); + } + else + { + return mcr; + } + } + virtual ~mcr_howard() {} + + protected: + virtual void store_critical_edge(edge_t ed, critical_cycle_t &cc) {} + virtual void store_critical_cycle(critical_cycle_t &cc) {} + + private: + /*! + * \return lower/upper bound for the maximal/minimal cycle ratio + */ + float_t mcr_bound() + { + typename graph_traits::vertex_iterator vi, vie; + typename graph_traits::out_edge_iterator oei, oeie; + float_t cz = (std::numeric_limits::max)(); //Closest to zero value + float_t s = 0; + const float_t eps_ = std::numeric_limits::epsilon(); + for (tie(vi, vie) = vertices(m_g); vi != vie; ++vi) + { + for (tie(oei, oeie) = out_edges(*vi, m_g); oei != oeie; ++oei) + { + s += std::abs(m_ew1m[*oei]); + float_t a = std::abs(m_ew2m[*oei]); + if ( a > eps_ && a < cz) + { + cz = a; + } + } + } + return cmp_props_t::multiplier * (s / cz); + } + + + /*! + * Constructs an arbitrary policy graph. + */ + void construct_policy_graph() + { + m_sink = graph_traits().null_vertex(); + typename graph_traits::vertex_iterator vi, vie; + typename graph_traits::out_edge_iterator oei, oeie; + for ( tie(vi, vie) = vertices(m_g); vi != vie; ++vi ) + { + tie(oei, oeie) = out_edges(*vi, m_g); + typename graph_traits::out_edge_iterator mei = + std::max_element(oei, oeie, + bind(m_cmp, + bind(&EdgeWeight1::operator[], m_ew1m, _1), + bind(&EdgeWeight1::operator[], m_ew1m, _2) + ) + ); + if (mei == oeie) + { + if (m_sink == graph_traits().null_vertex()) + { + m_sink = *vi; + } + m_badv[*vi] = true; + m_inel[m_sink].push_back(*vi); + } + else + { + m_inel[target(*mei, m_g)].push_back(*vi); + m_policy[*vi] = *mei; + } + } + } + /*! Sets the distance value for all vertices "v" such that there is + * a path from "v" to "sv". It does "inverse" breadth first visit of the policy + * graph, starting from the vertex "sv". + */ + void mcr_bfv(vertex_t sv, float_t cr, color_map_t c) + { + boost::queue Q; + c[sv] = my_black; + Q.push(sv); + while (!Q.empty()) + { + vertex_t v = Q.top(); Q.pop(); + for (typename pinel_t::const_iterator itr = m_inel[v].begin(); + itr != m_inel[v].end(); ++itr) + //For all in_edges of the policy graph + { + if (*itr != sv) + { + if (m_badv[*itr]) + { + m_dm[*itr] = m_dm[v] + m_bound - cr; + } + else + { + m_dm[*itr] = m_dm[v] + m_ew1m[m_policy[*itr]] - + m_ew2m[m_policy[*itr]] * cr; + } + c[*itr] = my_black; + Q.push(*itr); + } + } + } + } + + /*! + * \param sv an arbitrary (undiscovered) vertex of the policy graph. + * \return a vertex in the policy graph that belongs to a cycle. + * Performs a depth first visit until a cycle edge is found. + */ + vertex_t find_cycle_vertex(vertex_t sv) + { + vertex_t gv = sv; + std::fill(m_colcv.begin(), m_colcv.end(), my_white); + color_map_t cm(m_colcv.begin(), m_vim); + do + { + cm[gv] = my_black; + if (! m_badv[gv]) + { + gv = target(m_policy[gv], m_g); + } + else + { + gv = m_sink; + } + } + while (cm[gv] != my_black); + return gv; + } + + /*! + * \param sv - vertex that belongs to a cycle in the policy graph. + */ + float_t cycle_ratio(vertex_t sv) + { + if (sv == m_sink) return m_bound; + std::pair sums_(float_t(0), float_t(0)); + vertex_t v = sv; + critical_cycle_t cc; + do + { + store_critical_edge(m_policy[v], cc); + sums_.first += m_ew1m[m_policy[v]]; + sums_.second += m_ew2m[m_policy[v]]; + v = target(m_policy[v], m_g); + } + while (v != sv); + float_t cr = sums_.first / sums_.second; + if ( m_cmp(m_cr, cr) ) + { + m_cr = cr; + store_critical_cycle(cc); + } + return cr; + } + + /*! + * Finds the optimal cycle ratio of the policy graph + */ + float_t policy_mcr() + { + std::fill(m_col_bfs.begin(), m_col_bfs.end(), my_white); + color_map_t vcm_ = color_map_t(m_col_bfs.begin(), m_vim); + typename graph_traits::vertex_iterator uv_itr, vie; + tie(uv_itr, vie) = vertices(m_g); + float_t mcr = m_bound; + while ( (uv_itr = std::find_if(uv_itr, vie, + bind(std::equal_to(), + my_white, + bind(&color_map_t::operator[], vcm_, _1) + ) + ) + ) != vie ) + ///While there are undiscovered vertices + { + vertex_t gv = find_cycle_vertex(*uv_itr); + float_t cr = cycle_ratio(gv) ; + mcr_bfv(gv, cr, vcm_); + if ( m_cmp(mcr, cr) ) mcr = cr; + ++uv_itr; + } + return mcr; + } + + /*! + * Changes the edge m_policy[s] to the new_edge. + */ + void improve_policy(vertex_t s, edge_t new_edge) + { + vertex_t t = target(m_policy[s], m_g); + typename property_traits::value_type ti = m_vim[t]; + m_inelc[ti].erase( std::find(m_inelc[ti].begin(), m_inelc[ti].end(), s)); + m_policy[s] = new_edge; + t = target(new_edge, m_g); + m_inel[t].push_back(s); ///Maintain in_edge list + } + + /*! + * A negative cycle detector. + */ + bool try_improve_policy(float_t cr) + { + bool improved = false; + typename graph_traits::vertex_iterator vi, vie; + typename graph_traits::out_edge_iterator oei, oeie; + const float_t eps_ = FloatTraits::epsilon(); + for (tie(vi, vie) = vertices(m_g); vi != vie; ++vi) + { + if (!m_badv[*vi]) + { + for (tie(oei, oeie) = out_edges(*vi, m_g); oei != oeie; ++oei) + { + vertex_t t = target(*oei, m_g); + //Current distance from *vi to some vertex + float_t dis_ = m_ew1m[*oei] - m_ew2m[*oei] * cr + m_dm[t]; + if ( m_cmp(m_dm[*vi] + eps_, dis_) ) + { + improve_policy(*vi, *oei); + m_dm[*vi] = dis_; + improved = true; + } + } + } + else + { + float_t dis_ = m_bound - cr + m_dm[m_sink]; + if ( m_cmp(m_dm[*vi] + eps_, dis_) ) + { + m_dm[*vi] = dis_; + } + } + } + return improved; + } + private: + const Graph &m_g; + VertexIndexMap m_vim; + EdgeWeight1 m_ew1m; + EdgeWeight2 m_ew2m; + comparator_t m_cmp; + float_t m_bound; //> The lower/upper bound to the maximal/minimal cycle ratio + float_t m_cr; //>The best cycle ratio that has been found so far + + vn_t m_V; //>The number of the vertices in the graph + vp_t m_dis; //>Container for the distance map + distance_map_t m_dm; //>Distance map + + ve_t m_policyc; //>Container for the policy graph + policy_t m_policy; //>The interface for the policy graph + + inedges1_t m_inelc; //>Container fot in edges list + inedges_t m_inel; //>Policy graph, input edges list + + std::vector m_badvc; + badv_t m_badv; //Marks "bad" vertices + + vcol_t m_colcv, m_col_bfs; //Color maps + vertex_t m_sink; //To convert any graph to "good" + }; + + /*! \class mcr_howard1 + * \brief Finds optimum cycle raio and a critical cycle + */ + template + class mcr_howard1 : public + mcr_howard + { + public: + typedef mcr_howard inhr_t; + mcr_howard1(const Graph &g, VertexIndexMap vim, + EdgeWeight1 ewm, EdgeWeight2 ew2m) : + inhr_t(g, vim, ewm, ew2m) + { } + + void get_critical_cycle(typename inhr_t::critical_cycle_t &cc) + { return cc.swap(m_cc); } + + protected: + void store_critical_edge(typename inhr_t::edge_t ed, + typename inhr_t::critical_cycle_t &cc) + { cc.push_back(ed); } + + void store_critical_cycle(typename inhr_t::critical_cycle_t &cc) + { m_cc.swap(cc); } + + private: + typename inhr_t::critical_cycle_t m_cc; //Critical cycle + }; + + /*! + * \param g a directed multigraph. + * \param vim Vertex Index Map. A map V->[0, num_vertices(g)) + * \param ewm Edge weight1 map. + * \param ew2m Edge weight2 map. + * \param pcc pointer to the critical edges list. + * \return Optimum cycle ratio of g or FloatTraits::infinity() if g has no cycles. + */ + template + typename FT::value_type + optimum_cycle_ratio(const TG &g, TVIM vim, TEW1 ewm, TEW2 ew2m, EV* pcc) + { + typedef typename graph_traits::directed_category DirCat; + BOOST_STATIC_ASSERT((is_convertible::value == true)); + function_requires< IncidenceGraphConcept >(); + function_requires< VertexListGraphConcept >(); + typedef typename graph_traits::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept >(); + typedef typename graph_traits::edge_descriptor Edge; + function_requires< ReadablePropertyMapConcept >(); + function_requires< ReadablePropertyMapConcept >(); + + if(pcc == 0) { + return detail::mcr_howard( + g, vim, ewm, ew2m + ).ocr_howard(); + } + + detail::mcr_howard1 obj(g, vim, ewm, ew2m); + double ocr = obj.ocr_howard(); + obj.get_critical_cycle(*pcc); + return ocr; + } + } // namespace detail + +// Algorithms +// Maximum Cycle Ratio + +template < + typename FloatTraits, + typename Graph, + typename VertexIndexMap, + typename EdgeWeight1Map, + typename EdgeWeight2Map> +inline typename FloatTraits::value_type +maximum_cycle_ratio(const Graph &g, VertexIndexMap vim, EdgeWeight1Map ew1m, + EdgeWeight2Map ew2m, + std::vector::edge_descriptor>* pcc = 0, + FloatTraits = FloatTraits()) +{ + typedef detail::float_wrapper< + FloatTraits, detail::max_comparator_props + > Traits; + return detail::optimum_cycle_ratio(g, vim, ew1m, ew2m, pcc); +} + +template < + typename Graph, + typename VertexIndexMap, + typename EdgeWeight1Map, + typename EdgeWeight2Map> +inline double +maximum_cycle_ratio(const Graph &g, VertexIndexMap vim, + EdgeWeight1Map ew1m, EdgeWeight2Map ew2m, + std::vector::edge_descriptor>* pcc = 0) +{ return maximum_cycle_ratio(g, vim, ew1m, ew2m, pcc, mcr_float<>()); } + +// Minimum Cycle Ratio + +template < + typename FloatTraits, + typename Graph, + typename VertexIndexMap, + typename EdgeWeight1Map, + typename EdgeWeight2Map> +typename FloatTraits::value_type +minimum_cycle_ratio(const Graph &g, VertexIndexMap vim, + EdgeWeight1Map ew1m, EdgeWeight2Map ew2m, + std::vector::edge_descriptor> *pcc = 0, + FloatTraits = FloatTraits()) +{ + typedef detail::float_wrapper< + FloatTraits, detail::min_comparator_props + > Traits; + return detail::optimum_cycle_ratio(g, vim, ew1m, ew2m, pcc); +} + +template < + typename Graph, + typename VertexIndexMap, + typename EdgeWeight1Map, + typename EdgeWeight2Map> +inline double +minimum_cycle_ratio(const Graph &g, VertexIndexMap vim, + EdgeWeight1Map ew1m, EdgeWeight2Map ew2m, + std::vector::edge_descriptor>* pcc = 0) +{ return minimum_cycle_ratio(g, vim, ew1m, ew2m, pcc, mcr_float<>()); } + +// Maximum Cycle Mean + +template < + typename FloatTraits, + typename Graph, + typename VertexIndexMap, + typename EdgeWeightMap, + typename EdgeIndexMap> +inline typename FloatTraits::value_type +maximum_cycle_mean(const Graph &g, VertexIndexMap vim, + EdgeWeightMap ewm, EdgeIndexMap eim, + std::vector::edge_descriptor>* pcc = 0, + FloatTraits ft = FloatTraits()) +{ + typedef typename remove_const< + typename property_traits::value_type + >::type Weight; + typename std::vector ed_w2(boost::num_edges(g), 1); + return maximum_cycle_ratio(g, vim, ewm, + make_iterator_property_map(ed_w2.begin(), eim), + pcc, ft); +} + +template < + typename Graph, + typename VertexIndexMap, + typename EdgeWeightMap, + typename EdgeIndexMap> +inline double +maximum_cycle_mean(const Graph& g, VertexIndexMap vim, + EdgeWeightMap ewm, EdgeIndexMap eim, + std::vector::edge_descriptor>* pcc = 0) +{ return maximum_cycle_mean(g, vim, ewm, eim, pcc, mcr_float<>()); } + +// Minimum Cycle Mean + +template < + typename FloatTraits, + typename Graph, + typename VertexIndexMap, + typename EdgeWeightMap, + typename EdgeIndexMap> +inline typename FloatTraits::value_type +minimum_cycle_mean(const Graph &g, VertexIndexMap vim, + EdgeWeightMap ewm, EdgeIndexMap eim, + std::vector::edge_descriptor>* pcc = 0, + FloatTraits ft = FloatTraits()) +{ + typedef typename remove_const< + typename property_traits::value_type + >::type Weight; + typename std::vector ed_w2(boost::num_edges(g), 1); + return minimum_cycle_ratio(g, vim, ewm, + make_iterator_property_map(ed_w2.begin(), eim), + pcc, ft); +} + +template < + typename Graph, + typename VertexIndexMap, + typename EdgeWeightMap, + typename EdgeIndexMap> +inline double +minimum_cycle_mean(const Graph &g, VertexIndexMap vim, + EdgeWeightMap ewm, EdgeIndexMap eim, + std::vector::edge_descriptor>* pcc = 0) +{ return minimum_cycle_mean(g, vim, ewm, eim, pcc, mcr_float<>()); } + +} //namespace boost + +#endif diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/incremental_components.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/incremental_components.hpp new file mode 100644 index 0000000000..43cc2a86f2 --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/incremental_components.hpp @@ -0,0 +1,230 @@ +// +//======================================================================= +// Copyright 1997-2001 University of Notre Dame. +// Copyright 2009 Trustees of Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Michael Hansen +// +// Distributed under the 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 +#include +#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. + // + + // 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); + } + + // Class that builds a quick-access indexed linked list that allows + // for fast iterating through a parent component's children. + template + class component_index { + + private: + typedef std::vector IndexContainer; + + public: + typedef counting_iterator iterator; + typedef iterator const_iterator; + typedef IndexType value_type; + typedef IndexType size_type; + + typedef detail::component_index_iterator + component_iterator; + + public: + template + component_index(ParentIterator parent_start, + ParentIterator parent_end, + const ElementIndexMap& index_map) : + m_num_elements(std::distance(parent_start, parent_end)), + m_components(make_shared()), + m_index_list(make_shared(m_num_elements)) { + + build_index_lists(parent_start, index_map); + + } // component_index + + template + component_index(ParentIterator parent_start, + ParentIterator parent_end) : + m_num_elements(std::distance(parent_start, parent_end)), + m_components(make_shared()), + m_index_list(make_shared(m_num_elements)) { + + build_index_lists(parent_start, boost::identity_property_map()); + + } // component_index + + // Returns the number of components + inline std::size_t size() const { + return (m_components->size()); + } + + // Beginning iterator for component indices + iterator begin() const { + return (iterator(0)); + } + + // End iterator for component indices + iterator end() const { + return (iterator(this->size())); + } + + // Returns a pair of begin and end iterators for the child + // elements of component [component_index]. + std::pair + operator[](IndexType component_index) const { + + IndexType first_index = (*m_components)[component_index]; + + return (std::make_pair + (component_iterator(m_index_list->begin(), first_index), + component_iterator(m_num_elements))); + } + + private: + template + void build_index_lists(ParentIterator parent_start, + const ElementIndexMap& index_map) { + + typedef typename ParentIterator::value_type Element; + typename IndexContainer::iterator index_list = + m_index_list->begin(); + + // First pass - find root elements, construct index list + for (IndexType element_index = 0; element_index < m_num_elements; + ++element_index) { + + Element parent_element = parent_start[element_index]; + IndexType parent_index = get(index_map, parent_element); + + if (element_index != parent_index) { + index_list[element_index] = parent_index; + } + else { + m_components->push_back(element_index); + + // m_num_elements is the linked list terminator + index_list[element_index] = m_num_elements; + } + } + + // Second pass - build linked list + for (IndexType element_index = 0; element_index < m_num_elements; + ++element_index) { + + Element parent_element = parent_start[element_index]; + IndexType parent_index = get(index_map, parent_element); + + if (element_index != parent_index) { + + // Follow list until a component parent is found + while (index_list[parent_index] != m_num_elements) { + parent_index = index_list[parent_index]; + } + + // Push element to the front of the linked list + index_list[element_index] = index_list[parent_index]; + index_list[parent_index] = element_index; + } + } + + } // build_index_lists + + protected: + IndexType m_num_elements; + shared_ptr m_components, m_index_list; + + }; // class component_index + +} // namespace boost + +#endif // BOOST_INCREMENTAL_COMPONENTS_HPP diff --git a/deal.II/contrib/boost/include/boost/graph/is_kuratowski_subgraph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/is_kuratowski_subgraph.hpp similarity index 96% rename from deal.II/contrib/boost/include/boost/graph/is_kuratowski_subgraph.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/is_kuratowski_subgraph.hpp index c510c3ab7b..fab0b0246f 100644 --- a/deal.II/contrib/boost/include/boost/graph/is_kuratowski_subgraph.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/is_kuratowski_subgraph.hpp @@ -11,7 +11,7 @@ #include #include //for next/prior #include //for tie -#include +#include #include #include #include @@ -97,6 +97,8 @@ namespace boost } + enum target_graph_t { tg_k_3_3, tg_k_5}; + } // namespace detail @@ -123,9 +125,7 @@ namespace boost 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 + detail::target_graph_t target_graph = detail::tg_k_3_3; //unless we decide otherwise later static small_graph_t K_5(detail::make_K_5()); @@ -245,11 +245,11 @@ namespace boost for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) if (neighbors[*vi].size() == 4) { - target_graph = k_5; + target_graph = detail::tg_k_5; break; } - if (target_graph == k_3_3) + if (target_graph == detail::tg_k_3_3) break; } @@ -299,11 +299,11 @@ namespace boost } } - if (target_graph == k_5) + if (target_graph == detail::tg_k_5) { return isomorphism(K_5,contracted_graph); } - else //target_graph == k_3_3 + else //target_graph == tg_k_3_3 { return isomorphism(K_3_3,contracted_graph); } diff --git a/deal.II/contrib/boost/include/boost/graph/is_straight_line_drawing.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/is_straight_line_drawing.hpp similarity index 87% rename from deal.II/contrib/boost/include/boost/graph/is_straight_line_drawing.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/is_straight_line_drawing.hpp index f533bce2df..1377e3e9e8 100644 --- a/deal.II/contrib/boost/include/boost/graph/is_straight_line_drawing.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/is_straight_line_drawing.hpp @@ -12,7 +12,7 @@ #include //for next and prior #include #include -#include +#include #include #include @@ -164,7 +164,7 @@ namespace boost 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) + if (drawing[source_v].y > drawing[target_v].y) std::swap(source_v, target_v); active_map_key_t key(get(drawing, source_v).y, @@ -185,14 +185,34 @@ namespace boost before = active_edges.end(); else before = prior(a_itr); - after = next(a_itr); + after = boost::next(a_itr); - if (after != active_edges.end() || before != active_edges.end()) + if (before != active_edges.end()) { - edge_t f = after != active_edges.end() ? - after->second : before->second; + edge_t f = 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; + } + + if (after != active_edges.end()) + { + + edge_t f = after->second; vertex_t e_source(source(e,g)); vertex_t e_target(target(e,g)); vertex_t f_source(source(f,g)); diff --git a/deal.II/contrib/boost/include/boost/graph/isomorphism.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/isomorphism.hpp similarity index 97% rename from deal.II/contrib/boost/include/boost/graph/isomorphism.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/isomorphism.hpp index 842f914356..29f6ef2c58 100644 --- a/deal.II/contrib/boost/include/boost/graph/isomorphism.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/isomorphism.hpp @@ -237,7 +237,7 @@ namespace boost { 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)) + if (match(boost::next(iter), next_k)) return true; in_S[v] = false; } @@ -247,7 +247,7 @@ namespace boost { else { if (container_contains(adjacent_vertices(f[i], G2), f[j])) { ++num_edges_on_k; - if (match(next(iter), dfs_num_k)) + if (match(boost::next(iter), dfs_num_k)) return true; } @@ -439,13 +439,11 @@ namespace boost { return false; #endif - for (typename graph_traits::edge_iterator e1 = edges(g1).first; - e1 != edges(g1).second; ++e1) { + BGL_FORALL_EDGES_T(e1, g1, Graph1) { 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))) { + BGL_FORALL_EDGES_T(e2, g2, Graph2) { + if (source(e2, g2) == get(iso_map, source(e1, g1)) && + target(e2, g2) == get(iso_map, target(e1, g1))) { found_edge = true; } } diff --git a/deal.II/contrib/boost/include/boost/graph/iteration_macros.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/iteration_macros.hpp similarity index 64% rename from deal.II/contrib/boost/include/boost/graph/iteration_macros.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/iteration_macros.hpp index 850e887518..2bf40f9580 100644 --- a/deal.II/contrib/boost/include/boost/graph/iteration_macros.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/iteration_macros.hpp @@ -10,9 +10,12 @@ #ifndef BOOST_GRAPH_ITERATION_MACROS_HPP #define BOOST_GRAPH_ITERATION_MACROS_HPP +#include + #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) +#define BGL_RANGE(linenum) BGL_CAT(bgl_range_,linenum) +#define BGL_FIRST(linenum) (BGL_RANGE(linenum).first) +#define BGL_LAST(linenum) (BGL_RANGE(linenum).second) /* BGL_FORALL_VERTICES_T(v, g, graph_t) // This is on line 9 @@ -22,7 +25,7 @@ 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 != bgl_last_9 ? (v = *bgl_first_9, true) : false; ++bgl_first_9) The purpose of having two for-loops is just to provide a place to @@ -37,90 +40,98 @@ Use the _T versions when the graph type is a template parameter or dependent on a template parameter. Otherwise use the non _T versions. + ----------------------- + 6/9/09 THK + + The above contains two calls to the vertices function. I modified these + macros to expand to + + for (std::pair::vertex_iterator, + typename boost::graph_traits::vertex_iterator> bgl_range_9 = vertices(g); + bgl_range_9.first != bgl_range_9.second; + bgl_range_9.first = bgl_range_9.second) + for (typename boost::graph_traits::vertex_descriptor v; + bgl_range_9.first != bgl_range_9.second ? (v = *bgl_range_9.first, true) : false; + ++bgl_range_9.first) + */ #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; \ +for (std::pair::vertex_iterator, \ + typename boost::graph_traits::vertex_iterator> BGL_RANGE(__LINE__) = vertices(GNAME); \ 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; \ +for (std::pair::vertex_iterator, \ + boost::graph_traits::vertex_iterator> BGL_RANGE(__LINE__) = vertices(GNAME); \ 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; \ +for (std::pair::edge_iterator, \ + typename boost::graph_traits::edge_iterator> BGL_RANGE(__LINE__) = edges(GNAME); \ 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; \ +for (std::pair::edge_iterator, \ + boost::graph_traits::edge_iterator> BGL_RANGE(__LINE__) = edges(GNAME); \ 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; \ +for (std::pair::adjacency_iterator, \ + typename boost::graph_traits::adjacency_iterator> BGL_RANGE(__LINE__) = adjacent_vertices(UNAME, GNAME); \ 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; \ +for (std::pair::adjacency_iterator, \ + boost::graph_traits::adjacency_iterator> BGL_RANGE(__LINE__) = adjacent_vertices(UNAME, GNAME); \ 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; \ +for (std::pair::out_edge_iterator, \ + typename boost::graph_traits::out_edge_iterator> BGL_RANGE(__LINE__) = out_edges(UNAME, GNAME); \ 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; \ +for (std::pair::out_edge_iterator, \ + boost::graph_traits::out_edge_iterator> BGL_RANGE(__LINE__) = out_edges(UNAME, GNAME); \ 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; \ +for (std::pair::in_edge_iterator, \ + typename boost::graph_traits::in_edge_iterator> BGL_RANGE(__LINE__) = in_edges(UNAME, GNAME); \ 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; \ +for (std::pair::in_edge_iterator, \ + boost::graph_traits::in_edge_iterator> BGL_RANGE(__LINE__) = in_edges(UNAME, GNAME); \ 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; \ diff --git a/deal.II/contrib/boost/include/boost/graph/iteration_macros_undef.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/iteration_macros_undef.hpp similarity index 100% rename from deal.II/contrib/boost/include/boost/graph/iteration_macros_undef.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/iteration_macros_undef.hpp diff --git a/deal.II/contrib/boost/include/boost/graph/johnson_all_pairs_shortest.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/johnson_all_pairs_shortest.hpp similarity index 94% rename from deal.II/contrib/boost/include/boost/graph/johnson_all_pairs_shortest.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/johnson_all_pairs_shortest.hpp index 45a8cf2c95..0720411c5a 100644 --- a/deal.II/contrib/boost/include/boost/graph/johnson_all_pairs_shortest.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/johnson_all_pairs_shortest.hpp @@ -23,7 +23,8 @@ #define BOOST_GRAPH_JOHNSON_HPP #include -#include +#include +#include #include #include #include @@ -94,12 +95,10 @@ namespace boost { } 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); + shared_array_property_map h(num_vertices(g2), id2); for (tie(v, v_end) = vertices(g2); v != v_end; ++v) - d[*v] = inf; + put(d, *v, inf); put(d, s, zero); // Using the non-named parameter versions of bellman_ford and @@ -113,7 +112,7 @@ namespace boost { 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)); + put(w_hat, *e, combine(get(w, *e), (get(h, a) - get(h, b)))); } for (tie(u, u_end) = vertices(g2); u != u_end; ++u) { dijkstra_visitor<> dvis; @@ -122,8 +121,8 @@ namespace boost { 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); + u1 = verts1[get(id2, *u)]; v1 = verts1[get(id2, *v)]; + D[get(id2, *u)-1][get(id2, *v)-1] = combine(get(d, *v), (get(h, *v) - get(h, *u))); } } } diff --git a/deal.II/contrib/boost/include/boost/graph/kamada_kawai_spring_layout.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/kamada_kawai_spring_layout.hpp similarity index 72% rename from deal.II/contrib/boost/include/boost/graph/kamada_kawai_spring_layout.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/kamada_kawai_spring_layout.hpp index 00dbcb76ea..0262e1fc28 100644 --- a/deal.II/contrib/boost/include/boost/graph/kamada_kawai_spring_layout.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/kamada_kawai_spring_layout.hpp @@ -10,6 +10,8 @@ #define BOOST_GRAPH_KAMADA_KAWAI_SPRING_LAYOUT_HPP #include +#include +#include #include #include #include @@ -67,22 +69,82 @@ namespace boost { return length.value / result; } + /** + * Dense linear solver for fixed-size matrices. + */ + template + struct linear_solver { + // Indices in mat are (row, column) + // template + // static Vec solve(double mat[Size][Size], Vec rhs); + }; + + template <> + struct linear_solver<1> { + template + static Vec solve(double mat[1][1], Vec rhs) { + return rhs / mat[0][0]; + } + }; + + // These are from http://en.wikipedia.org/wiki/Cramer%27s_rule + template <> + struct linear_solver<2> { + template + static Vec solve(double mat[2][2], Vec rhs) { + double denom = mat[0][0] * mat[1][1] - mat[1][0] * mat[0][1]; + double x_num = rhs[0] * mat[1][1] - rhs[1] * mat[0][1]; + double y_num = mat[0][0] * rhs[1] - mat[1][0] * rhs[0] ; + Vec result; + result[0] = x_num / denom; + result[1] = y_num / denom; + return result; + } + }; + + template <> + struct linear_solver<3> { + template + static Vec solve(double mat[2][2], Vec rhs) { + double denom = mat[0][0] * (mat[1][1] * mat[2][2] - mat[2][1] * mat[1][2]) + - mat[1][0] * (mat[0][1] * mat[2][2] - mat[2][1] * mat[0][2]) + + mat[2][0] * (mat[0][1] * mat[1][2] - mat[1][1] * mat[0][2]); + double x_num = rhs[0] * (mat[1][1] * mat[2][2] - mat[2][1] * mat[1][2]) + - rhs[1] * (mat[0][1] * mat[2][2] - mat[2][1] * mat[0][2]) + + rhs[2] * (mat[0][1] * mat[1][2] - mat[1][1] * mat[0][2]); + double y_num = mat[0][0] * (rhs[1] * mat[2][2] - rhs[2] * mat[1][2]) + - mat[1][0] * (rhs[0] * mat[2][2] - rhs[2] * mat[0][2]) + + mat[2][0] * (rhs[0] * mat[1][2] - rhs[1] * mat[0][2]); + double z_num = mat[0][0] * (mat[1][1] * rhs[2] - mat[2][1] * rhs[1] ) + - mat[1][0] * (mat[0][1] * rhs[2] - mat[2][1] * rhs[0] ) + + mat[2][0] * (mat[0][1] * rhs[1] - mat[1][1] * rhs[0] ); + Vec result; + result[0] = x_num / denom; + result[1] = y_num / denom; + result[2] = z_num / denom; + return 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 Topology::point_type Point; + typedef typename Topology::point_difference_type point_difference_type; + typedef point_difference_type deriv_type; typedef typename graph_traits::vertex_iterator vertex_iterator; typedef typename graph_traits::vertex_descriptor vertex_descriptor; kamada_kawai_spring_layout_impl( + const Topology& topology, const Graph& g, PositionMap position, WeightMap weight, @@ -93,7 +155,7 @@ namespace boost { DistanceMatrix distance, SpringStrengthMatrix spring_strength, PartialDerivativeMap partial_derivatives) - : g(g), position(position), weight(weight), + : topology(topology), 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), @@ -108,15 +170,12 @@ namespace boost { using std::sqrt; #endif // BOOST_NO_STDC_NAMESPACE - deriv_type result(0, 0); + deriv_type result; 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); + point_difference_type diff = topology.difference(position[m], position[i]); + weight_type dist = topology.norm(diff); + result = spring_strength[get(index, m)][get(index, i)] + * (diff - distance[get(index, m)][get(index, i)]/dist*diff); } return result; @@ -130,15 +189,12 @@ namespace boost { using std::sqrt; #endif // BOOST_NO_STDC_NAMESPACE - deriv_type result(0, 0); + deriv_type result; // 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; + BGL_FORALL_VERTICES_T(i, g, Graph) { deriv_type deriv = compute_partial_derivative(m, i); - result.first += deriv.first; - result.second += deriv.second; + result += deriv; } return result; @@ -185,8 +241,7 @@ namespace boost { deriv_type deriv = compute_partial_derivatives(*ui); put(partial_derivatives, *ui, deriv); - weight_type delta = - sqrt(deriv.first*deriv.first + deriv.second*deriv.second); + weight_type delta = topology.norm(deriv); if (delta > delta_p) { p = *ui; @@ -206,47 +261,48 @@ namespace boost { } 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; + // Compute the elements of the Jacobian + // From + // http://www.cs.panam.edu/~rfowler/papers/1994_kumar_fowler_A_Spring_UTPACSTR.pdf + // with the bugs fixed in the off-diagonal case + weight_type dE_d_d[Point::dimensions][Point::dimensions]; + for (std::size_t i = 0; i < Point::dimensions; ++i) + for (std::size_t j = 0; j < Point::dimensions; ++j) + dE_d_d[i][j] = 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; + point_difference_type diff = topology.difference(position[p], position[i]); + weight_type dist = topology.norm(diff); + weight_type dist_squared = dist * dist; + weight_type inv_dist_cubed = 1. / (dist_squared * 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); + for (std::size_t i = 0; i < Point::dimensions; ++i) { + for (std::size_t j = 0; j < Point::dimensions; ++j) { + if (i == j) { + dE_d_d[i][i] += k_mi * (1 + (l_mi * (diff[i] * diff[i] - dist_squared) * inv_dist_cubed)); + } else { + dE_d_d[i][j] += k_mi * l_mi * diff[i] * diff[j] * inv_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); + deriv_type dE_d = get(partial_derivatives, p); - 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); + // Solve dE_d_d * delta = dE_d to get delta + point_difference_type delta = -linear_solver::solve(dE_d_d, dE_d); - - // Move p by (delta_x, delta_y) - position[p].x += delta_x; - position[p].y += delta_y; + // Move p by delta + position[p] = topology.adjust(position[p], delta); // 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); + delta_p = topology.norm(deriv); } while (!done(delta_p, p, g, false)); // Select new p by updating each partial derivative and delta @@ -257,12 +313,10 @@ namespace boost { 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; + deriv += old_p_partial - old_deriv_p; put(partial_derivatives, *ui, deriv); - weight_type delta = - sqrt(deriv.first*deriv.first + deriv.second*deriv.second); + weight_type delta = topology.norm(deriv); if (delta > delta_p) { p = *ui; @@ -274,6 +328,7 @@ namespace boost { return true; } + const Topology& topology; const Graph& g; PositionMap position; WeightMap weight; @@ -373,6 +428,9 @@ namespace boost { * \param weight (IN) must be a model of Readable Property Map, * which provides the weight of each edge in the graph @p g. * + * \param topology (IN) must be a topology object (see topology.hpp), + * which provides operations on points and differences between them. + * * \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 @@ -417,7 +475,7 @@ namespace boost { * \returns @c true if layout was successful or @c false if a * negative weight cycle was detected. */ - template @@ -426,6 +484,7 @@ namespace boost { const Graph& g, PositionMap position, WeightMap weight, + const Topology& topology, detail::graph::edge_or_side edge_or_side_length, Done done, typename property_traits::value_type spring_constant, @@ -440,10 +499,10 @@ namespace boost { >::value)); detail::graph::kamada_kawai_spring_layout_impl< - Graph, PositionMap, WeightMap, + Topology, Graph, PositionMap, WeightMap, detail::graph::edge_or_side, Done, VertexIndexMap, DistanceMatrix, SpringStrengthMatrix, PartialDerivativeMap> - alg(g, position, weight, edge_or_side_length, done, spring_constant, + alg(topology, g, position, weight, edge_or_side_length, done, spring_constant, index, distance, spring_strength, partial_derivatives); return alg.run(); } @@ -451,7 +510,7 @@ namespace boost { /** * \overload */ - template bool @@ -459,6 +518,7 @@ namespace boost { const Graph& g, PositionMap position, WeightMap weight, + const Topology& topology, detail::graph::edge_or_side edge_or_side_length, Done done, typename property_traits::value_type spring_constant, @@ -471,32 +531,33 @@ namespace boost { std::vector distance(n, weight_vec(n)); std::vector spring_strength(n, weight_vec(n)); - std::vector > partial_derivatives(n); + std::vector partial_derivatives(n); return kamada_kawai_spring_layout( - g, position, weight, edge_or_side_length, done, spring_constant, index, + g, position, weight, topology, edge_or_side_length, done, spring_constant, index, distance.begin(), spring_strength.begin(), make_iterator_property_map(partial_derivatives.begin(), index, - std::pair())); + typename Topology::point_difference_type())); } /** * \overload */ - template bool kamada_kawai_spring_layout( const Graph& g, PositionMap position, WeightMap weight, + const Topology& topology, 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, + return kamada_kawai_spring_layout(g, position, weight, topology, edge_or_side_length, done, spring_constant, get(vertex_index, g)); } @@ -504,35 +565,37 @@ namespace boost { /** * \overload */ - template bool kamada_kawai_spring_layout( const Graph& g, PositionMap position, WeightMap weight, + const Topology& topology, 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, + return kamada_kawai_spring_layout(g, position, weight, topology, edge_or_side_length, done, weight_type(1)); } /** * \overload */ - template bool kamada_kawai_spring_layout( const Graph& g, PositionMap position, WeightMap weight, + const Topology& topology, 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, + return kamada_kawai_spring_layout(g, position, weight, topology, edge_or_side_length, layout_tolerance(), weight_type(1.0), get(vertex_index, g)); diff --git a/deal.II/contrib/boost/include/boost/graph/king_ordering.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/king_ordering.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/graph/king_ordering.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/king_ordering.hpp index dadd963f86..774972732a 100644 --- a/deal.II/contrib/boost/include/boost/graph/king_ordering.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/king_ordering.hpp @@ -13,6 +13,7 @@ #include #include +#include /* King Algorithm for matrix reordering @@ -262,7 +263,7 @@ namespace boost { king_ordering(const Graph& G, OutputIterator permutation, ColorMap color, DegreeMap degree, VertexIndexMap index_map) { - if (vertices(G).first == vertices(G).second) + if (has_no_vertices(G)) return permutation; typedef typename boost::graph_traits::vertex_descriptor Vertex; @@ -298,7 +299,7 @@ namespace boost { king_ordering(const Graph& G, OutputIterator permutation, VertexIndexMap index_map) { - if (vertices(G).first == vertices(G).second) + if (has_no_vertices(G)) return permutation; typedef out_degree_property_map DegreeMap; diff --git a/deal.II/contrib/boost/include/boost/graph/kolmogorov_max_flow.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/kolmogorov_max_flow.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/graph/kolmogorov_max_flow.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/kolmogorov_max_flow.hpp index e74796d34e..328bd30341 100644 --- a/deal.II/contrib/boost/include/boost/graph/kolmogorov_max_flow.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/kolmogorov_max_flow.hpp @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include #include @@ -344,7 +344,7 @@ namespace boost { /** * 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]; @@ -467,7 +467,7 @@ namespace boost { /** * 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()) @@ -486,7 +486,7 @@ namespace boost { /** * 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]){ @@ -545,7 +545,7 @@ namespace boost { /** * 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; @@ -676,7 +676,7 @@ namespace boost { /** * non-named-parameter version, given everything * this is the catch all version - */ + */ template typename property_traits::value_type diff --git a/deal.II/contrib/boost/include/boost/graph/kruskal_min_spanning_tree.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/kruskal_min_spanning_tree.hpp similarity index 99% rename from deal.II/contrib/boost/include/boost/graph/kruskal_min_spanning_tree.hpp rename to deal.II/contrib/boost-1.41.0/include/boost/graph/kruskal_min_spanning_tree.hpp index 50fc8049f8..a847e3f156 100644 --- a/deal.II/contrib/boost/include/boost/graph/kruskal_min_spanning_tree.hpp +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/kruskal_min_spanning_tree.hpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include diff --git a/deal.II/contrib/boost-1.41.0/include/boost/graph/labeled_graph.hpp b/deal.II/contrib/boost-1.41.0/include/boost/graph/labeled_graph.hpp new file mode 100644 index 0000000000..c7f40260eb --- /dev/null +++ b/deal.II/contrib/boost-1.41.0/include/boost/graph/labeled_graph.hpp @@ -0,0 +1,811 @@ +// Copyright (C) 2009 Andrew Sutton + +// 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 BOOST_GRAPH_LABELED_GRAPH_HPP +#define BOOST_GRAPH_LABELED_GRAPH_HPP + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// This file implements a utility for creating mappings from arbitrary +// identifers to the vertices of a graph. + +namespace boost { + +// A type selector that denotes the use of some default value. +struct defaultS { }; + +/** @internal */ +namespace graph_detail { + /** Returns true if the selector is the default selector. */ + template + struct is_default + : mpl::bool_::value> + { }; + + /** + * Choose the default map instance. If Label is an unsigned integral type + * the we can use a vector to store the information. + */ + template + struct choose_default_map { + typedef typename mpl::if_< + is_unsigned