Commit dab61029 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'issue/resuce_warnings' into 'master'

reduce deprecation and other warnings introduced by recent changes in dune 2.8

See merge request !186
parents ab838a78 f1ad9fe6
...@@ -250,8 +250,8 @@ namespace AMDiS ...@@ -250,8 +250,8 @@ namespace AMDiS
if constexpr (std::is_convertible_v<decltype(std::declval<HG>().loadBalance()), bool>) if constexpr (std::is_convertible_v<decltype(std::declval<HG>().loadBalance()), bool>)
return hostGrid_->loadBalance(); return hostGrid_->loadBalance();
else { else {
hostGrid_->loadBalance(); hostGrid_->loadBalance();
return true; return true;
} }
} }
...@@ -269,7 +269,7 @@ namespace AMDiS ...@@ -269,7 +269,7 @@ namespace AMDiS
if constexpr (std::is_convertible_v<decltype(std::declval<HG>().loadBalance(handle)), bool>) if constexpr (std::is_convertible_v<decltype(std::declval<HG>().loadBalance(handle)), bool>)
return hostGrid_->loadBalance(handle); return hostGrid_->loadBalance(handle);
else { else {
hostGrid_->loadBalance(handle); hostGrid_->loadBalance(handle);
return true; return true;
} }
} }
...@@ -374,6 +374,7 @@ namespace Dune ...@@ -374,6 +374,7 @@ namespace Dune
: public GridFactoryInterface<AMDiS::AdaptiveGrid<HostGrid> > : public GridFactoryInterface<AMDiS::AdaptiveGrid<HostGrid> >
{ {
using Self = GridFactory; using Self = GridFactory;
using Super = GridFactoryInterface<AMDiS::AdaptiveGrid<HostGrid> >;
using GridType = AMDiS::AdaptiveGrid<HostGrid>; using GridType = AMDiS::AdaptiveGrid<HostGrid>;
using HostGridFactory = GridFactory<HostGrid>; using HostGridFactory = GridFactory<HostGrid>;
...@@ -406,12 +407,22 @@ namespace Dune ...@@ -406,12 +407,22 @@ namespace Dune
hostFactory_.insertElement(type, vertices); hostFactory_.insertElement(type, vertices);
} }
#if DUNE_VERSION_LT(DUNE_GRID,2,8)
using ElementParametrizationType = std::shared_ptr<VirtualFunction<FieldVector<ctype,dim>,FieldVector<ctype,dimworld> > >; using ElementParametrizationType = std::shared_ptr<VirtualFunction<FieldVector<ctype,dim>,FieldVector<ctype,dimworld> > >;
/// Insert a parametrized element into the coarse grid /// Insert a parametrized element into the coarse grid
void insertElement(GeometryType const& type, void insertElement(GeometryType const& type,
std::vector<unsigned int> const& vertices, std::vector<unsigned int> const& vertices,
ElementParametrizationType const& elementParametrization) override ElementParametrizationType const& elementParametrization) override
#else
using ElementParametrizationType
= std::function<FieldVector<ctype,dimworld>(FieldVector<ctype,dim>)>;
/// Insert a parametrized element into the coarse grid
void insertElement(GeometryType const& type,
std::vector<unsigned int> const& vertices,
ElementParametrizationType elementParametrization) override
#endif
{ {
using A0 = GeometryType; using A0 = GeometryType;
using A1 = std::vector<unsigned int>; using A1 = std::vector<unsigned int>;
...@@ -421,6 +432,7 @@ namespace Dune ...@@ -421,6 +432,7 @@ namespace Dune
else else
AMDiS::error_exit("insertElement() not implemented for HostGrid type."); AMDiS::error_exit("insertElement() not implemented for HostGrid type.");
} }
using Super::insertElement;
template <class F, class... Args> template <class F, class... Args>
using HasInsertBoundarySegment = decltype(std::declval<F>().insertBoundarySegment(std::declval<Args>()...)); using HasInsertBoundarySegment = decltype(std::declval<F>().insertBoundarySegment(std::declval<Args>()...));
......
...@@ -186,7 +186,7 @@ namespace AMDiS ...@@ -186,7 +186,7 @@ namespace AMDiS
std::unique_ptr<GridType> read_gmsh_file(std::string const& filename, Dune::PriorityTag<1>) const std::unique_ptr<GridType> read_gmsh_file(std::string const& filename, Dune::PriorityTag<1>) const
{ {
Dune::GmshReader<GridType> reader; Dune::GmshReader<GridType> reader;
return std::unique_ptr<GridType>{reader.read(filename, boundaryIds_, elementIds_)}; return std::unique_ptr<GridType>{reader.read(filename)}; // , boundaryIds_, elementIds_)};
} }
// fallback if GmshReader cannot be used // fallback if GmshReader cannot be used
......
...@@ -207,12 +207,11 @@ coords(Node const& tree, std::vector<std::size_t> const& localIndices) const ...@@ -207,12 +207,11 @@ coords(Node const& tree, std::vector<std::size_t> const& localIndices) const
using DomainType = typename FiniteElement::Traits::LocalBasisType::Traits::DomainType; using DomainType = typename FiniteElement::Traits::LocalBasisType::Traits::DomainType;
using RangeType = typename FiniteElement::Traits::LocalBasisType::Traits::RangeType; using RangeType = typename FiniteElement::Traits::LocalBasisType::Traits::RangeType;
// TODO(FM): Cleanup once interpolation over a non-leaf node is fully supported
std::array<std::vector<typename RangeType::field_type>, Domain::dimension> coeffs; std::array<std::vector<typename RangeType::field_type>, Domain::dimension> coeffs;
for (int d = 0; d < Domain::dimension; ++d) { for (int d = 0; d < Domain::dimension; ++d) {
auto evalCoord = functionFromCallable<RangeType(DomainType)>([&](DomainType const& local) auto evalCoord = [&](DomainType const& local) -> RangeType { return geometry.global(local)[d]; };
-> RangeType { return geometry.global(local)[d]; }); auto evalCoordFct = functionFromCallable<RangeType(DomainType)>(evalCoord);
localInterpol.interpolate(evalCoord, coeffs[d]); localInterpol.interpolate(evalCoordFct, coeffs[d]);
} }
for (std::size_t j = 0; j < localIndices.size(); ++j) { for (std::size_t j = 0; j < localIndices.size(); ++j) {
......
#pragma once #pragma once
#include <dune/common/version.hh>
#if DUNE_VERSION_LT(DUNE_LOCALFUNCTIONS,2,8)
#include <dune/common/typeutilities.hh> #include <dune/common/typeutilities.hh>
#include <dune/functions/common/functionfromcallable.hh> #include <dune/functions/common/functionfromcallable.hh>
#endif
namespace AMDiS namespace AMDiS
{ {
#if DUNE_VERSION_LT(DUNE_LOCALFUNCTIONS,2,8)
namespace Impl namespace Impl
{ {
template <class Traits, class F, template <class Traits, class F,
...@@ -27,5 +32,9 @@ namespace AMDiS ...@@ -27,5 +32,9 @@ namespace AMDiS
{ {
return Impl::functionFromCallableImpl<SigTraits>(f, Dune::PriorityTag<10>{}); return Impl::functionFromCallableImpl<SigTraits>(f, Dune::PriorityTag<10>{});
} }
#else
template <class SigTraits, class F>
F functionFromCallable(F const& f) { return f; }
#endif
} // end namespace AMDiS } // end namespace AMDiS
...@@ -71,14 +71,15 @@ namespace AMDiS ...@@ -71,14 +71,15 @@ namespace AMDiS
return; return;
// extract component of local function result corresponding to node in tree // extract component of local function result corresponding to node in tree
auto localFj = functionFromCallable<Traits>([&](auto const& local) auto localFj = [&](auto const& local)
{ {
const auto& tmp = lf(local); const auto& tmp = lf(local);
return nodeToRangeEntry(node, tp, Dune::MatVec::as_vector(tmp)); return nodeToRangeEntry(node, tp, Dune::MatVec::as_vector(tmp));
}); };
thread_local std::vector<RangeField> interpolationCoeff; thread_local std::vector<RangeField> interpolationCoeff;
fe.localInterpolation().interpolate(localFj, interpolationCoeff); auto localFjFct = functionFromCallable<Traits>(localFj);
fe.localInterpolation().interpolate(localFjFct, interpolationCoeff);
counter.scatter(localView, node, visit, assign); counter.scatter(localView, node, visit, assign);
vector.scatter(localView, node, interpolationCoeff, visit, assign); vector.scatter(localView, node, interpolationCoeff, visit, assign);
......
#include "config.h"
#include "FileWriterBase.hpp" #include "FileWriterBase.hpp"
#include <amdis/AdaptInfo.hpp> #include <amdis/AdaptInfo.hpp>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <string> #include <string>
#include <type_traits> #include <type_traits>
#include <dune/common/version.hh>
#include <dune/common/std/apply.hh> #include <dune/common/std/apply.hh>
#include <dune/typetree/treepath.hh> #include <dune/typetree/treepath.hh>
#include <dune/typetree/typetraits.hh> #include <dune/typetree/typetraits.hh>
...@@ -125,11 +126,19 @@ namespace AMDiS ...@@ -125,11 +126,19 @@ namespace AMDiS
return tp; return tp;
} }
#if DUNE_VERSION_LT(DUNE_TYPETREE,2,8)
template <std::size_t... I> template <std::size_t... I>
auto makeTreePath(Dune::TypeTree::TreePath<I...>) auto makeTreePath(Dune::TypeTree::TreePath<I...>)
{ {
return Dune::TypeTree::hybridTreePath(std::integral_constant<std::size_t, I>{}...); return Dune::TypeTree::hybridTreePath(std::integral_constant<std::size_t, I>{}...);
} }
#else
template <std::size_t... I>
auto makeTreePath(Dune::TypeTree::StaticTreePath<I...>)
{
return Dune::TypeTree::hybridTreePath(std::integral_constant<std::size_t, I>{}...);
}
#endif
template <class TP> template <class TP>
auto makeTreePath(TP const&) auto makeTreePath(TP const&)
......
...@@ -79,14 +79,16 @@ private: ...@@ -79,14 +79,16 @@ private:
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
AMDiS::Environment env(argc, argv); AMDiS::Environment env(argc, argv);
#if AMDIS_HAS_PETSC
MPI_Comm comm = MPI_COMM_WORLD; MPI_Comm comm = MPI_COMM_WORLD;
#endif
using GI = GlobalIndex; using GI = GlobalIndex;
using LI = Dune::ParallelLocalIndex<Attribute::Type>; using LI = Dune::ParallelLocalIndex<Attribute::Type>;
using PIS = Dune::ParallelIndexSet<GI,LI>; using PIS = Dune::ParallelIndexSet<GI,LI>;
int r = env.mpiRank(); int r = env.mpiRank();
int s = env.mpiSize(); [[maybe_unused]] int s = env.mpiSize();
assert( s == 2 ); assert( s == 2 );
int N = 3; int N = 3;
......
...@@ -75,7 +75,7 @@ auto makeProblem(typename BasisCreator::GlobalBasis::GridView::Grid& grid, Fcts ...@@ -75,7 +75,7 @@ auto makeProblem(typename BasisCreator::GlobalBasis::GridView::Grid& grid, Fcts
k++; k++;
}); });
return std::move(prob); return prob;
} }
template <class Problem, class Fcts> template <class Problem, class Fcts>
......
...@@ -12,7 +12,7 @@ void test1() ...@@ -12,7 +12,7 @@ void test1()
FakeContainer<int,1> vec3(std::move(vec2)); FakeContainer<int,1> vec3(std::move(vec2));
FakeContainer<int,1> vec4 = vec1; FakeContainer<int,1> vec4 = vec1;
FakeContainer<int,1> vec5 = std::move(vec3); [[maybe_unused]] FakeContainer<int,1> vec5 = std::move(vec3);
vec1.reserve(7); vec1.reserve(7);
vec1.resize(1); vec1.resize(1);
...@@ -54,7 +54,7 @@ void test2() ...@@ -54,7 +54,7 @@ void test2()
AMDIS_TEST(!bitSet.empty()); AMDIS_TEST(!bitSet.empty());
// use bitset element as template parameter // use bitset element as template parameter
auto iconst = std::integral_constant<bool, bitSet[0]>{}; [[maybe_unused]] auto iconst = std::integral_constant<bool, bitSet[0]>{};
} }
......
#include "config.h"
#include <dune/grid/yaspgrid.hh> #include <dune/grid/yaspgrid.hh>
#include <dune/functions/functionspacebases/compositebasis.hh> #include <dune/functions/functionspacebases/compositebasis.hh>
#include <dune/functions/functionspacebases/lagrangebasis.hh> #include <dune/functions/functionspacebases/lagrangebasis.hh>
#include <dune/functions/functionspacebases/powerbasis.hh> #include <dune/functions/functionspacebases/powerbasis.hh>
#include <amdis/Environment.hpp>
#include <amdis/typetree/Traversal.hpp> #include <amdis/typetree/Traversal.hpp>
#include <amdis/typetree/TreeContainer.hpp> #include <amdis/typetree/TreeContainer.hpp>
...@@ -11,8 +13,10 @@ ...@@ -11,8 +13,10 @@
using namespace AMDiS; using namespace AMDiS;
int main () int main (int argc, char** argv)
{ {
Environment env(argc, argv);
Dune::YaspGrid<2> grid({1.0,1.0}, {1,1}); Dune::YaspGrid<2> grid({1.0,1.0}, {1,1});
auto gridView = grid.leafGridView(); auto gridView = grid.leafGridView();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment