Skip to content
Snippets Groups Projects
Commit 4d0ad4f5 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'issue/mcmg_mapper' into 'master'

use mcmg mapper instead of index set when traversing elements

See merge request spraetor/dune-vtk!12
parents 6a19c03c b41890c4
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <dune/geometry/referenceelements.hh> #include <dune/geometry/referenceelements.hh>
#include <dune/grid/common/gridenums.hh> #include <dune/grid/common/gridenums.hh>
#include <dune/grid/common/mcmgmapper.hh>
namespace Dune { namespace Dune {
...@@ -11,12 +12,12 @@ std::vector<T> DataCollectorInterface<GridView, Derived> ...@@ -11,12 +12,12 @@ std::vector<T> DataCollectorInterface<GridView, Derived>
::cellDataImpl (VtkFunction const& fct) const ::cellDataImpl (VtkFunction const& fct) const
{ {
std::vector<T> data(gridView_.size(0) * fct.ncomps()); std::vector<T> data(gridView_.size(0) * fct.ncomps());
auto const& indexSet = gridView_.indexSet(); MultipleCodimMultipleGeomTypeMapper<GridView> mapper(gridView_, mcmgElementLayout());
auto localFct = localFunction(fct); auto localFct = localFunction(fct);
for (auto const& e : elements(gridView_, Partitions::all)) { for (auto const& e : elements(gridView_, Partitions::all)) {
localFct.bind(e); localFct.bind(e);
auto refElem = referenceElement<T,GridView::dimension>(e.type()); auto refElem = referenceElement<T,GridView::dimension>(e.type());
std::size_t idx = fct.ncomps() * indexSet.index(e); std::size_t idx = fct.ncomps() * mapper.index(e);
for (int comp = 0; comp < fct.ncomps(); ++comp) for (int comp = 0; comp < fct.ncomps(); ++comp)
data[idx + comp] = T(localFct.evaluate(comp, refElem.position(0,0))); data[idx + comp] = T(localFct.evaluate(comp, refElem.position(0,0)));
localFct.unbind(); localFct.unbind();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment