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
Pipeline #6005 passed with stages
......@@ -29,6 +29,7 @@
#include <dune/grid/common/mcmgmapper.hh>
#include <dune/grid/common/rangegenerators.hh>
#include <dumux/common/deprecated.hh>
namespace Dumux {
......@@ -306,7 +307,10 @@ public:
void update()
{
elementMapper_.update();
if constexpr (Deprecated::hasUpdateGridView<ElementMapper, GridView>())
elementMapper_.update(gridView_);
else
Deprecated::update(elementMapper_);
intersectionMapGlobal_.clear();
intersectionMapGlobal_.resize(elementMapper_.size());
......
......@@ -28,6 +28,7 @@
#include <dune/grid/common/mcmgmapper.hh>
#include <dumux/common/deprecated.hh>
#include <dumux/common/entitymap.hh>
#include <dumux/common/indextraits.hh>
#include <dumux/geometry/boundingboxtree.hh>
......@@ -90,8 +91,15 @@ public:
void update()
{
//! Update the mappers
vertexMapper_.update();
elementMapper_.update();
if constexpr (Deprecated::hasUpdateGridView<ElementMapper, GridView>())
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
computeGlobalBoundingBox_();
......
......@@ -38,6 +38,8 @@
#include <dune/grid/io/file/vtk/vtkwriter.hh>
#include <dune/grid/io/file/vtk/function.hh>
#include <dumux/common/deprecated.hh>
#if HAVE_MPI
#include <mpi.h>
#endif
......@@ -196,8 +198,15 @@ public:
*/
void gridChanged()
{
elementMapper_.update();
vertexMapper_.update();
if constexpr (Deprecated::hasUpdateGridView<ElementMapper, GridView>())
elementMapper_.update(gridView_);
else
Deprecated::update(elementMapper_);
if constexpr (Deprecated::hasUpdateGridView<VertexMapper, GridView>())
vertexMapper_.update(gridView_);
else
Deprecated::update(vertexMapper_);
}
/*!
......
......@@ -41,6 +41,7 @@
#include<dune/istl/operators.hh>
#include<dune/istl/bcrsmatrix.hh>
#include <dumux/common/deprecated.hh>
#include <dumux/porousmediumflow/sequential/pressureproperties.hh>
#include <dumux/common/boundaryconditions.hh>
#include "localstiffness.hh"
......@@ -111,7 +112,10 @@ public:
//! Initialize the CR operator assembler
void initialize()
{
faceMapper_.update();
if constexpr (Deprecated::hasUpdateGridView<FaceMapper, GridView>())
faceMapper_.update(gridView_);
else
Deprecated::update(faceMapper_);
size_ = faceMapper_.size();
A_.setSize(size_, size_, nnz());
......
......@@ -25,6 +25,7 @@
#include <unordered_map>
#include <dune/grid/common/partitionset.hh>
#include <dumux/common/deprecated.hh>
#include "properties.hh"
#include "gridadaptproperties.hh"
......@@ -187,7 +188,11 @@ public:
// forceRefineRatio(1);
// 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
problem_.variables().adaptVariableSize(problem_.variables().elementMapper().size());
......
......@@ -20,7 +20,7 @@
#define DUMUX_VARIABLECLASS_HH
#include "properties.hh"
#include <dumux/common/deprecated.hh>
// for parallelization
//#include <dumux/parallel/elementhandles.hh>
......@@ -89,8 +89,16 @@ public:
*/
void initialize()
{
elementMapper_.update();
vertexMapper_.update();
if constexpr (Deprecated::hasUpdateGridView<ElementMapper, GridView>())
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));
}
......
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