Commit dac20a44 authored by Timo Koch's avatar Timo Koch
Browse files

[cleanup] Remove version checks guarding for dune < 2.7

parent 9b6830e4
......@@ -28,11 +28,9 @@
#include <type_traits>
#include <dune/istl/multitypeblockvector.hh>
#include <dune/common/version.hh>
namespace Dumux {
#if DUNE_VERSION_GT_REV(DUNE_ISTL,2,6,0)
/*!
* \brief a function to get a MultiTypeBlockVector with references to some entries of another MultiTypeBlockVector
* \param v a MultiTypeBlockVector
......@@ -44,58 +42,6 @@ auto partial(Dune::MultiTypeBlockVector<Args...>& v, Dune::index_constant<i>...
return Dune::MultiTypeBlockVector<std::add_lvalue_reference_t<std::decay_t<std::tuple_element_t<indices, std::tuple<Args...>>>>...>(v[indices]...);
}
#else
// for backwards-compatibility of partial with v2.6.0
template<typename ... Args>
class MultiTypeBlockVectorProxy : public std::tuple<Args...>
{
typedef std::tuple<Args...> ParentType;
public:
using ParentType::ParentType;
typedef MultiTypeBlockVectorProxy<Args...> type;
typedef double field_type;
/** \brief Random-access operator
*/
template< std::size_t index >
typename std::tuple_element<index, ParentType>::type&
operator[] ( const std::integral_constant< std::size_t, index > indexVariable )
{
DUNE_UNUSED_PARAMETER(indexVariable);
return std::get<index>(*this);
}
/** \brief Const random-access operator
*/
template< std::size_t index >
const typename std::tuple_element<index, ParentType>::type&
operator[] ( const std::integral_constant< std::size_t, index > indexVariable ) const
{
DUNE_UNUSED_PARAMETER(indexVariable);
return std::get<index>(*this);
}
};
template<class T> struct isMultiTypeBlockVector;
template<class... T>
struct isMultiTypeBlockVector<MultiTypeBlockVectorProxy<T...> > : public std::true_type {};
/*!
* \brief a function to get a MultiTypeBlockVector with references to some entries of another MultiTypeBlockVector
* \param v a MultiTypeBlockVector
* \param indices the indices of the entries that should be referenced
*/
template<class ...Args, std::size_t ...i>
auto partial(Dune::MultiTypeBlockVector<Args...>& v, Dune::index_constant<i>... indices)
{
return MultiTypeBlockVectorProxy<std::add_lvalue_reference_t<std::decay_t<std::tuple_element_t<indices, std::tuple<Args...>>>>...>(v[indices]...);
}
#endif
/*!
* \brief a function to get a tuple with references to some entries of another tuple
* \param v a tuple
......
......@@ -32,11 +32,7 @@
#include <dune/common/timer.hh>
#include <dune/common/version.hh>
#if DUNE_VERSION_LT(DUNE_COMMON,2,7)
#include <dune/common/parallel/collectivecommunication.hh>
#else
#include <dune/common/parallel/communication.hh>
#endif
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/exceptions.hh>
......
......@@ -25,7 +25,6 @@
#include <type_traits>
#include <dune/common/version.hh>
#include <dune/common/typetraits.hh>
namespace Dumux {
......@@ -41,11 +40,7 @@ namespace Dumux {
* This should be deleted when the deprecation phase is over.
*/
template<typename T, typename I = std::size_t>
using IsIndexable =
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,7)
typename Dune::IsIndexable<T, I>;
#else
typename Dune::is_indexable<T, I>;
#endif
using IsIndexable = typename Dune::IsIndexable<T, I>;
} // end namespace Dumux
#endif
......@@ -28,13 +28,7 @@
#include <algorithm>
#include <map>
#include <dune/common/version.hh>
#if DUNE_VERSION_LT(DUNE_COMMON,2,7)
#include <dune/common/parallel/collectivecommunication.hh>
#else
#include <dune/common/parallel/communication.hh>
#endif
#include <dune/geometry/dimension.hh>
#include <dune/grid/common/partitionset.hh>
#include <dune/grid/common/datahandleif.hh>
......@@ -103,15 +97,9 @@ struct GmshGridDataHandle : public Dune::CommDataHandleIF<GmshGridDataHandle<Gri
bool contains (int dim, int codim) const
{ return codim == 0 || codim == 1; }
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
//! returns true if size per entity of given dim and codim is a constant
bool fixedSize(int dim, int codim) const
{ return true; }
#else
//! returns true if size per entity of given dim and codim is a constant
bool fixedsize(int dim, int codim) const
{ return true; }
#endif
template<class EntityType>
std::size_t size (const EntityType& e) const
......@@ -188,15 +176,9 @@ struct GmshGridDataHandle<Dune::UGGrid<dimgrid>, GridFactory, Data>
bool contains (int dim, int codim) const
{ return codim == 0 || codim == 1; }
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
//! returns true if size per entity of given dim and codim is a constant
bool fixedSize(int dim, int codim) const
{ return true; }
#else
//! returns true if size per entity of given dim and codim is a constant
bool fixedsize(int dim, int codim) const
{ return true; }
#endif
template<class EntityType>
std::size_t size (const EntityType& e) const
......
......@@ -29,14 +29,7 @@
#include <type_traits>
#include <dune/common/exceptions.hh>
#include <dune/common/version.hh>
#if DUNE_VERSION_LT(DUNE_COMMON,2,7)
#include <dune/common/parallel/collectivecommunication.hh>
#else
#include <dune/common/parallel/communication.hh>
#endif
#include <dune/common/parallel/mpihelper.hh>
#include <dune/grid/common/gridfactory.hh>
#include <dune/grid/io/file/dgfparser/parser.hh>
......
......@@ -24,8 +24,6 @@
#ifndef DUMUX_IO_GRID_MANAGER_ALU_HH
#define DUMUX_IO_GRID_MANAGER_ALU_HH
#include <dune/common/version.hh>
// ALUGrid specific includes
#if HAVE_DUNE_ALUGRID
#include <dune/alugrid/grid.hh>
......@@ -162,12 +160,7 @@ public:
std::vector<int> boundaryMarkersInsertionIndex, boundaryMarkers, faceMarkers, elementMarkers;
auto gridFactory = std::make_unique<Dune::GridFactory<Grid>>();
// Older versions of Dune(-Alugrid) require that the Gmsh file is read only on process 0
#if DUNE_VERSION_LT(DUNE_GRID, 2, 7)
if (Dune::MPIHelper::getCollectiveCommunication().rank() == 0)
#endif
Dune::GmshReader<Grid>::read(*gridFactory, fileName, boundaryMarkersInsertionIndex, elementMarkers, verbose, boundarySegments);
ParentType::gridPtr() = std::shared_ptr<Grid>(gridFactory->createGrid());
// reorder boundary markers according to boundarySegmentIndex
......@@ -194,10 +187,7 @@ public:
{
auto gridFactory = std::make_unique<Dune::GridFactory<Grid>>();
// Older versions of Dune(-Alugrid) require that the Gmsh file is read only on process 0
#if DUNE_VERSION_LT(DUNE_GRID, 2, 7)
if (Dune::MPIHelper::getCollectiveCommunication().rank() == 0)
#endif
Dune::GmshReader<Grid>::read(*gridFactory, fileName, verbose, boundarySegments);
ParentType::gridPtr() = std::shared_ptr<Grid>(gridFactory->createGrid());
......
......@@ -32,14 +32,7 @@
#include <dune/common/exceptions.hh>
#include <dune/common/classname.hh>
#include <dune/common/version.hh>
#if DUNE_VERSION_LT(DUNE_COMMON,2,7)
#include <dune/common/parallel/collectivecommunication.hh>
#else
#include <dune/common/parallel/communication.hh>
#endif
#include <dune/common/parallel/mpihelper.hh>
#include <dune/grid/io/file/dgfparser/dgfparser.hh>
#include <dune/grid/io/file/gmshreader.hh>
......
......@@ -32,7 +32,6 @@
#include <type_traits>
#include <functional>
#include <dune/common/version.hh>
#include <dune/common/exceptions.hh>
#include <dune/common/indices.hh>
#include <dune/grid/common/partitionset.hh>
......@@ -67,15 +66,9 @@ public:
bool contains(int dim, int cd) const
{ return cd == codim; }
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
//! returns true if size per entity of given dim and codim is a constant
bool fixedSize(int dim, int cd) const
{ return true; }
#else
//! returns true if size per entity of given dim and codim is a constant
bool fixedsize(int dim, int cd) const
{ return true; }
#endif
template<class EntityType>
size_t size (const EntityType &e) const
......
......@@ -81,11 +81,9 @@ public:
double evaluate(int mycomp, const Element& e, const Dune::FieldVector<ctype, dim>&) const final
{ return Impl::accessEntry(field_, mycomp, mapper_.index(e)); }
#if DUNE_VERSION_GTE(DUNE_GRID, 2, 7)
//! get output precision for the field
Dumux::Vtk::Precision precision() const final
{ return precision_; }
#endif
//! Constructor
VectorP0VTKFunction(const GridView& gridView,
......@@ -147,12 +145,9 @@ public:
return interpolation.global(xi);
}
#if DUNE_VERSION_GTE(DUNE_GRID, 2, 7)
//! get output precision for the field
Dumux::Vtk::Precision precision() const final
{ return precision_; }
#endif
//! Constructor
VectorP1VTKFunction(const GridView& gridView,
......@@ -217,11 +212,9 @@ public:
return interpolation.global(xi);
}
#if DUNE_VERSION_GTE(DUNE_GRID, 2, 7)
//! get output precision for the field
Dumux::Vtk::Precision precision() const final
{ return precision_; }
#endif
//! Constructor
VectorP1NonConformingVTKFunction(const GridView& gridView,
......@@ -302,13 +295,7 @@ public:
//! return the precision of this field
Dumux::Vtk::Precision precision() const
{
#if DUNE_VERSION_LT(DUNE_GRID, 2, 7)
return Dumux::Vtk::Precision::float32;
#else
return field_->precision();
#endif
}
{ return field_->precision(); }
//! codimension of the entities on which the field values live
int codim() const { return codim_; }
......
......@@ -83,14 +83,7 @@ public:
const auto precisionString = getParamFromGroup<std::string>(paramGroup, "Vtk.Precision", "Float32");
precision_ = Dumux::Vtk::stringToPrecision(precisionString);
const auto coordPrecision = Dumux::Vtk::stringToPrecision(getParamFromGroup<std::string>(paramGroup, "Vtk.CoordPrecision", precisionString));
#if DUNE_VERSION_LT(DUNE_GRID, 2, 7)
if (precision_ != Dumux::Vtk::Precision::float32 || coordPrecision != Dumux::Vtk::Precision::float32)
std::cerr << "Warning: Specifying VTK output precision other than Float32 is only supported in Dune 2.7 and newer. "
<< "Ignoring parameter and defaulting to Float32." << std::endl;
writer_ = std::make_shared<Dune::VTKWriter<GridView>>(gridGeometry.gridView(), dm);
#else
writer_ = std::make_shared<Dune::VTKWriter<GridView>>(gridGeometry.gridView(), dm, coordPrecision);
#endif
sequenceWriter_ = std::make_unique<Dune::VTKSequenceWriter<GridView>>(writer_, name);
}
......
......@@ -26,25 +26,11 @@
#include <array>
#include <string_view>
#include <dune/common/version.hh>
#include <dune/grid/io/file/vtk/common.hh>
namespace Dumux::Vtk {
#if DUNE_VERSION_LT(DUNE_GRID, 2, 7)
//! which precision to use when writing out data to vtk files
enum class Precision
{
int32,
uint8,
uint32,
float32,
float64
};
#else
using Dune::VTK::Precision;
#endif
/*!
* \ingroup InputOutput
......
......@@ -29,14 +29,7 @@
#include <dune/common/exceptions.hh>
#include <dune/common/parallel/indexset.hh>
#include <dune/common/version.hh>
#if DUNE_VERSION_LT(DUNE_COMMON,2,7)
#include <dune/common/parallel/mpicollectivecommunication.hh>
#else
#include <dune/common/parallel/mpicommunication.hh>
#endif
#include <dune/grid/common/capabilities.hh>
#include <dune/istl/paamg/amg.hh>
#include <dune/istl/paamg/pinfo.hh>
......
......@@ -27,7 +27,6 @@
#define DUMUX_LINEAR_ISTL_SOLVERFACTORYBACKEND_HH
#include <dune/common/version.hh>
#if DUNE_VERSION_GTE(DUNE_ISTL,2,7)
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/parametertree.hh>
......@@ -298,5 +297,4 @@ private:
#else
#warning "Generic dune-istl solver factory backend needs dune-istl >= 2.7!"
#endif // DUNE version check
#endif // header guard
......@@ -27,7 +27,6 @@
#if HAVE_MPI
#include <dune/common/version.hh>
#include <dune/geometry/dimension.hh>
#include <dune/grid/common/datahandleif.hh>
#include <dune/grid/common/partitionset.hh>
......@@ -65,15 +64,9 @@ class ParallelISTLHelper
bool contains(int dim, int codim) const
{ return dofCodim == codim; }
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
//! returns true if size per entity of given dim and codim is a constant
bool fixedSize(int dim, int codim) const
{ return true; }
#else
//! returns true if size per entity of given dim and codim is a constant
bool fixedsize(int dim, int codim) const
{ return true; }
#endif
template<class EntityType>
std::size_t size(EntityType& e) const
......@@ -98,11 +91,7 @@ class ParallelISTLHelper
public:
using DataType = typename V::block_type;
using BaseGatherScatter::contains;
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
using BaseGatherScatter::fixedSize;
#else
using BaseGatherScatter::fixedsize;
#endif
using BaseGatherScatter::size;
ConsistencyBoxGatherScatter(V& container, const DofMapper& mapper)
......@@ -140,11 +129,7 @@ class ParallelISTLHelper
public:
using DataType = std::size_t;
using BaseGatherScatter::contains;
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
using BaseGatherScatter::fixedSize;
#else
using BaseGatherScatter::fixedsize;
#endif
using BaseGatherScatter::size;
GhostGatherScatter(std::vector<std::size_t>& ranks, const DofMapper& mapper)
......@@ -186,11 +171,7 @@ class ParallelISTLHelper
public:
using DataType = std::size_t;
using BaseGatherScatter::contains;
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
using BaseGatherScatter::fixedSize;
#else
using BaseGatherScatter::fixedsize;
#endif
using BaseGatherScatter::size;
InteriorBorderGatherScatter(std::vector<std::size_t>& ranks, const DofMapper& mapper)
......@@ -229,11 +210,7 @@ class ParallelISTLHelper
{
using DataType = int;
using BaseGatherScatter::contains;
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
using BaseGatherScatter::fixedSize;
#else
using BaseGatherScatter::fixedsize;
#endif
using BaseGatherScatter::size;
NeighbourGatherScatter(const DofMapper& mapper, int rank, std::set<int>& neighbours)
......@@ -269,11 +246,7 @@ class ParallelISTLHelper
{
using DataType = int;
using BaseGatherScatter::contains;
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
using BaseGatherScatter::fixedSize;
#else
using BaseGatherScatter::fixedsize;
#endif
using BaseGatherScatter::size;
SharedGatherScatter(std::vector<int>& shared, const DofMapper& mapper)
......@@ -310,11 +283,7 @@ class ParallelISTLHelper
{
using DataType = GlobalIndex;
using BaseGatherScatter::contains;
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
using BaseGatherScatter::fixedSize;
#else
using BaseGatherScatter::fixedsize;
#endif
using BaseGatherScatter::size;
GlobalIndexGatherScatter(std::vector<GlobalIndex>& globalIndices, const DofMapper& mapper)
......@@ -490,11 +459,7 @@ private:
{
if (isOwned)
return Dune::OwnerOverlapCopyAttributeSet::owner;
#if DUNE_VERSION_GTE(DUNE_ISTL, 2, 7)
else if (isGhost && (comm.category() == static_cast<int>(Dune::SolverCategory::nonoverlapping)) )
#else
else if (isGhost && (comm.getSolverCategory() == static_cast<int>(Dune::SolverCategory::nonoverlapping)) )
#endif
return Dune::OwnerOverlapCopyAttributeSet::overlap;
else
return Dune::OwnerOverlapCopyAttributeSet::copy;
......@@ -567,15 +532,9 @@ class ParallelMatrixHelper
bool contains (int dim, int codim) const
{ return (codim == dofCodim); }
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
//! returns true if size per entity of given dim and codim is a constant
bool fixedSize(int dim, int codim) const
{ return false; }
#else
//! returns true if size per entity of given dim and codim is a constant
bool fixedsize(int dim, int codim) const
{ return false; }
#endif
/*!
* \brief How many objects of type DataType have to be sent for a given entity
......@@ -668,15 +627,9 @@ class ParallelMatrixHelper
bool contains(int dim, int codim) const
{ return (codim == dofCodim); }
#if DUNE_VERSION_GT(DUNE_GRID,2,7)
//! returns true if size per entity of given dim and codim is a constant
bool fixedSize(int dim, int codim) const
{ return false; }
#else
//! returns true if size per entity of given dim and codim is a constant
bool fixedsize(int dim, int codim) const
{ return false; }
#endif
/*!
* \brief How many objects of type DataType have to be sent for a given entity
......
......@@ -31,14 +31,7 @@
#include <dune/common/timer.hh>
#include <dune/common/exceptions.hh>
#include <dune/common/version.hh>
#if DUNE_VERSION_LT(DUNE_COMMON,2,7)
#include <dune/common/parallel/mpicollectivecommunication.hh>
#else
#include <dune/common/parallel/mpicommunication.hh>
#endif
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/std/type_traits.hh>
#include <dune/istl/bvector.hh>
......
......@@ -44,7 +44,6 @@
namespace Dumux {
#if DUNE_VERSION_GTE(DUNE_ISTL,2,7)
/*!
* \ingroup Linear
* \brief A preconditioner based on the Uzawa algorithm for saddle-point problems of the form
......@@ -329,7 +328,6 @@ private:
const std::string paramGroup_;
const bool useDirectVelocitySolverForA_;
};
#endif // DUNE_VERSION_GTE(DUNE_ISTL,2,7)
#if DUNE_VERSION_NEWER_REV(DUNE_ISTL,2,7,1)
DUMUX_REGISTER_PRECONDITIONER("uzawa", Dumux::MultiTypeBlockMatrixPreconditionerTag, Dune::defaultPreconditionerBlockLevelCreator<Dumux::SeqUzawa, 1>());
......
......@@ -34,7 +34,6 @@
#include <dune/istl/umfpack.hh>
#include <dune/istl/io.hh>
#include <dune/common/indices.hh>
#include <dune/common/version.hh>
#include <dune/common/hybridutilities.hh>
#include <dumux/common/parameters.hh>
......@@ -152,7 +151,6 @@ public:
return result.converged;
}
#if DUNE_VERSION_GTE(DUNE_ISTL,2,7)
// solve with generic parameter tree
template<class Preconditioner, class Solver, class Matrix, class Vector>
static bool solveWithParamTree(const Matrix& A, Vector& x, const Vector& b,
......@@ -173,7 +171,6 @@ public:
return result.converged;
}
#endif
};
/*!
......@@ -903,7 +900,6 @@ private:
*/
// \{
#if DUNE_VERSION_GTE(DUNE_ISTL,2,7)
/*!
* \ingroup Linear
* \brief A Uzawa preconditioned BiCGSTAB solver for saddle-point problems
......@@ -928,7 +924,6 @@ public:
return "Uzawa preconditioned BiCGSTAB solver";
}
};
#endif
/*!
* \ingroup Linear
......@@ -943,13 +938,8 @@ class BlockDiagILU0Preconditioner : public Dune::Preconditioner<X, Y>
template<std::size_t i>
using VecBlockType = std::decay_t<decltype(std::declval<X>()[Dune::index_constant<i>{}])>;
#if DUNE_VERSION_NEWER(DUNE_ISTL,2,6)
template<std::size_t i>
using BlockILU = Dune::SeqILU<DiagBlockType<i>, VecBlockType<i>, VecBlockType<i>, blockLevel-1>;
#else
template<std::size_t i>
using BlockILU = Dune::SeqILU0<DiagBlockType<i>, VecBlockType<i>, VecBlockType<i>, blockLevel-1>;
#endif
using ILUTuple = typename makeFromIndexedType<std::tuple, BlockILU, std::make_index_sequence<M::N()> >::type;
......
......@@ -27,7 +27,6 @@
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <dune/common/version.hh>
#include <dumux/common/exceptions.hh>
#include <dumux/common/valgrind.hh>
......@@ -107,9 +106,7 @@ public:
solveIdealMix_(fluidState, paramCache, phaseIdx, targetFug);
return;
}
#if DUNE_VERSION_LT(DUNE_COMMON, 2, 7)
Dune::FMatrixPrecision<Scalar>::set_singular_limit(1e-25);
#endif
// save initial composition in case something goes wrong
Dune::FieldVector<Scalar, numComponents> xInit;
for (int i = 0; i < numComponents; ++i) {
......
......@@ -27,7 +27,6 @@
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <dune/common/version.hh>
#include <dumux/common/exceptions.hh>
#include <dumux/common/valgrind.hh>
......@@ -129,10 +128,6 @@ public:
const typename MaterialLaw::Params &matParams,
const ComponentVector &globalMolarities)
{
#if DUNE_VERSION_LT(DUNE_COMMON, 2, 7)
Dune::FMatrixPrecision<Scalar>::set_singular_limit(1e-25);
#endif
/////////////////////////
// Check if all fluid phases are incompressible