dune-vtk  0.2
datacollectorinterface.impl.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <dune/geometry/referenceelements.hh>
4 
5 namespace Dune {
6 namespace Vtk {
7 
8 template <class GV, class D, class P>
9  template <class T, class VtkFunction>
10 std::vector<T> DataCollectorInterface<GV,D,P>
11  ::cellDataImpl (VtkFunction const& fct) const
12 {
13  std::vector<T> data;
14  data.reserve(this->numCells() * fct.numComponents());
15 
16  auto localFct = localFunction(fct);
17  for (auto const& e : elements(gridView_, partition)) {
18  localFct.bind(e);
19  auto refElem = referenceElement<T,dim>(e.type());
20  for (int comp = 0; comp < fct.numComponents(); ++comp)
21  data.emplace_back(localFct.evaluate(comp, refElem.position(0,0)));
22  localFct.unbind();
23  }
24  return data;
25 }
26 
27 } } // end namespace Dune::Vtk
Definition: writer.hh:13
std::vector< T > cellDataImpl(VtkFunction const &fct) const
Definition: datacollectorinterface.impl.hh:11