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>
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);
146 #endif // DUNE_GRID_IO_FILE_VTK_SKELETONFUNCTION_HH function writer for skeleton functions
Definition: skeletonfunction.hh:81
Dump a .vtu/.vtp files contents to a stream.
Definition: pvtuwriter.hh:62
virtual unsigned ncomps() const
return number of components of the vector
Definition: skeletonfunction.hh:109
unsigned dimRange() const
get dimension of the Range
A prototype for VTKFunctions on the skeleton.
Definition: skeletonfunction.hh:51
virtual void endWrite()
signal end of writing
Definition: skeletonfunction.hh:135
SkeletonFunctionWriter(const std::shared_ptr< const Func > &func_, const std::string &name, VTK::Precision prec=VTK::Precision::float32)
Definition: skeletonfunction.hh:99
GV::ctype DomainField
Definition: skeletonfunction.hh:41
std::vector< RangeField > Range
Definition: skeletonfunction.hh:46
concept Intersection
Model of an intersection.
Definition: concepts/intersection.hh:23
void addArray(const std::string &name, unsigned ncomps, Precision prec)
Add an array to the output file.
Definition: pvtuwriter.hh:207
FieldVector< DomainField, dimDomain > Domain
Definition: skeletonfunction.hh:43
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 std::string name() const
return name
Definition: skeletonfunction.hh:106
virtual bool beginWrite(VTUWriter &writer, std::size_t nitems)
start writing with the given writer
Definition: skeletonfunction.hh:117
GV::Intersection Cell
Definition: skeletonfunction.hh:39
GV GridView
Definition: skeletonfunction.hh:38
Include standard header files.
Definition: agrid.hh:59
RF RangeField
Definition: skeletonfunction.hh:45
virtual void write(const typename Func::Traits::Cell &cell, const typename Func::Traits::Domain &xl)
write at the given position
Definition: skeletonfunction.hh:124
SkeletonFunctionTraits< GV, RF > Traits
Definition: skeletonfunction.hh:53
virtual void addArray(PVTUWriter &writer)
add this field to the given parallel writer
Definition: skeletonfunction.hh:112
DataArrayWriter * makeArrayWriter(const std::string &name, unsigned ncomps, unsigned nitems, Precision prec)
acquire a DataArrayWriter
Definition: vtuwriter.hh:381
static const unsigned dimDomain
Definition: skeletonfunction.hh:42
Dump a .vtu/.vtp files contents to a stream.
Definition: vtuwriter.hh:98
Definition: skeletonfunction.hh:37
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
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