Commit 02e5f3f7 authored by Timo Koch's avatar Timo Koch
Browse files

[cleanup] Remove all leftover occurences of deprecated map()

Replace by the index/subIndex method
parent 178f03cf
......@@ -18,12 +18,12 @@
#ifndef DUMUX_INTERSECTIONITERATOR_HH
#define DUMUX_INTERSECTIONITERATOR_HH
#include<vector>
#include<unordered_map>
#include <vector>
#include <unordered_map>
#include<dune/common/deprecated.hh>
#include<dune/grid/common/mcmgmapper.hh>
#include<dune/grid/common/rangegenerators.hh>
#include <dune/common/deprecated.hh>
#include <dune/grid/common/mcmgmapper.hh>
#include <dune/grid/common/rangegenerators.hh>
/*!
* \file
......@@ -165,12 +165,12 @@ public:
int maplocal(const Element& element, int fIdx)
{
return intersectionMapLocal_[map(element)][fIdx];
return intersectionMapLocal_[index(element)][fIdx];
}
int maplocal(const Element& element, int fIdx) const
{
return (intersectionMapLocal_[map(element)].find(fIdx))->second;//use find() for const function!
return (intersectionMapLocal_[index(element)].find(fIdx))->second;//use find() for const function!
}
// return number intersections
......
......@@ -563,7 +563,7 @@ public:
*/
bool refine(const Element& element)
{
int idx = problem_.elementMapper().map(element);
int idx = problem_.elementMapper().index(element);
return (indicatorVector_[idx] > refineBound_);
}
......@@ -575,7 +575,7 @@ public:
*/
bool coarsen(const Element& element)
{
int idx = problem_.elementMapper().map(element);
int idx = problem_.elementMapper().index(element);
return (indicatorVector_[idx] < coarsenBound_);
}
......
......@@ -127,8 +127,6 @@ public:
// compute and set the enthalpy
Scalar h = Implementation::enthalpy_(fluidState, paramCache, phaseIdx);
fluidState.setEnthalpy(phaseIdx, h);
// int vIdxGlobal = problem.model().dofMapper().map(element, scvIdx, dim);
}
/*!
......
......@@ -326,7 +326,7 @@ public:
bool isRed = false;
int numVertices = element.template count<dim>();
for (int i=0; i < numVertices; ++i) {
int globalI = vertexMapper_().map(element, i, dim);
int globalI = vertexMapper_().subIndex(element, i, dim);
if (vertexColor_[globalI] == Red) {
isRed = true;
break;
......@@ -335,7 +335,7 @@ public:
// if yes, the element color is also red, else it is not
// red, i.e. green for the mean time
int eIdxGlobal = elementMapper_().map(element);
int eIdxGlobal = elementMapper_().index(element);
if (isRed)
elementColor_[eIdxGlobal] = Red;
else
......@@ -344,14 +344,14 @@ public:
// Mark yellow vertices (as orange for the mean time)
for (const auto& element : Dune::elements(gridView_())) {
int eIdx = this->elementMapper_().map(element);
int eIdx = this->elementMapper_().index(element);
if (elementColor_[eIdx] != Red)
continue; // non-red elements do not tint vertices
// yellow!
int numVertices = element.template count<dim>();
for (int i=0; i < numVertices; ++i) {
int globalI = vertexMapper_().map(element, i, dim);
int globalI = vertexMapper_().subIndex(element, i, dim);
// if a vertex is already red, don't recolor it to
// yellow!
if (vertexColor_[globalI] != Red)
......@@ -361,7 +361,7 @@ public:
// Mark yellow elements
for (const auto& element : Dune::elements(gridView_())) {
int eIdx = this->elementMapper_().map(element);
int eIdx = this->elementMapper_().index(element);
if (elementColor_[eIdx] == Red) {
continue; // element is red already!
}
......@@ -371,7 +371,7 @@ public:
bool isYellow = false;
int numVertices = element.template count<dim>();
for (int i=0; i < numVertices; ++i) {
int globalI = vertexMapper_().map(element, i, dim);
int globalI = vertexMapper_().subIndex(element, i, dim);
if (vertexColor_[globalI] == Orange) {
isYellow = true;
break;
......@@ -385,14 +385,14 @@ public:
// Demote orange vertices to yellow ones if it has at least
// one green element as a neighbor.
for (const auto& element : Dune::elements(gridView_())) {
int eIdx = this->elementMapper_().map(element);
int eIdx = this->elementMapper_().index(element);
if (elementColor_[eIdx] != Green)
continue; // yellow and red elements do not make
// orange vertices yellow!
int numVertices = element.template count<dim>();
for (int i=0; i < numVertices; ++i) {
int globalI = vertexMapper_().map(element, i, dim);
int globalI = vertexMapper_().subIndex(element, i, dim);
// if a vertex is orange, recolor it to yellow!
if (vertexColor_[globalI] == Orange)
vertexColor_[globalI] = Yellow;
......@@ -453,7 +453,7 @@ public:
if (!enablePartialReassemble)
return Red; // reassemble unconditionally!
int eIdxGlobal = elementMapper_().map(element);
int eIdxGlobal = elementMapper_().index(element);
return elementColor_[eIdxGlobal];
}
......
......@@ -510,7 +510,7 @@ public:
void serializeEntity(std::ostream &outstream,
const Entity &entity)
{
int dofIdxGlobal = dofMapper().map(entity);
int dofIdxGlobal = dofMapper().index(entity);
// write phase state
if (!outstream.good()) {
......@@ -538,7 +538,7 @@ public:
void deserializeEntity(std::istream &instream,
const Entity &entity)
{
int dofIdxGlobal = dofMapper().map(entity);
int dofIdxGlobal = dofMapper().index(entity);
for (int eqIdx = 0; eqIdx < numEq; ++eqIdx) {
if (!instream.good())
......@@ -765,7 +765,7 @@ public:
bool onBoundary(const Element &element) const
{
if (!isBox)
return onBoundary(elementMapper().map(element));
return onBoundary(elementMapper().index(element));
else
DUNE_THROW(Dune::InvalidStateException,
"requested for box model");
......@@ -844,7 +844,7 @@ protected:
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; scvIdx++)
{
// get the global index of the degree of freedom
int dofIdxGlobal = dofMapper().map(element, scvIdx, dofCodim);
int dofIdxGlobal = dofMapper().subIndex(element, scvIdx, dofCodim);
// let the problem do the dirty work of nailing down
// the initial solution.
......
......@@ -113,7 +113,7 @@ public:
fvGeometry.update(this->gridView_(), element);
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
int dofIdxGlobal = this->dofMapper().map(element, scvIdx, dofCodim);
int dofIdxGlobal = this->dofMapper().subIndex(element, scvIdx, dofCodim);
if (ParentType::staticDat_[dofIdxGlobal].visited)
continue;
......
......@@ -119,7 +119,7 @@ public:
scvIdx,
isOldSol);
int dofIdxGlobal = problem.model().dofMapper().map(element, scvIdx, dofCodim);
int dofIdxGlobal = problem.model().dofMapper().subIndex(element, scvIdx, dofCodim);
int phasePresence = problem.model().phasePresence(dofIdxGlobal, isOldSol);
......
......@@ -187,7 +187,7 @@ public:
const ElementBoundaryTypes &elemBcTypes)
{
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx) {
int gobalIdx = this->problem_.model().dofMapper().map(element, scvIdx, dofCodim);
int gobalIdx = this->problem_.model().dofMapper().subIndex(element, scvIdx, dofCodim);
const VolumeVariables &volVars = elemVolVars[scvIdx];
if (temperatureOutput_) temperature_[gobalIdx] = volVars.fluidState().temperature(/*phaseIdx=*/0);
......
......@@ -271,7 +271,7 @@ public:
// }
//
// // velocity Check
// const unsigned int globalVertexIdx = this->problem_().vertexMapper().map(element, scvIdx, dim);
// const unsigned int globalVertexIdx = this->problem_().vertexMapper().subIndex(element, scvIdx, dim);
// for(int phaseIdx=0; phaseIdx<numPhases; phaseIdx++){
// const Scalar eps = 1e-6 ;
// const Scalar velocityTest = volumeDarcyMagVelocity(phaseIdx, globalVertexIdx);
......
......@@ -539,7 +539,7 @@ public:
scvIdx);
// setting the dimensionless numbers.
// obtaining the respective quantities.
int globalVertexIdx = problem.vertexMapper().map(element, scvIdx, dim);
int globalVertexIdx = problem.vertexMapper().subIndex(element, scvIdx, dim);
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
const Scalar darcyMagVelocity = problem.model().volumeDarcyMagVelocity(phaseIdx, globalVertexIdx);
const Scalar dynamicViscosity = fluidState.viscosity(phaseIdx);
......
......@@ -508,7 +508,7 @@ public:
vertexMapper_(gridView)
{}
/*!
/*! DOC ME!! and RENAME ME if you know what exactly I'm doing!
*
*/
void map()
......
......@@ -55,7 +55,7 @@ class ParallelISTLHelper
{}
template<class EntityType>
int map(const EntityType& e) const
int index(const EntityType& e) const
{
return problem_.model().dofMapper().index(e);
}
......@@ -98,7 +98,7 @@ class ParallelISTLHelper
template<class MessageBuffer, class EntityType>
void gather (MessageBuffer& buff, const EntityType& e) const
{
buff.write(container_[this->map(e)]);
buff.write(container_[this->index(e)]);
}
template<class MessageBuffer, class EntityType>
......@@ -106,7 +106,7 @@ class ParallelISTLHelper
{
typename V::block_type block;
buff.read(block);
container_[this->map(e)]+=block;
container_[this->index(e)]+=block;
}
private:
V& container_;
......@@ -151,7 +151,7 @@ class ParallelISTLHelper
template<class MessageBuffer, class EntityType>
void gather (MessageBuffer& buff, const EntityType& e) const
{
std::size_t& data= ranks_[this->map(e)];
std::size_t& data= ranks_[this->index(e)];
if (e.partitionType()!=Dune::InteriorEntity && e.partitionType()!=Dune::BorderEntity)
data = (1<<24);
buff.write(data);
......@@ -161,7 +161,7 @@ class ParallelISTLHelper
void scatter (MessageBuffer& buff, const EntityType& e, size_t n)
{
std::size_t x;
std::size_t& data = ranks_[this->map(e)];
std::size_t& data = ranks_[this->index(e)];
buff.read(x);
if (e.partitionType()!=Dune::InteriorEntity && e.partitionType()!=Dune::BorderEntity)
data= (1<<24);
......@@ -210,7 +210,7 @@ class ParallelISTLHelper
void gather (MessageBuffer& buff, const EntityType& e) const
{
std::size_t& data = ranks_[this->map(e)];
std::size_t& data = ranks_[this->index(e)];
if (e.partitionType()!=Dune::InteriorEntity && e.partitionType()!=Dune::BorderEntity)
data = (1<<24);
buff.write(data);
......@@ -220,7 +220,7 @@ class ParallelISTLHelper
void scatter (MessageBuffer& buff, const EntityType& e, size_t n)
{
std::size_t x;
std::size_t& data = ranks_[this->map(e)];
std::size_t& data = ranks_[this->index(e)];
buff.read(x);
if (e.partitionType()!=Dune::InteriorEntity && e.partitionType()!=Dune::BorderEntity)
data = x;
......@@ -324,7 +324,7 @@ class ParallelISTLHelper
{
int x;
buff.read(x);
int& data= shared_[this->map(e)];
int& data= shared_[this->index(e)];
data = data || x;
}
private:
......@@ -366,7 +366,7 @@ class ParallelISTLHelper
template<class MessageBuffer, class EntityType>
void gather (MessageBuffer& buff, const EntityType& e) const
{
buff.write(gindices_[this->map(e)]);
buff.write(gindices_[this->index(e)]);
}
template<class MessageBuffer, class EntityType>
......@@ -374,7 +374,7 @@ class ParallelISTLHelper
{
DataType x;
buff.read(x);
gindices_[this->map(e)] = std::min(gindices_[this->map(e)], x);
gindices_[this->index(e)] = std::min(gindices_[this->index(e)], x);
}
private:
std::vector<GI>& gindices_;
......
......@@ -88,7 +88,7 @@ public:
void gather(MessageBufferImp &buff, const EntityType &e) const
{
buff.write(gridView_.comm().rank());
buff.write(map_.map(e));
buff.write(map_.index(e));
}
template<class MessageBufferImp, class EntityType>
......@@ -96,7 +96,7 @@ public:
{
BorderIndex bIdx;
bIdx.localIdx = map_.map(e);
bIdx.localIdx = map_.index(e);
buff.read(bIdx.peerRank);
buff.read(bIdx.peerIdx);
bIdx.borderDistance = 0;
......
......@@ -86,8 +86,8 @@ public:
typedef typename Entity::Geometry Geometry;
typedef typename Grid::LevelGridView GV;
typedef typename GV::IndexSet IS;
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GV,Dune::MCMGElementLayout> EM;
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GV,FaceLayout> FM;
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GV,Dune::MCMGElementLayout> ElementMapper;
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GV,FaceLayout> FaceMapper;
typedef typename Grid::ctype ct;
enum{dim = Grid::dimension};
......@@ -96,8 +96,8 @@ public:
typedef typename Dune::ReferenceElements<ct, dim> ReferenceElements;
const GV& gridview(grid.levelGridView(grid.maxLevel()));
const IS& indexset(gridview.indexSet());
EM elementmapper(gridview);
FM facemapper(gridview);
ElementMapper elementMapper(gridview);
FaceMapper faceMapper(gridview);
SolutionType& exactSol(grid.levelGridView(grid.maxLevel()));
uMean = 0;
......@@ -108,7 +108,7 @@ public:
double volume = element.geometry().volume();
// cell index
int indexi = elementmapper.map(element);
int indexi = elementMapper.index(element);
// get approximate solution value
uMean += volume*(problem.variables().cellData(indexi).globalPressure());
......@@ -174,7 +174,7 @@ public:
double exactValue = problem.exact(globalPos);
// cell index
int indexi = elementmapper.map(element);
int indexi = elementMapper.index(element);
// evaluate exact solution vector
exactSol[indexi] = exactValue;
......@@ -211,7 +211,7 @@ public:
i = intersection.indexInInside();
// global number of face
int faceIndex = facemapper.template map<1>(element, i);
int faceIndex = faceMapper.template map<1>(element, i);
Dune::FieldVector<double,dim> faceGlobal = intersection.geometry().center();
double faceVol = intersection.geometry().volume();
......@@ -472,7 +472,6 @@ public:
Scalar volume = geometry.volume();
//int eIdx = elementMapper.map(element);
int eIdx = problem.variables().index(element);
Scalar approxPressure = problem.variables().cellData(eIdx).globalPressure();
......@@ -727,11 +726,10 @@ public:
Scalar volume = geometry.integrationElement(local)
*ReferenceElements::general(geomType).volume();
int eIdx = elementMapper.map(element);
int eIdx = elementMapper.index(element);
Scalar approxPressure = solution[eIdx];
Scalar exactPressure = problem.exact(globalPos);
//std::cout << global << ": p =" << exactPressure << ", p_h = " << approxPressure << std::endl;
numerator += volume*(approxPressure - exactPressure)*(approxPressure - exactPressure);
denominator += volume*exactPressure*exactPressure;
......
......@@ -317,7 +317,7 @@ public:
{
FVElementGeometry fvGeometry;
fvGeometry.update(this->gridView(), element);
int eIdx = this->elementMapper().map(element);
int eIdx = this->elementMapper().index(element);
const DimWorldMatrix K = this->spatialParams().intrinsicPermeability(element, fvGeometry, /*element data*/ 0);
// transfer output to mD = 9.86923e-16 m^2
......
......@@ -266,14 +266,14 @@ public:
for (const auto& element : Dune::elements(this->gridView()))
{
int eIdx = this->elementMapper().map(element);
int eIdx = this->elementMapper().index(element);
(*rank)[eIdx] = this->gridView().comm().rank();
fvGeometry.update(this->gridView(), element);
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
int dofIdxGlobal = this->model().dofMapper().map(element, scvIdx, dofCodim);
int dofIdxGlobal = this->model().dofMapper().subIndex(element, scvIdx, dofCodim);
volVars.update(this->model().curSol()[dofIdxGlobal],
*this,
element,
......
......@@ -273,14 +273,14 @@ public:
for (const auto& element : Dune::elements(this->gridView()))
{
int eIdx = this->elementMapper().map(element);
int eIdx = this->elementMapper().index(element);
(*rank)[eIdx] = this->gridView().comm().rank();
fvGeometry.update(this->gridView(), element);
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
int dofIdxGlobal = this->model().dofMapper().map(element, scvIdx, dofCodim);
int dofIdxGlobal = this->model().dofMapper().subIndex(element, scvIdx, dofCodim);
volVars.update(this->model().curSol()[dofIdxGlobal],
*this,
element,
......
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