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

[mapper] Allow for new interface mapper.update(gridView) and deprecate usage of old mappers

parent 9af849b7
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <dune/grid/common/mcmgmapper.hh> #include <dune/grid/common/mcmgmapper.hh>
#include <dune/grid/common/rangegenerators.hh> #include <dune/grid/common/rangegenerators.hh>
#include <dumux/common/deprecated.hh>
namespace Dumux { namespace Dumux {
...@@ -306,7 +307,10 @@ public: ...@@ -306,7 +307,10 @@ public:
void update() void update()
{ {
elementMapper_.update(); if constexpr (Deprecated::hasUpdateGridView<ElementMapper, GridView>())
elementMapper_.update(gridView_);
else
Deprecated::update(elementMapper_);
intersectionMapGlobal_.clear(); intersectionMapGlobal_.clear();
intersectionMapGlobal_.resize(elementMapper_.size()); intersectionMapGlobal_.resize(elementMapper_.size());
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <dune/grid/common/mcmgmapper.hh> #include <dune/grid/common/mcmgmapper.hh>
#include <dumux/common/deprecated.hh>
#include <dumux/common/entitymap.hh> #include <dumux/common/entitymap.hh>
#include <dumux/common/indextraits.hh> #include <dumux/common/indextraits.hh>
#include <dumux/geometry/boundingboxtree.hh> #include <dumux/geometry/boundingboxtree.hh>
...@@ -90,8 +91,15 @@ public: ...@@ -90,8 +91,15 @@ public:
void update() void update()
{ {
//! Update the mappers //! Update the mappers
vertexMapper_.update(); if constexpr (Deprecated::hasUpdateGridView<ElementMapper, GridView>())
elementMapper_.update(); elementMapper_.update(gridView_);
else
Deprecated::update(elementMapper_);
if constexpr (Deprecated::hasUpdateGridView<VertexMapper, GridView>())
vertexMapper_.update(gridView_);
else
Deprecated::update(vertexMapper_);
//! Compute the bouding box of the entire domain, for e.g. setting boundary conditions //! Compute the bouding box of the entire domain, for e.g. setting boundary conditions
computeGlobalBoundingBox_(); computeGlobalBoundingBox_();
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include <dune/grid/io/file/vtk/vtkwriter.hh> #include <dune/grid/io/file/vtk/vtkwriter.hh>
#include <dune/grid/io/file/vtk/function.hh> #include <dune/grid/io/file/vtk/function.hh>
#include <dumux/common/deprecated.hh>
#if HAVE_MPI #if HAVE_MPI
#include <mpi.h> #include <mpi.h>
#endif #endif
...@@ -196,8 +198,15 @@ public: ...@@ -196,8 +198,15 @@ public:
*/ */
void gridChanged() void gridChanged()
{ {
elementMapper_.update(); if constexpr (Deprecated::hasUpdateGridView<ElementMapper, GridView>())
vertexMapper_.update(); elementMapper_.update(gridView_);
else
Deprecated::update(elementMapper_);
if constexpr (Deprecated::hasUpdateGridView<VertexMapper, GridView>())
vertexMapper_.update(gridView_);
else
Deprecated::update(vertexMapper_);
} }
/*! /*!
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include<dune/istl/operators.hh> #include<dune/istl/operators.hh>
#include<dune/istl/bcrsmatrix.hh> #include<dune/istl/bcrsmatrix.hh>
#include <dumux/common/deprecated.hh>
#include <dumux/porousmediumflow/sequential/pressureproperties.hh> #include <dumux/porousmediumflow/sequential/pressureproperties.hh>
#include <dumux/common/boundaryconditions.hh> #include <dumux/common/boundaryconditions.hh>
#include "localstiffness.hh" #include "localstiffness.hh"
...@@ -111,7 +112,10 @@ public: ...@@ -111,7 +112,10 @@ public:
//! Initialize the CR operator assembler //! Initialize the CR operator assembler
void initialize() void initialize()
{ {
faceMapper_.update(); if constexpr (Deprecated::hasUpdateGridView<FaceMapper, GridView>())
faceMapper_.update(gridView_);
else
Deprecated::update(faceMapper_);
size_ = faceMapper_.size(); size_ = faceMapper_.size();
A_.setSize(size_, size_, nnz()); A_.setSize(size_, size_, nnz());
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <unordered_map> #include <unordered_map>
#include <dune/grid/common/partitionset.hh> #include <dune/grid/common/partitionset.hh>
#include <dumux/common/deprecated.hh>
#include "properties.hh" #include "properties.hh"
#include "gridadaptproperties.hh" #include "gridadaptproperties.hh"
...@@ -187,7 +188,11 @@ public: ...@@ -187,7 +188,11 @@ public:
// forceRefineRatio(1); // forceRefineRatio(1);
// update mapper to new cell indices // update mapper to new cell indices
problem_.variables().elementMapper().update(); using ElementMapper = std::decay_t<decltype(problem_.variables().elementMapper())>;
if constexpr (Deprecated::hasUpdateGridView<ElementMapper, GridView>())
problem_.variables().elementMapper().update(problem_.gridView());
else
Deprecated::update(problem_.variables().elementMapper());
// adapt size of vectors // adapt size of vectors
problem_.variables().adaptVariableSize(problem_.variables().elementMapper().size()); problem_.variables().adaptVariableSize(problem_.variables().elementMapper().size());
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#define DUMUX_VARIABLECLASS_HH #define DUMUX_VARIABLECLASS_HH
#include "properties.hh" #include "properties.hh"
#include <dumux/common/deprecated.hh>
// for parallelization // for parallelization
//#include <dumux/parallel/elementhandles.hh> //#include <dumux/parallel/elementhandles.hh>
...@@ -89,8 +89,16 @@ public: ...@@ -89,8 +89,16 @@ public:
*/ */
void initialize() void initialize()
{ {
elementMapper_.update(); if constexpr (Deprecated::hasUpdateGridView<ElementMapper, GridView>())
vertexMapper_.update(); elementMapper_.update(gridView_);
else
Deprecated::update(elementMapper_);
if constexpr (Deprecated::hasUpdateGridView<VertexMapper, GridView>())
vertexMapper_.update(gridView_);
else
Deprecated::update(vertexMapper_);
cellDataVector_.resize(gridView_.size(0)); cellDataVector_.resize(gridView_.size(0));
} }
......
Supports Markdown
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