6#ifndef DUNE_GRID_IO_FILE_VTK_SKELETONFUNCTION_HH
7#define DUNE_GRID_IO_FILE_VTK_SKELETONFUNCTION_HH
13#include <dune/common/fvector.hh>
36 template<
typename GV,
typename RF>
39 typedef typename GV::Intersection
Cell;
43 typedef FieldVector<DomainField, dimDomain>
Domain;
46 typedef std::vector<RangeField>
Range;
50 template <
typename GV,
typename RF>
80 template<
typename Func>
84 typedef typename Func::Traits::RangeField RF;
86 std::shared_ptr<const Func> func;
90 std::shared_ptr<DataArrayWriter> arraywriter;
94 const std::string&
name,
unsigned dimR_,
96 : func(func_), name_(
name), dimR(dimR_), precision_(prec)
100 const std::string&
name,
102 : func(func_), name_(
name), dimR(func->dimRange()), precision_(prec)
106 virtual std::string
name()
const {
return name_; }
109 virtual unsigned ncomps()
const {
return dimR; }
119 nitems, precision_));
120 return !arraywriter->writeIsNoop();
124 virtual void write(
const typename Func::Traits::Cell& cell,
125 const typename Func::Traits::Domain& xl) {
126 typename Func::Traits::Range result;
127 func->evaluate(cell, xl, result);
128 for(
unsigned d = 0; d < result.size() && d < dimR; ++d)
129 arraywriter->write(result[d]);
130 for(
unsigned d = result.size(); d < dimR; ++d)
131 arraywriter->write(0);
Include standard header files.
Definition: agrid.hh:60
Precision
which precision to use when writing out data to vtk files
Definition: common.hh:271
Base class for function writers.
Definition: functionwriter.hh:34
Dump a .vtu/.vtp files contents to a stream.
Definition: pvtuwriter.hh:62
void addArray(const std::string &name, unsigned ncomps, Precision prec)
Add an array to the output file.
Definition: pvtuwriter.hh:207
Definition: skeletonfunction.hh:37
RF RangeField
Definition: skeletonfunction.hh:45
FieldVector< DomainField, dimDomain > Domain
Definition: skeletonfunction.hh:43
GV GridView
Definition: skeletonfunction.hh:38
std::vector< RangeField > Range
Definition: skeletonfunction.hh:46
GV::Intersection Cell
Definition: skeletonfunction.hh:39
GV::ctype DomainField
Definition: skeletonfunction.hh:41
static const unsigned dimDomain
Definition: skeletonfunction.hh:42
A prototype for VTKFunctions on the skeleton.
Definition: skeletonfunction.hh:51
unsigned dimRange() const
get dimension of the Range
SkeletonFunctionTraits< GV, RF > Traits
Definition: skeletonfunction.hh:53
void evaluate(const typename Traits::Cell &c, const typename Traits::Domain &xl, typename Traits::Range &result) const
evaluate at local point xl in Cell c, store in result
function writer for skeleton functions
Definition: skeletonfunction.hh:83
virtual std::string name() const
return name
Definition: skeletonfunction.hh:106
SkeletonFunctionWriter(const std::shared_ptr< const Func > &func_, const std::string &name, VTK::Precision prec=VTK::Precision::float32)
Definition: skeletonfunction.hh:99
virtual void addArray(PVTUWriter &writer)
add this field to the given parallel writer
Definition: skeletonfunction.hh:112
virtual void write(const typename Func::Traits::Cell &cell, const typename Func::Traits::Domain &xl)
write at the given position
Definition: skeletonfunction.hh:124
virtual bool beginWrite(VTUWriter &writer, std::size_t nitems)
start writing with the given writer
Definition: skeletonfunction.hh:117
SkeletonFunctionWriter(const std::shared_ptr< const Func > &func_, const std::string &name, unsigned dimR_, VTK::Precision prec=VTK::Precision::float32)
Definition: skeletonfunction.hh:93
virtual void endWrite()
signal end of writing
Definition: skeletonfunction.hh:135
virtual unsigned ncomps() const
return number of components of the vector
Definition: skeletonfunction.hh:109
Dump a .vtu/.vtp files contents to a stream.
Definition: vtuwriter.hh:98
DataArrayWriter * makeArrayWriter(const std::string &name, unsigned ncomps, unsigned nitems, Precision prec)
acquire a DataArrayWriter
Definition: vtuwriter.hh:380