datacollectorinterface.impl.hh 805 Bytes
Newer Older
1
2
3
4
#pragma once

#include <dune/geometry/referenceelements.hh>

Stenger, Florian's avatar
Stenger, Florian committed
5
namespace Dune
6
{
7

Stenger, Florian's avatar
Stenger, Florian committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  namespace Vtk
  {

    template <class GV, class D, class P>
      template <class T, class VtkFunction>
    std::vector<T> DataCollectorInterface<GV,D,P>
      ::cellDataImpl (VtkFunction const& fct) const
    {
      std::vector<T> data;
      data.reserve(this->numCells() * fct.ncomps());

      auto localFct = localFunction(fct);
      for (auto const& e : elements(gridView_, partition)) {
        localFct.bind(e);
        auto refElem = referenceElement<T,dim>(e.type());
        for (int comp = 0; comp < fct.ncomps(); ++comp)
          data.emplace_back(localFct.evaluate(comp, refElem.position(0,0)));
        localFct.unbind();
      }
      return data;
    }
29

Stenger, Florian's avatar
Stenger, Florian committed
30
  } // end namespace Vtk
31
} // end namespace Dune