Skip to content
Snippets Groups Projects
Commit a656915f authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Changes to make harmonicmap test work with dune 2.6

parent 91fca49c
No related branches found
No related tags found
1 merge request!25Harmonicmap integration test
......@@ -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_
......
......@@ -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"
......
......@@ -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_;
};
......
......@@ -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++)
......
......@@ -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
}
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment