diff --git a/dune/gfe/riemanniantrsolver.cc b/dune/gfe/riemanniantrsolver.cc index bacafb19a437ffd87b2fd564000404c8fca6db16..8feb344f72223c699bc0ad7ca13b35801efaaf1c 100644 --- a/dune/gfe/riemanniantrsolver.cc +++ b/dune/gfe/riemanniantrsolver.cc @@ -131,11 +131,21 @@ setup(const GridType& grid, LocalMapper, LocalMapper> matrixComm(*globalMapper_, grid_->leafGridView(), localMapper, localMapper, 0); - auto A = std::make_shared<ScalarMatrixType>(matrixComm.reduceAdd(localA)); +#if !DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) + auto +#endif + A = std::make_shared<ScalarMatrixType>(matrixComm.reduceAdd(localA)); #else - auto A = std::make_shared<ScalarMatrixType>(localA); +#if !DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) + auto +#endif + A = std::make_shared<ScalarMatrixType>(localA); #endif +#if DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) + h1SemiNorm_ = std::make_shared<H1SemiNorm<CorrectionType> >(*A); +#else h1SemiNorm_ = std::make_shared<H1SemiNorm<CorrectionType> >(A); +#endif innerSolver_ = std::make_shared<::LoopSolver<CorrectionType> >(mmgStep, innerIterations_, @@ -153,12 +163,19 @@ setup(const GridType& grid, operatorAssembler.assemble(massStiffness, localMassMatrix); +#if !DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) + auto +#endif #if HAVE_MPI - auto massMatrix = std::make_shared<ScalarMatrixType>(matrixComm.reduceAdd(localMassMatrix)); + massMatrix = std::make_shared<ScalarMatrixType>(matrixComm.reduceAdd(localMassMatrix)); #else - auto massMatrix = std::make_shared<ScalarMatrixType>(localMassMatrix); + massMatrix = std::make_shared<ScalarMatrixType>(localMassMatrix); #endif +#if DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) + l2Norm_ = std::make_shared<H1SemiNorm<CorrectionType> >(*massMatrix); +#else l2Norm_ = std::make_shared<H1SemiNorm<CorrectionType> >(massMatrix); +#endif // Write all intermediate solutions, if requested if (instrumented_ diff --git a/dune/gfe/riemanniantrsolver.hh b/dune/gfe/riemanniantrsolver.hh index 7c91aac16855a8ee36e765b19d388e7ded0388cf..a3f5ec3d28a80c2cfdef844ccfb3d5f19e5a7670 100644 --- a/dune/gfe/riemanniantrsolver.hh +++ b/dune/gfe/riemanniantrsolver.hh @@ -209,6 +209,12 @@ protected: /** \brief Store information about solver runs for unit testing */ Statistics statistics_; + +#if DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) + std::shared_ptr<Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > > A; + std::shared_ptr<Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > > massMatrix; +#endif + }; #include "riemanniantrsolver.cc" diff --git a/dune/gfe/sumcosseratenergy.hh b/dune/gfe/sumcosseratenergy.hh index 2011d909604194c646996056ea814ad55253d8ca..9cf25de0b61431351e1667e7bba8d9b4658e4508 100644 --- a/dune/gfe/sumcosseratenergy.hh +++ b/dune/gfe/sumcosseratenergy.hh @@ -27,7 +27,11 @@ public: * \param elasticEnergy The elastic energy * \param cosseratEnergy The cosserat energy */ +#if DUNE_VERSION_LT(DUNE_ELASTICITY, 2, 7) + SumCosseratEnergy(std::shared_ptr<LocalFEStiffness<GridView,LocalFiniteElement,std::vector<Dune::FieldVector<field_type,dim> > > > elasticEnergy, +#else SumCosseratEnergy(std::shared_ptr<Elasticity::LocalEnergy<GridView,LocalFiniteElement,std::vector<Dune::FieldVector<field_type,dim> > > > elasticEnergy, +#endif std::shared_ptr<GFE::LocalEnergy<Basis, TargetSpace>> cosseratEnergy) : elasticEnergy_(elasticEnergy), @@ -49,7 +53,11 @@ public: private: +#if DUNE_VERSION_LT(DUNE_ELASTICITY, 2, 7) + std::shared_ptr<LocalFEStiffness<GridView,LocalFiniteElement,std::vector<Dune::FieldVector<field_type,dim> > > > elasticEnergy_; +#else std::shared_ptr<Elasticity::LocalEnergy<GridView,LocalFiniteElement,std::vector<Dune::FieldVector<field_type,dim> > > > elasticEnergy_; +#endif std::shared_ptr<GFE::LocalEnergy<Basis, TargetSpace> > cosseratEnergy_; }; diff --git a/src/cosserat-continuum.cc b/src/cosserat-continuum.cc index 832d3955894819ccfb705c659bfe8a9cf5870082..e34df722a89618c99398b706ec56d4a6ed30295a 100644 --- a/src/cosserat-continuum.cc +++ b/src/cosserat-continuum.cc @@ -304,10 +304,18 @@ int main (int argc, char *argv[]) try orientationDirichletDofs[i][j] = true; #else BitSetVector<1> dirichletNodes(feBasis.size(), false); +#if DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) + constructBoundaryDofs(dirichletBoundary,fufemFeBasis,dirichletNodes); +#else constructBoundaryDofs(dirichletBoundary,feBasis,dirichletNodes); +#endif BitSetVector<1> neumannNodes(feBasis.size(), false); +#if DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) + constructBoundaryDofs(neumannBoundary,fufemFeBasis,neumannNodes); +#else constructBoundaryDofs(neumannBoundary,feBasis,neumannNodes); +#endif BitSetVector<blocksize> dirichletDofs(feBasis.size(), false); for (size_t i=0; i<feBasis.size(); i++) diff --git a/src/film-on-substrate.cc b/src/film-on-substrate.cc index fd9e1fbe4fdaa05ccc06a5eac834b2d739a3b221..2563efa5c37106e2f1468e51554adc9c3d251432 100644 --- a/src/film-on-substrate.cc +++ b/src/film-on-substrate.cc @@ -14,6 +14,7 @@ #include <dune/common/bitsetvector.hh> #include <dune/common/parametertree.hh> #include <dune/common/parametertreeparser.hh> +#include <dune/common/version.hh> #include <dune/grid/uggrid.hh> #include <dune/grid/utility/structuredgridfactory.hh> @@ -23,7 +24,9 @@ #include <dune/elasticity/materials/exphenckyenergy.hh> #include <dune/elasticity/materials/henckyenergy.hh> +#if !DUNE_VERSION_LT(DUNE_ELASTICITY, 2, 7) #include <dune/elasticity/materials/mooneyrivlinenergy.hh> +#endif #include <dune/elasticity/materials/neohookeenergy.hh> #include <dune/elasticity/materials/neumannenergy.hh> #include <dune/elasticity/materials/sumenergy.hh> @@ -59,6 +62,19 @@ const int dim = WORLD_DIM; const int order = 1; +#if DUNE_VERSION_LT(DUNE_COMMON, 2, 7) +template<> +struct Dune::MathematicalConstants<adouble> +{ + static const adouble pi () + { + using std::acos; + static const adouble pi = acos( adouble( -1 ) ); + return pi; + } +}; +#endif + //differentiation method typedef adouble ValueType; @@ -236,13 +252,27 @@ int main (int argc, char *argv[]) try BitSetVector<1> dirichletNodes(feBasis.size(), false); +#if DUNE_VERSION_LT(DUNE_FUFEM, 2, 7) + using FufemFEBasis = DuneFunctionsBasis<FEBasis>; + FufemFEBasis fufemFeBasis(feBasis); + constructBoundaryDofs(dirichletBoundary,fufemFeBasis,dirichletNodes); +#else constructBoundaryDofs(dirichletBoundary,feBasis,dirichletNodes); +#endif BitSetVector<1> neumannNodes(feBasis.size(), false); +#if DUNE_VERSION_LT(DUNE_FUFEM, 2, 7) + constructBoundaryDofs(neumannBoundary,fufemFeBasis,neumannNodes); +#else constructBoundaryDofs(neumannBoundary,feBasis,neumannNodes); +#endif BitSetVector<1> surfaceShellNodes(feBasis.size(), false); +#if DUNE_VERSION_LT(DUNE_FUFEM, 2, 7) + constructBoundaryDofs(surfaceShellBoundary,fufemFeBasis,surfaceShellNodes); +#else constructBoundaryDofs(surfaceShellBoundary,feBasis,surfaceShellNodes); +#endif BitSetVector<blocksize> dirichletDofs(feBasis.size(), false); for (size_t i=0; i<feBasis.size(); i++) @@ -336,7 +366,11 @@ int main (int argc, char *argv[]) try // Assembler using ADOL-C std::cout << "Selected energy is: " << parameterSet.get<std::string>("energy") << std::endl; +#if DUNE_VERSION_LT(DUNE_ELASTICITY, 2, 7) + std::shared_ptr<LocalFEStiffness<GridView, +#else std::shared_ptr<Elasticity::LocalEnergy<GridView, +#endif FEBasis::LocalView::Tree::FiniteElement, std::vector<Dune::FieldVector<ValueType, dim>> > > elasticEnergy; @@ -344,10 +378,12 @@ int main (int argc, char *argv[]) try elasticEnergy = std::make_shared<StVenantKirchhoffEnergy<GridView, FEBasis::LocalView::Tree::FiniteElement, ValueType> >(materialParameters); +#if !DUNE_VERSION_LT(DUNE_ELASTICITY, 2, 7) if (parameterSet.get<std::string>("energy") == "mooneyrivlin") elasticEnergy = std::make_shared<MooneyRivlinEnergy<GridView, FEBasis::LocalView::Tree::FiniteElement, ValueType> >(materialParameters); +#endif if (parameterSet.get<std::string>("energy") == "neohooke") elasticEnergy = std::make_shared<NeoHookeEnergy<GridView, @@ -477,4 +513,4 @@ int main (int argc, char *argv[]) try } } catch (Exception& e) { std::cout << e.what() << std::endl; -} \ No newline at end of file +} diff --git a/src/harmonicmaps.cc b/src/harmonicmaps.cc index e8c84d8be0c97181fd0d8d3fa97c4853673fb7ea..78cbc34011206c5a1443bdb5aecbf52bdf257457 100644 --- a/src/harmonicmaps.cc +++ b/src/harmonicmaps.cc @@ -234,8 +234,12 @@ int main (int argc, char *argv[]) BitSetVector<blocksize> dirichletNodes(feBasis.size(), false); +#if DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) + DuneFunctionsBasis<FEBasis> fufemBasis(feBasis); + constructBoundaryDofs(dirichletBoundary,fufemBasis,dirichletNodes); +#else constructBoundaryDofs(dirichletBoundary,feBasis,dirichletNodes); - +#endif // ////////////////////////// // Initial iterate diff --git a/test/harmonicmaptest.cc b/test/harmonicmaptest.cc index 2d409e2c05fc8a2dbb14d13cc289dfe153dc19a6..2dbe77293ec5fa54031f577c2bc45bbddf876644 100644 --- a/test/harmonicmaptest.cc +++ b/test/harmonicmaptest.cc @@ -66,7 +66,11 @@ int main (int argc, char *argv[]) // /////////////////////////////////////// using GridType = UGGrid<dim>; +#if DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) + std::shared_ptr<GridType> grid(GmshReader<GridType>::read("grids/irregular-square.msh")); +#else std::shared_ptr<GridType> grid = GmshReader<GridType>::read("grids/irregular-square.msh"); +#endif grid->globalRefine(numLevels-1); @@ -104,8 +108,12 @@ int main (int argc, char *argv[]) BoundaryPatch<GridView> dirichletBoundary(gridView, dirichletVertices); BitSetVector<blocksize> dirichletNodes(feBasis.size(), false); +#if DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) + DuneFunctionsBasis<FEBasis> fufemBasis(feBasis); + constructBoundaryDofs(dirichletBoundary,fufemBasis,dirichletNodes); +#else constructBoundaryDofs(dirichletBoundary,feBasis,dirichletNodes); - +#endif //////////////////////////// // Initial iterate