mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #736 from akva2/use_range_generators
Use elements range generator
This commit is contained in:
commit
6f54bd9310
@ -380,11 +380,8 @@ public:
|
||||
// update the history of the hysteresis law
|
||||
ElementContext elemCtx(this->simulator());
|
||||
|
||||
auto elemIt = this->gridView().template begin<0>();
|
||||
const auto& elemEndIt = this->gridView().template end<0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const auto& elem = *elemIt;
|
||||
elemCtx.updateAll( elem );
|
||||
for (const auto& elem : elements(this->gridView())) {
|
||||
elemCtx.updateAll(elem);
|
||||
size_t numDofs = elemCtx.numDof(/*timeIdx=*/0);
|
||||
for (unsigned scvIdx = 0; scvIdx < numDofs; ++scvIdx)
|
||||
{
|
||||
|
@ -247,10 +247,8 @@ public:
|
||||
|
||||
// determine which degrees of freedom are in the lens
|
||||
Stencil stencil(this->gridView(), this->simulator().model().dofMapper() );
|
||||
auto elemIt = this->gridView().template begin</*codim=*/0>();
|
||||
auto elemEndIt = this->gridView().template end</*codim=*/0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
stencil.update(*elemIt);
|
||||
for (const auto& elem : elements(this->gridView())) {
|
||||
stencil.update(elem);
|
||||
for (unsigned dofIdx = 0; dofIdx < stencil.numPrimaryDof(); ++ dofIdx) {
|
||||
unsigned globalDofIdx = stencil.globalSpaceIndex(dofIdx);
|
||||
const auto& dofPos = stencil.subControlVolume(dofIdx).center();
|
||||
|
@ -542,10 +542,8 @@ public:
|
||||
// them into the restart file and re-reading them, but it is better to calculate
|
||||
// them from scratch because the input could have been changed in this regard...
|
||||
ElementContext elemCtx(this->simulator_);
|
||||
auto elemIt = this->gridView().template begin</*codim=*/0>();
|
||||
auto elemEndIt = this->gridView().template end</*codim=*/0>();
|
||||
for (; elemIt != elemEndIt; ++ elemIt) {
|
||||
elemCtx.updateStencil(*elemIt);
|
||||
for (const auto& elem : elements(this->gridView())) {
|
||||
elemCtx.updateStencil(elem);
|
||||
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timIdx=*/0); ++dofIdx) {
|
||||
unsigned globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timIdx=*/0);
|
||||
updatePvtRegionIndex_(this->solution(/*timeIdx=*/0)[globalDofIdx],
|
||||
|
@ -321,12 +321,8 @@ public:
|
||||
ElementContext elemCtx( this->simulator() );
|
||||
auto gridView = this->simulator().vanguard().gridView();
|
||||
auto& grid = this->simulator().vanguard().grid();
|
||||
auto elemIt = gridView.template begin</*codim=*/0, Dune::Interior_Partition>();
|
||||
auto elemEndIt = gridView.template end</*codim=*/0, Dune::Interior_Partition>();
|
||||
for (; elemIt != elemEndIt; ++elemIt)
|
||||
{
|
||||
const auto& element = *elemIt ;
|
||||
elemCtx.updateAll( element );
|
||||
for (const auto& element : elements(gridView, Dune::Partitions::interior)) {
|
||||
elemCtx.updateAll(element);
|
||||
|
||||
// HACK: this should better be part of an AdaptionCriterion class
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
|
@ -522,10 +522,7 @@ public:
|
||||
gridTotalVolume_ = 0.0;
|
||||
|
||||
// iterate through the grid and evaluate the initial condition
|
||||
ElementIterator elemIt = gridView_.template begin</*codim=*/0>();
|
||||
const ElementIterator& elemEndIt = gridView_.template end</*codim=*/0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const Element& elem = *elemIt;
|
||||
for (const auto& elem : elements(gridView_)) {
|
||||
const bool isInteriorElement = elem.partitionType() == Dune::InteriorEntity;
|
||||
// ignore everything which is not in the interior if the
|
||||
// current process' piece of the grid
|
||||
@ -599,10 +596,7 @@ public:
|
||||
ElementContext elemCtx(simulator_);
|
||||
|
||||
// iterate through the grid and evaluate the initial condition
|
||||
ElementIterator elemIt = gridView_.template begin</*codim=*/0>();
|
||||
const ElementIterator& elemEndIt = gridView_.template end</*codim=*/0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const Element& elem = *elemIt;
|
||||
for (const auto& elem : elements(gridView_)) {
|
||||
// ignore everything which is not in the interior if the
|
||||
// current process' piece of the grid
|
||||
if (elem.partitionType() != Dune::InteriorEntity)
|
||||
|
@ -341,10 +341,7 @@ private:
|
||||
using NeighborSet = std::set< unsigned >;
|
||||
std::vector<NeighborSet> sparsityPattern(model.numTotalDof());
|
||||
|
||||
ElementIterator elemIt = gridView_().template begin<0>();
|
||||
const ElementIterator elemEndIt = gridView_().template end<0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const Element& elem = *elemIt;
|
||||
for (const auto& elem : elements(gridView_())) {
|
||||
stencil.update(elem);
|
||||
|
||||
for (unsigned primaryDofIdx = 0; primaryDofIdx < stencil.numPrimaryDof(); ++primaryDofIdx) {
|
||||
|
@ -318,10 +318,7 @@ private:
|
||||
std::vector<NeighborInfo> loc_nbinfo;
|
||||
const auto& materialLawManager = problem_().materialLawManager();
|
||||
using FaceDirection = FaceDir::DirEnum;
|
||||
ElementIterator elemIt = gridView_().template begin<0>();
|
||||
const ElementIterator elemEndIt = gridView_().template end<0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const Element& elem = *elemIt;
|
||||
for (const auto& elem : elements(gridView_())) {
|
||||
stencil.update(elem);
|
||||
|
||||
for (unsigned primaryDofIdx = 0; primaryDofIdx < stencil.numPrimaryDof(); ++primaryDofIdx) {
|
||||
|
@ -498,12 +498,7 @@ public:
|
||||
std::vector<bool> visited(this->numGridDof(), false);
|
||||
ElementContext elemCtx(this->simulator_);
|
||||
|
||||
ElementIterator elemIt = this->gridView_.template begin<0>();
|
||||
ElementIterator elemEndIt = this->gridView_.template end<0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const Element& elem = *elemIt;
|
||||
if (elem.partitionType() != Dune::InteriorEntity)
|
||||
continue;
|
||||
for (const auto& elem : elements(this->gridView_, Dune::Partitions::interior)) {
|
||||
elemCtx.updateStencil(elem);
|
||||
|
||||
size_t numLocalDof = elemCtx.stencil(/*timeIdx=*/0).numPrimaryDof();
|
||||
|
@ -71,11 +71,8 @@ public:
|
||||
// whole grid and update a stencil for each element
|
||||
Data *curElemDataPtr = &data_[0];
|
||||
Stencil stencil(gridView_, dofMapper_);
|
||||
auto elemIt = gridView_.template begin</*codim=*/0>();
|
||||
const auto& elemEndIt = gridView_.template end</*codim=*/0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
for (const auto& elem : elements(gridView_)) {
|
||||
// set the DOF data pointer for the current element
|
||||
const auto& elem = *elemIt;
|
||||
unsigned elemIdx = elementMapper_.index(elem);
|
||||
elemData_[elemIdx] = curElemDataPtr;
|
||||
|
||||
@ -112,10 +109,8 @@ private:
|
||||
|
||||
// loop over the whole grid and sum up the number of local DOFs of all Stencils
|
||||
Stencil stencil(gridView_, dofMapper_);
|
||||
auto elemIt = gridView_.template begin</*codim=*/0>();
|
||||
const auto& elemEndIt = gridView_.template end</*codim=*/0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
stencil.update(*elemIt);
|
||||
for (const auto& elem : elements(gridView_)) {
|
||||
stencil.update(elem);
|
||||
result += stencil.numDof();
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include <dune/grid/common/datahandleif.hh>
|
||||
#include <dune/grid/common/gridenums.hh>
|
||||
#include <dune/grid/common/partitionset.hh>
|
||||
#include <dune/istl/bcrsmatrix.hh>
|
||||
#include <dune/istl/scalarproducts.hh>
|
||||
#include <dune/istl/operators.hh>
|
||||
@ -68,11 +69,9 @@ class ElementBorderListFromGrid
|
||||
, blackList_(blackList)
|
||||
, borderList_(borderList)
|
||||
{
|
||||
auto elemIt = gridView_.template begin<0>();
|
||||
const auto& elemEndIt = gridView_.template end<0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
if (elemIt->partitionType() != Dune::InteriorEntity) {
|
||||
Index elemIdx = static_cast<Index>(map_.index(*elemIt));
|
||||
for (const auto& elem : elements(gridView_)) {
|
||||
if (elem.partitionType() != Dune::InteriorEntity) {
|
||||
Index elemIdx = static_cast<Index>(map_.index(elem));
|
||||
blackList_.addIndex(elemIdx);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user