OPM / opm-simulators

Simulator programs and utilities for automatic differentiation.
http://www.opm-project.org
GNU General Public License v3.0
111 stars 121 forks source link

Master cannot be compiled with DUNE 2.7 and C++-11 #5595

Open blattms opened 1 week ago

blattms commented 1 week ago
/home/mblatt/src/dune-2.7/opm-simulators/opm/simulators/linalg/FlexibleSolver2.cpp:24:1:   required from here
/home/mblatt/src/dune-2.7/opm-simulators/opm/simulators/linalg/FlexibleSolver_impl.hpp:202:24: error: no match for ‘operator=’ (operand types are ‘std::shared_ptr<Dune::InverseOperator<Dune::BlockVector<Dune::FieldVector<double, 2>, std::allocator<Dune::FieldVector<double, 2> > >, Dune::BlockVector<Dune::FieldVector<double, 2>, std::allocator<Dune::FieldVector<double, 2> > > > >’ and ‘std::shared_ptr<Dune::UMFPack<Dune::BCRSMatrix<Opm::MatrixBlock<double, 2, 2>, std::allocator<Opm::MatrixBlock<double, 2, 2> > > > >’)
  202 |             linsolver_ = std::make_shared<Dune::UMFPack<MatrixType>>(linearoperator_for_solver_->getmat(), verbosity, false);
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/memory:77,
                 from /home/mblatt/src/dune-2.7/opm-common/opm/common/OpmLog/OpmLog.hpp:23,
                 from /home/mblatt/src/dune-2.7/opm-common/opm/common/ErrorMacros.hpp:24,
                 from /home/mblatt/src/dune-2.7/opm-simulators/opm/simulators/linalg/FlexibleSolver_impl.hpp:24,
                 from /home/mblatt/src/dune-2.7/opm-simulators/opm/simulators/linalg/FlexibleSolver2.cpp:22:
/usr/include/c++/11/bits/shared_ptr.h:363:9: note: candidate: ‘template<class _Yp> std::shared_ptr<_Tp>::_Assignable<const std::shared_ptr<_Yp>&> std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Yp>&) [with _Yp = _Yp; _Tp = Dune::InverseOperator<Dune::BlockVector<Dune::FieldVector<double, 2>, std::allocator<Dune::FieldVector<double, 2> > >, Dune::BlockVector<Dune::FieldVector<double, 2>, std::allocator<Dune::FieldVector<double, 2> > > >]’
  363 |         operator=(const shared_ptr<_Yp>& __r) noexcept
      |         ^~~~~~~~

This must have something to do with dune version. It works with 2.9. The conversion was introduced in #5002

bska commented 1 week ago

The Dune version issue may be worth tracking down. For what it's worth, I had a local build against the Dune 2.7.1 release until we merged OPM/opm-common#4157. I don't understand why you mention C++11, however. We've explicitly depended on a C++17 compatible compiler since at least PR OPM/opm-common#2924, and we liberally use C++17 features such as std::filesystem, map<>::insert_or_assign() and std::from_chars(). Am I missing something?