dune-vtk 2.12
Loading...
Searching...
No Matches
datacollectorinterface.impl.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
3#pragma once
4
6
7namespace Dune::Vtk {
8
9template <class GV, class D, class P>
10 template <class T, class VtkFunction>
11std::vector<T> DataCollectorInterface<GV,D,P>
12 ::cellDataImpl (VtkFunction const& fct) const
13{
14 std::vector<T> data;
15 data.reserve(this->numCells() * fct.numComponents());
16
17 auto localFct = localFunction(fct);
18 for (auto const& e : elements(gridView_, partition)) {
19 localFct.bind(e);
20 auto refElem = referenceElement<T,dim>(e.type());
21 for (int comp = 0; comp < fct.numComponents(); ++comp)
22 data.emplace_back(localFct.evaluate(comp, refElem.position(0,0)));
23 localFct.unbind();
24 }
25 return data;
26}
27
28} // end namespace Dune::Vtk
Definition datacollector.hh:19
std::uint64_t numCells() const
Return the number of cells in (this partition of the) grid.
Definition datacollectorinterface.hh:59
Implementation of DataCollector for cells, with continuous data.
Definition celltypedatacollector.hh:20
static constexpr auto partition
The partitionset to collect data from.
Definition datacollectorinterface.hh:26