From 006875c609ac07e199f77095621ca5eefb123f7d Mon Sep 17 00:00:00 2001 From: Lukas Riedel Date: Sat, 22 Oct 2016 16:48:36 +0200 Subject: [PATCH] adapted to PDELab interface changes since 2.4. integrated dune-uggrid --- cmake/modules/DorieMacros.cmake | 1 - dune.module | 2 +- src/dorie.cc | 4 ++-- src/dorie.hh | 1 + src/solver.hh | 21 +++++++++++++-------- src/util_adaptivity.hh | 7 ++++--- testing/convergence.mini | 4 ++-- 7 files changed, 23 insertions(+), 17 deletions(-) diff --git a/cmake/modules/DorieMacros.cmake b/cmake/modules/DorieMacros.cmake index 408185d2..730754ef 100644 --- a/cmake/modules/DorieMacros.cmake +++ b/cmake/modules/DorieMacros.cmake @@ -5,7 +5,6 @@ FIND_PACKAGE(HDF5 REQUIRED COMPONENTS C) FIND_PACKAGE(FFTW REQUIRED) FIND_PACKAGE(SuperLU REQUIRED) FIND_PACKAGE(MPI REQUIRED) -FIND_PACKAGE(UG REQUIRED) FIND_PACKAGE(METIS) FIND_PACKAGE(ParMETIS) diff --git a/dune.module b/dune.module index 1e7be7cc..d3c5f766 100644 --- a/dune.module +++ b/dune.module @@ -7,5 +7,5 @@ Module: dorie Version: 0.9 Maintainer: dorieteam@iup.uni-heidelberg.de #depending on -Depends: dune-common dune-geometry dune-grid dune-istl dune-localfunctions dune-typetree dune-pdelab dune-python +Depends: dune-python dune-uggrid dune-pdelab Suggests: dune-testtools diff --git a/src/dorie.cc b/src/dorie.cc index 472fe57c..4bf4a7d9 100644 --- a/src/dorie.cc +++ b/src/dorie.cc @@ -114,7 +114,7 @@ int main(int argc, char** argv) if (dim==2) { typedef Dune::UGGrid<2> GridType; - typedef GridType::Partition::LeafGridView GV; + typedef GridType::LeafGridView GV; if (gtype == "gmsh"){ auto grid = Dune::Dorie::build_grid_gmsh(inifile,helper); @@ -157,7 +157,7 @@ int main(int argc, char** argv) else if (dim==3) { typedef Dune::UGGrid<3> GridType; - typedef GridType::Partition::LeafGridView GV; + typedef GridType::LeafGridView GV; if (gtype == "gmsh"){ auto grid = Dune::Dorie::build_grid_gmsh(inifile,helper); diff --git a/src/dorie.hh b/src/dorie.hh index de96f31c..010a1eff 100644 --- a/src/dorie.hh +++ b/src/dorie.hh @@ -59,6 +59,7 @@ #include #include +#include #include #include #include diff --git a/src/solver.hh b/src/solver.hh index 898efa8c..d808d580 100644 --- a/src/solver.hh +++ b/src/solver.hh @@ -99,7 +99,7 @@ void RichardsSolver (GridType& grid, GV& gv, // --- Define Adaptivity Operator --- typedef Dune::Dorie::FluxErrorEstimator ESTLOP; typedef Dune::PDELab::EmptyTransformation NoTrafo; - typedef typename Dune::PDELab::BackendVectorSelector::Type U0; + typedef typename Dune::PDELab::Backend::impl::BackendVectorSelector::Type U0; typedef Dune::PDELab::GridOperator ESTGO; typedef Dune::Dorie::AdaptivityController AC; @@ -133,27 +133,32 @@ void RichardsSolver (GridType& grid, GV& gv, std::cout << "::: setup time " << std::setw(12) << timer.elapsed() << std::endl; // --- Set Up VTK Plotting --- - Dune::VTKSequenceWriter vtkwriter(gv,filename,filepath,"vtk"); - typedef Dune::PDELab::DiscreteGridFunction UDGF; UDGF udgf(gfs,unew); - vtkwriter.addCellData(new Dune::PDELab::VTKGridFunctionAdapter(udgf,"head")); + auto udgf_vtk = std::make_shared>(udgf,"head"); typedef Dune::Dorie::GradientFluxAdapter FluxDGF; FluxDGF fluxdgf(gfs,unew,param,udgf); - vtkwriter.addCellData(new Dune::PDELab::VTKGridFunctionAdapter(fluxdgf,"flux")); + auto fluxdgf_vtk = std::make_shared>(fluxdgf,"flux"); typedef Dune::Dorie::ConductivityAdapter ConDGF; ConDGF condgf(gv,param); - vtkwriter.addCellData(new Dune::PDELab::VTKGridFunctionAdapter(condgf,"K_0")); + auto condgf_vtk = std::make_shared>(condgf,"K_0"); typedef Dune::Dorie::WaterContentAdapter WaterDGF; WaterDGF waterdgf(gv,param,udgf); - vtkwriter.addCellData(new Dune::PDELab::VTKGridFunctionAdapter(waterdgf,"theta_w")); + auto waterdgf_vtk = std::make_shared>(waterdgf,"theta_w"); typedef Dune::Dorie::SaturationAdapter SatDGF; SatDGF satdgf(gv,param,udgf); - vtkwriter.addCellData(new Dune::PDELab::VTKGridFunctionAdapter(satdgf,"Theta")); + auto satdgf_vtk = std::make_shared>(satdgf,"Theta"); + + Dune::VTKSequenceWriter vtkwriter(gv,filename,filepath,"vtk"); + vtkwriter.addCellData(udgf_vtk); + vtkwriter.addCellData(fluxdgf_vtk); + vtkwriter.addCellData(condgf_vtk); + vtkwriter.addCellData(waterdgf_vtk); + vtkwriter.addCellData(satdgf_vtk); try{ // VTK Plotter has very bad exception handling RF t = CCon.getTime(); diff --git a/src/util_adaptivity.hh b/src/util_adaptivity.hh index 4bfc955a..7609cc97 100644 --- a/src/util_adaptivity.hh +++ b/src/util_adaptivity.hh @@ -91,10 +91,11 @@ namespace Dune { t_est = timer3.elapsed(); timer3.reset(); - maxeta = eta.base()[0]; + using Dune::PDELab::Backend::native; + maxeta = native(eta)[0]; for (unsigned int i=0; i maxeta) maxeta = eta.base()[i]; + native(eta)[i] = sqrt(native(eta)[i]); // eta contains squares + if (native(eta)[i] > maxeta) maxeta = native(eta)[i]; } if (verbose>1) { std::cout << "Max Local Error: " << maxeta << " " << std::endl; diff --git a/testing/convergence.mini b/testing/convergence.mini index 276639fb..6366646e 100644 --- a/testing/convergence.mini +++ b/testing/convergence.mini @@ -1,7 +1,7 @@ -include /home/dion/codes/dune/dorie/build-cmake/doc/parameters/default.ini +include /Users/lriedel/dune/dorie/build-cmake/doc/parameters/default.ini __inifile_optionkey = run -_asset_path = "/home/dion/codes/dune/dorie/testing" +_asset_path = "/Users/lriedel/dune/dorie/testing" _evaluation = convergence, correlation output.fileName = convergence | unique -- GitLab