00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef OPM_BLACKOILLEGACYDETAILS_HEADER_INCLUDED
00025 #define OPM_BLACKOILLEGACYDETAILS_HEADER_INCLUDED
00026
00027 #include <opm/core/linalg/ParallelIstlInformation.hpp>
00028
00029 namespace Opm {
00030 namespace detail {
00036 template <class ADB>
00037 inline
00038 double infinityNorm( const ADB& a, const boost::any& pinfo = boost::any() )
00039 {
00040 static_cast<void>(pinfo);
00041 #if HAVE_MPI
00042 if ( pinfo.type() == typeid(ParallelISTLInformation) )
00043 {
00044 const ParallelISTLInformation& real_info =
00045 boost::any_cast<const ParallelISTLInformation&>(pinfo);
00046 double result=0;
00047 real_info.computeReduction(a.value(), Reduction::makeLInfinityNormFunctor<double>(), result);
00048 return result;
00049 }
00050 else
00051 #endif
00052 {
00053 if( a.value().size() > 0 ) {
00054 return a.value().matrix().template lpNorm<Eigen::Infinity> ();
00055 }
00056 else {
00057 return 0.0;
00058 }
00059 }
00060 }
00061
00065 template <class ADB>
00066 inline
00067 double infinityNormWell( const ADB& a, const boost::any& pinfo )
00068 {
00069 static_cast<void>(pinfo);
00070 double result=0;
00071 if( a.value().size() > 0 ) {
00072 result = a.value().matrix().template lpNorm<Eigen::Infinity> ();
00073 }
00074 #if HAVE_MPI
00075 if ( pinfo.type() == typeid(ParallelISTLInformation) )
00076 {
00077 const ParallelISTLInformation& real_info =
00078 boost::any_cast<const ParallelISTLInformation&>(pinfo);
00079 result = real_info.communicator().max(result);
00080 }
00081 #endif
00082 return result;
00083 }
00084 }
00085 }
00086
00087 #endif // OPM_BLACKOILDETAILS_HEADER_INCLUDED