27 #ifndef VTK_SCALAR_FUNCTION_HH 28 #define VTK_SCALAR_FUNCTION_HH 30 #include <dune/common/fvector.hh> 31 #include <dune/common/version.hh> 32 #include <dune/grid/io/file/vtk/function.hh> 34 #include <dune/istl/bvector.hh> 40 #include <string_view> 48 template <
class Gr
idView,
class Mapper>
51 enum { dim = GridView::dimension };
52 using ctype =
typename GridView::ctype;
53 using Element =
typename GridView::template Codim<0>::Entity;
55 using ScalarBuffer = BaseOutputWriter::ScalarBuffer;
59 const GridView& gridView,
61 const ScalarBuffer& buf,
68 { assert(
int(buf_.size()) ==
int(mapper_.size())); }
70 std::string name()
const override 73 int ncomps()
const override 78 const Dune::FieldVector<ctype, dim>& xi)
const override 83 idx =
static_cast<unsigned>(mapper_.index(e));
85 else if (codim_ == dim) {
90 Dune::GeometryType gt = e.type();
91 int n =
static_cast<int>(e.subEntities(dim));
92 for (
int i = 0; i < n; ++i) {
93 Dune::FieldVector<ctype, dim> local =
94 Dune::ReferenceElements<ctype, dim>::general(gt).position(i, dim);
97 if (local.infinity_norm() < min) {
98 min = local.infinity_norm();
99 imin =
static_cast<int>(i);
104 idx =
static_cast<unsigned>(mapper_.subIndex(e, imin, codim_));
107 throw std::logic_error(
"Only element and vertex based vector fields are" 108 " supported so far.");
111 return static_cast<double>(
static_cast<float>(buf_[idx]));
115 const std::string name_;
116 const GridView gridView_;
117 const Mapper& mapper_;
118 const ScalarBuffer& buf_;
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Provides a vector-valued function using Dune::FieldVectors as elements.
Definition: vtkscalarfunction.hh:49
The base class for all output writers.