1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_NESTED_ALGEBRA_HPP_INCLUDED
- #define BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_NESTED_ALGEBRA_HPP_INCLUDED
- #include <boost/numeric/odeint/algebra/norm_result_type.hpp>
- #include <boost/numeric/odeint/util/n_ary_helper.hpp>
- namespace boost {
- namespace numeric {
- namespace odeint {
- template< class InnerAlgebra >
- struct mpi_nested_algebra
- {
- #define BOOST_ODEINT_GEN_BODY(n) \
- InnerAlgebra::for_each##n( \
- BOOST_PP_ENUM_BINARY_PARAMS(n, s, () BOOST_PP_INTERCEPT) , \
- op \
- );
- BOOST_ODEINT_GEN_FOR_EACH(BOOST_ODEINT_GEN_BODY)
- #undef BOOST_ODEINT_GEN_BODY
- template< class NestedState >
- static typename norm_result_type< typename NestedState::value_type >::type norm_inf( const NestedState &s )
- {
- typedef typename norm_result_type< typename NestedState::value_type >::type result_type;
-
- result_type value = InnerAlgebra::norm_inf( s() );
-
- return boost::mpi::all_reduce(s.world, value, boost::mpi::maximum<result_type>());
- }
- };
- }
- }
- }
- #endif
|