66 void update(
const GridGeometry& gridGeometry)
69 map_.resize(gridGeometry.gridView().size(0));
72 Dune::ReservedVector<std::pair<GridIndexType, DataJ>, maxElemStencilSize> dataJForI;
73 auto fvGeometry =
localView(gridGeometry);
74 for (
const auto& element : elements(gridGeometry.gridView()))
77 const auto globalJ = gridGeometry.elementMapper().index(element);
78 fvGeometry.bindElement(element);
84 for (
auto&& scvf : scvfs(fvGeometry))
86 const auto& stencil = FluxStencil::stencil(element, fvGeometry, scvf);
89 for (
auto globalI : stencil)
91 if (globalI == globalJ)
94 auto it = std::find_if(dataJForI.begin(), dataJForI.end(),
95 [globalI](
const auto& pair) { return pair.first == globalI; });
97 if (it != dataJForI.end())
98 it->second.scvfsJ.push_back(scvf.index());
101 if (dataJForI.size() > maxElemStencilSize - 1)
102 DUNE_THROW(Dune::InvalidStateException,
"Maximum admissible stencil size (" << maxElemStencilSize-1
103 <<
") is surpassed (" << dataJForI.size() <<
"). "
104 <<
"Please adjust the GridGeometry traits accordingly!");
106 dataJForI.push_back(std::make_pair(globalI, DataJ({globalJ, {scvf.index()}, {}})));
111 for (
auto&& pair : dataJForI)
112 map_[pair.first].emplace_back(std::move(pair.second));