File indexing completed on 2025-01-18 09:42:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_NESTED_ALGEBRA_HPP_INCLUDED
0020 #define BOOST_NUMERIC_ODEINT_EXTERNAL_MPI_MPI_NESTED_ALGEBRA_HPP_INCLUDED
0021
0022 #include <boost/numeric/odeint/algebra/norm_result_type.hpp>
0023 #include <boost/numeric/odeint/util/n_ary_helper.hpp>
0024
0025 namespace boost {
0026 namespace numeric {
0027 namespace odeint {
0028
0029
0030
0031 template< class InnerAlgebra >
0032 struct mpi_nested_algebra
0033 {
0034
0035
0036 #define BOOST_ODEINT_GEN_BODY(n) \
0037 InnerAlgebra::for_each##n( \
0038 BOOST_PP_ENUM_BINARY_PARAMS(n, s, () BOOST_PP_INTERCEPT) , \
0039 op \
0040 );
0041 BOOST_ODEINT_GEN_FOR_EACH(BOOST_ODEINT_GEN_BODY)
0042 #undef BOOST_ODEINT_GEN_BODY
0043
0044
0045 template< class NestedState >
0046 static typename norm_result_type< typename NestedState::value_type >::type norm_inf( const NestedState &s )
0047 {
0048 typedef typename norm_result_type< typename NestedState::value_type >::type result_type;
0049
0050 result_type value = InnerAlgebra::norm_inf( s() );
0051
0052 return boost::mpi::all_reduce(s.world, value, boost::mpi::maximum<result_type>());
0053 }
0054
0055 };
0056
0057
0058 }
0059 }
0060 }
0061
0062 #endif