7#include <dune/geometry/referenceelements.hh>
8#include <dune/grid/common/partitionset.hh>
9#include <dune/grid/common/partitionset.hh>
20 template <
class GridView,
int ORDER = -1>
28 static_assert(ORDER != 0,
"Order 0 not supported");
37 assert(order > 0 &&
"Order 0 not supported");
38 assert(ORDER < 0 || order == ORDER);
44 auto const& indexSet =
gridView_.indexSet();
47 for (
auto gt : indexSet.types(0))
51 pointSet.second.build(pointSet.first);
55 auto gt = pointSet.first;
56 auto refElem = referenceElement<double,dim>(gt);
57 numPoints_ += (pointSet.second.size() - refElem.size(
dim)) * indexSet.size(gt);
75 std::vector<T> data(this->
numPoints() * 3);
76 auto const& indexSet =
gridView_.indexSet();
78 std::size_t shift = indexSet.size(
dim);
81 auto geometry = element.geometry();
82 auto refElem = referenceElement<T,dim>(element.type());
84 auto const& pointSet =
pointSets_.at(element.type());
85 unsigned int vertexDOFs = refElem.size(
dim);
86 unsigned int innerDOFs = pointSet.size() - vertexDOFs;
88 for (std::size_t i = 0; i < pointSet.size(); ++i) {
89 auto const& p = pointSet[i];
91 assert(p.localKey().codim() ==
dim);
93 auto const& localKey = p.localKey();
94 std::size_t idx = 3 * (localKey.codim() ==
dim
95 ? indexSet.subIndex(element, localKey.subEntity(),
dim)
96 : innerDOFs*indexSet.index(element) + (i - vertexDOFs) + shift);
98 auto v = geometry.global(p.point());
99 for (std::size_t j = 0; j < v.size(); ++j)
100 data[idx + j] = T(v[j]);
101 for (std::size_t j = v.size(); j < 3u; ++j)
102 data[idx + j] = T(0);
126 auto const& indexSet =
gridView_.indexSet();
127 std::size_t shift = indexSet.size(
dim);
129 std::int64_t old_o = 0;
131 auto refElem = referenceElement<double,dim>(element.type());
134 auto const& pointSet =
pointSets_.at(element.type());
135 unsigned int vertexDOFs = refElem.size(
dim);
136 unsigned int innerDOFs = pointSet.size() - vertexDOFs;
138 for (std::size_t i = 0; i < pointSet.size(); ++i) {
139 auto const& p = pointSet[i];
140 auto const& localKey = p.localKey();
141 std::size_t idx = (localKey.codim() ==
dim
142 ? indexSet.subIndex(element, localKey.subEntity(),
dim)
143 : innerDOFs*indexSet.index(element) + (i - vertexDOFs) + shift);
154 template <
class T,
class GlobalFunction>
157 int nComps = fct.numComponents();
158 std::vector<T> data(this->
numPoints() * nComps);
159 auto const& indexSet =
gridView_.indexSet();
161 std::size_t shift = indexSet.size(
dim);
163 auto localFct = localFunction(fct);
165 localFct.bind(element);
166 auto refElem = referenceElement<T,dim>(element.type());
168 auto const& pointSet =
pointSets_.at(element.type());
169 unsigned int vertexDOFs = refElem.size(
dim);
170 unsigned int innerDOFs = pointSet.size() - vertexDOFs;
172 for (std::size_t i = 0; i < pointSet.size(); ++i) {
173 auto const& p = pointSet[i];
174 auto const& localKey = p.localKey();
175 std::size_t idx = nComps * (localKey.codim() ==
dim
176 ? indexSet.subIndex(element, localKey.subEntity(),
dim)
177 : innerDOFs*indexSet.index(element) + (i - vertexDOFs) + shift);
179 for (
int comp = 0; comp < nComps; ++comp)
180 data[idx + comp] = T(localFct.evaluate(comp, p.point()));
std::uint64_t numPoints() const
Return the number of points in (this partition of the) grid.
Definition: datacollectorinterface.hh:58
GridViewType GridView
Definition: datacollectorinterface.hh:25
std::uint64_t numCells() const
Return the number of cells in (this partition of the) grid.
Definition: datacollectorinterface.hh:52
Implementation of DataCollector for lagrange cells.
Definition: lagrangedatacollector.hh:23
std::uint64_t numPointsImpl() const
Return number of lagrange nodes.
Definition: lagrangedatacollector.hh:62
void updateImpl()
Construct the point sets.
Definition: lagrangedatacollector.hh:42
Cells cellsImpl() const
Return cell types, offsets, and connectivity.
Definition: lagrangedatacollector.hh:119
LagrangeDataCollector(GridView const &gridView, int order=ORDER)
Definition: lagrangedatacollector.hh:33
std::vector< T > pointsImpl() const
Return a vector of point coordinates.
Definition: lagrangedatacollector.hh:73
std::vector< T > pointDataImpl(GlobalFunction const &fct) const
Evaluate the fct at element vertices and edge centers in the same order as the point coords.
Definition: lagrangedatacollector.hh:155
std::map< GeometryType, PointSet > pointSets_
Definition: lagrangedatacollector.hh:194
unsigned int order_
Definition: lagrangedatacollector.hh:190
std::uint64_t numPoints_
Definition: lagrangedatacollector.hh:191
std::uint64_t numCellsImpl() const
Return number of grid cells.
Definition: lagrangedatacollector.hh:109
Definition: unstructureddatacollector.hh:14
std::vector< std::int64_t > offsets
Definition: unstructureddatacollector.hh:16
std::vector< std::int64_t > connectivity
Definition: unstructureddatacollector.hh:17
std::vector< std::uint8_t > types
Definition: unstructureddatacollector.hh:15
Definition: unstructureddatacollector.hh:23
@ dim
Definition: datacollectorinterface.hh:28
static constexpr auto partition
The partitionset to collect data from.
Definition: datacollectorinterface.hh:23
Cells cells() const
Return cell types, offsets, and connectivity.
Definition: unstructureddatacollector.hh:36
GridView gridView_
Definition: datacollectorinterface.hh:133
Mapping of Dune geometry types to VTK cell types.
Definition: types.hh:160
@ LAGRANGE
Definition: types.hh:164
std::uint8_t type() const
Return VTK Cell type.
Definition: types.hh:203
A set of lagrange points compatible with the numbering of VTK and Gmsh.
Definition: lagrangepoints.hh:31