mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-24 16:30:02 -06:00
changed: replace boost::any with std::any
This commit is contained in:
parent
39f5e49289
commit
4ba7d3a7bc
@ -537,7 +537,7 @@ namespace Opm
|
||||
std::unique_ptr<EbosSimulator> ebosSimulator_;
|
||||
int mpi_rank_ = 0;
|
||||
int mpi_size_ = 1;
|
||||
boost::any parallel_information_;
|
||||
std::any parallel_information_;
|
||||
std::unique_ptr<Simulator> simulator_;
|
||||
};
|
||||
} // namespace Opm
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <opm/simulators/linalg/ParallelIstlInformation.hpp>
|
||||
#include <opm/core/props/BlackoilPhases.hpp>
|
||||
|
||||
#include <any>
|
||||
|
||||
namespace Opm {
|
||||
namespace detail {
|
||||
|
||||
@ -103,7 +105,7 @@ namespace detail {
|
||||
/// \param pinfo In a parallel this holds the information about the data distribution.
|
||||
template <class Iterator>
|
||||
inline
|
||||
double euclidianNormSquared( Iterator it, const Iterator end, int num_components, const boost::any& pinfo = boost::any() )
|
||||
double euclidianNormSquared( Iterator it, const Iterator end, int num_components, const std::any& pinfo = std::any() )
|
||||
{
|
||||
static_cast<void>(num_components); // Suppress warning in the serial case.
|
||||
static_cast<void>(pinfo); // Suppress warning in non-MPI case.
|
||||
@ -111,7 +113,7 @@ namespace detail {
|
||||
if ( pinfo.type() == typeid(ParallelISTLInformation) )
|
||||
{
|
||||
const ParallelISTLInformation& info =
|
||||
boost::any_cast<const ParallelISTLInformation&>(pinfo);
|
||||
std::any_cast<const ParallelISTLInformation&>(pinfo);
|
||||
typedef typename Iterator::value_type Scalar;
|
||||
Scalar product = 0.0;
|
||||
int size_per_component = (end - it);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#if defined(HAVE_OPM_GRID)
|
||||
#if defined(HAVE_MPI) && defined(HAVE_DUNE_ISTL)
|
||||
// Extracts the information about the data decomposition from the grid for dune-istl
|
||||
void extractParallelGridInformationToISTL(const Dune::CpGrid& grid, boost::any& anyComm)
|
||||
void extractParallelGridInformationToISTL(const Dune::CpGrid& grid, std::any& anyComm)
|
||||
{
|
||||
if(grid.comm().size()>1)
|
||||
{
|
||||
@ -35,14 +35,14 @@ void extractParallelGridInformationToISTL(const Dune::CpGrid& grid, boost::any&
|
||||
Dune::CpGrid& mgrid=const_cast<Dune::CpGrid&>(grid);
|
||||
Dune::CpGrid::ParallelIndexSet& idx=mgrid.getCellIndexSet();
|
||||
Dune::CpGrid::RemoteIndices& ridx=mgrid.getCellRemoteIndices();
|
||||
anyComm=boost::any(Opm::ParallelISTLInformation(Dune::stackobject_to_shared_ptr(idx),
|
||||
anyComm=std::any(Opm::ParallelISTLInformation(Dune::stackobject_to_shared_ptr(idx),
|
||||
Dune::stackobject_to_shared_ptr(ridx),
|
||||
grid.comm()));
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Missing support for MPI or dune-istl -> do nothing.
|
||||
void extractParallelGridInformationToISTL(const Dune::CpGrid&, boost::any&)
|
||||
void extractParallelGridInformationToISTL(const Dune::CpGrid&, std::any&)
|
||||
{}
|
||||
#endif //defined(HAVE_MPI) && defined(HAVE_DUNE_ISTL)
|
||||
#endif //defined(HAVE_OPM_GRID)
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifdef HAVE_OPM_GRID
|
||||
|
||||
#include<opm/grid/CpGrid.hpp>
|
||||
#include<boost/any.hpp>
|
||||
#include <any>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
@ -37,11 +37,11 @@ namespace Opm
|
||||
/// \param[out] anyComm The handle to to store the information in. If grid is a parallel grid
|
||||
/// then this will ecapsulate an instance of ParallelISTLInformation.
|
||||
|
||||
void extractParallelGridInformationToISTL(const Dune::CpGrid& grid, boost::any& anyComm);
|
||||
void extractParallelGridInformationToISTL(const Dune::CpGrid& grid, std::any& anyComm);
|
||||
|
||||
// Grid is not CpGrid --> do nothing.
|
||||
template <class Grid>
|
||||
void extractParallelGridInformationToISTL(const Grid&, boost::any&)
|
||||
void extractParallelGridInformationToISTL(const Grid&, std::any&)
|
||||
{}
|
||||
|
||||
} // end namespace Opm
|
||||
|
@ -123,14 +123,14 @@ public:
|
||||
WellModelMatrixAdapter (const M& A,
|
||||
const M& A_for_precond,
|
||||
const WellModel& wellMod,
|
||||
const boost::any& parallelInformation OPM_UNUSED_NOMPI = boost::any() )
|
||||
const std::any& parallelInformation OPM_UNUSED_NOMPI = std::any() )
|
||||
: A_( A ), A_for_precond_(A_for_precond), wellMod_( wellMod ), comm_()
|
||||
{
|
||||
#if HAVE_MPI
|
||||
if( parallelInformation.type() == typeid(ParallelISTLInformation) )
|
||||
{
|
||||
const ParallelISTLInformation& info =
|
||||
boost::any_cast<const ParallelISTLInformation&>( parallelInformation);
|
||||
std::any_cast<const ParallelISTLInformation&>( parallelInformation);
|
||||
comm_.reset( new communication_type( info.communicator() ) );
|
||||
}
|
||||
#endif
|
||||
@ -375,7 +375,7 @@ protected:
|
||||
int iterations () const { return iterations_; }
|
||||
|
||||
/// \copydoc NewtonIterationBlackoilInterface::parallelInformation
|
||||
const boost::any& parallelInformation() const { return parallelInformation_; }
|
||||
const std::any& parallelInformation() const { return parallelInformation_; }
|
||||
|
||||
protected:
|
||||
/// \brief construct the CPR preconditioner and the solver.
|
||||
@ -568,7 +568,7 @@ protected:
|
||||
if (parallelInformation_.type() == typeid(ParallelISTLInformation))
|
||||
{
|
||||
const ParallelISTLInformation& info =
|
||||
boost::any_cast<const ParallelISTLInformation&>( parallelInformation_);
|
||||
std::any_cast<const ParallelISTLInformation&>( parallelInformation_);
|
||||
Comm istlComm(info.communicator());
|
||||
|
||||
// Construct operator, scalar product and vectors needed.
|
||||
@ -604,7 +604,7 @@ protected:
|
||||
{
|
||||
const size_t size = opA.getmat().N();
|
||||
const ParallelISTLInformation& info =
|
||||
boost::any_cast<const ParallelISTLInformation&>( parallelInformation_);
|
||||
std::any_cast<const ParallelISTLInformation&>( parallelInformation_);
|
||||
|
||||
// As we use a dune-istl with block size np the number of components
|
||||
// per parallel is only one.
|
||||
@ -939,7 +939,7 @@ protected:
|
||||
const Simulator& simulator_;
|
||||
mutable int iterations_;
|
||||
mutable bool converged_;
|
||||
boost::any parallelInformation_;
|
||||
std::any parallelInformation_;
|
||||
|
||||
std::unique_ptr<Matrix> matrix_;
|
||||
std::unique_ptr<Matrix> noGhostMat_;
|
||||
|
@ -135,7 +135,7 @@ namespace Opm
|
||||
const size_t size = opAParallel_->getmat().N();
|
||||
|
||||
const ParallelISTLInformation& info =
|
||||
boost::any_cast<const ParallelISTLInformation&>( this->parallelInformation_);
|
||||
std::any_cast<const ParallelISTLInformation&>( this->parallelInformation_);
|
||||
|
||||
// As we use a dune-istl with block size np the number of components
|
||||
// per parallel is only one.
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
#if HAVE_MPI
|
||||
if (parallelInformation_.type() == typeid(ParallelISTLInformation)) {
|
||||
// Parallel case.
|
||||
const ParallelISTLInformation* parinfo = boost::any_cast<ParallelISTLInformation>(¶llelInformation_);
|
||||
const ParallelISTLInformation* parinfo = std::any_cast<ParallelISTLInformation>(¶llelInformation_);
|
||||
assert(parinfo);
|
||||
comm_.reset(new Communication(parinfo->communicator()));
|
||||
}
|
||||
@ -98,7 +98,7 @@ public:
|
||||
static bool firstcall = true;
|
||||
if (firstcall && parallelInformation_.type() == typeid(ParallelISTLInformation)) {
|
||||
// Parallel case.
|
||||
const ParallelISTLInformation* parinfo = boost::any_cast<ParallelISTLInformation>(¶llelInformation_);
|
||||
const ParallelISTLInformation* parinfo = std::any_cast<ParallelISTLInformation>(¶llelInformation_);
|
||||
assert(parinfo);
|
||||
const size_t size = mat.istlMatrix().N();
|
||||
parinfo->copyValuesTo(comm_->indexSet(), comm_->remoteIndices(), size, 1);
|
||||
@ -205,7 +205,7 @@ protected:
|
||||
boost::property_tree::ptree prm_;
|
||||
VectorType rhs_;
|
||||
Dune::InverseOperatorResult res_;
|
||||
boost::any parallelInformation_;
|
||||
std::any parallelInformation_;
|
||||
#if HAVE_MPI
|
||||
std::unique_ptr<Communication> comm_;
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <opm/grid/UnstructuredGrid.h>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <boost/any.hpp>
|
||||
#include <any>
|
||||
#include <exception>
|
||||
|
||||
#include <algorithm>
|
||||
@ -671,7 +671,7 @@ namespace Opm
|
||||
/// then this will ecapsulate an instance of ParallelISTLInformation.
|
||||
/// \param grid The grid to inspect.
|
||||
|
||||
inline void extractParallelGridInformationToISTL(boost::any& anyComm, const UnstructuredGrid& grid)
|
||||
inline void extractParallelGridInformationToISTL(std::any& anyComm, const UnstructuredGrid& grid)
|
||||
{
|
||||
(void)anyComm; (void)grid;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user