Go to the documentation of this file.
4 #ifndef DUNE_GRID_IO_FILE_VTK_SKELETONFUNCTION_HH
5 #define DUNE_GRID_IO_FILE_VTK_SKELETONFUNCTION_HH
11 #include <dune/common/fvector.hh>
34 template<
typename GV,
typename RF>
37 typedef typename GV::Intersection
Cell;
41 typedef FieldVector<DomainField, dimDomain>
Domain;
44 typedef std::vector<RangeField>
Range;
48 template <
typename GV,
typename RF>
78 template<
typename Func>
82 typedef typename Func::Traits::RangeField RF;
84 std::shared_ptr<const Func> func;
88 std::shared_ptr<DataArrayWriter> arraywriter;
92 const std::string&
name,
unsigned dimR_,
94 : func(func_), name_(
name), dimR(dimR_), precision_(prec)
98 const std::string&
name,
100 : func(func_), name_(
name), dimR(func->dimRange()), precision_(prec)
104 virtual std::string
name()
const {
return name_; }
107 virtual unsigned ncomps()
const {
return dimR; }
117 nitems, precision_));
118 return !arraywriter->writeIsNoop();
122 virtual void write(
const typename Func::Traits::Cell& cell,
123 const typename Func::Traits::Domain& xl) {
124 typename Func::Traits::Range result;
125 func->evaluate(cell, xl, result);
126 for(
unsigned d = 0; d < result.size() && d < dimR; ++d)
127 arraywriter->write(result[d]);
128 for(
unsigned d = result.size(); d < dimR; ++d)
129 arraywriter->write(0);
144 #endif // DUNE_GRID_IO_FILE_VTK_SKELETONFUNCTION_HH
std::vector< RangeField > Range
Definition: skeletonfunction.hh:44
A prototype for VTKFunctions on the skeleton.
Definition: skeletonfunction.hh:49
void addArray(const std::string &name, unsigned ncomps, Precision prec)
Add an array to the output file.
Definition: pvtuwriter.hh:205
GV::ctype DomainField
Definition: skeletonfunction.hh:39
virtual void write(const typename Func::Traits::Cell &cell, const typename Func::Traits::Domain &xl)
write at the given position
Definition: skeletonfunction.hh:122
Dump a .vtu/.vtp files contents to a stream.
Definition: vtuwriter.hh:96
Dump a .vtu/.vtp files contents to a stream.
Definition: pvtuwriter.hh:60
DataArrayWriter * makeArrayWriter(const std::string &name, unsigned ncomps, unsigned nitems, Precision prec)
acquire a DataArrayWriter
Definition: vtuwriter.hh:378
virtual void addArray(PVTUWriter &writer)
add this field to the given parallel writer
Definition: skeletonfunction.hh:110
GV GridView
Definition: skeletonfunction.hh:36
Base class for function writers.
Definition: functionwriter.hh:32
GV::Intersection Cell
Definition: skeletonfunction.hh:37
RF RangeField
Definition: skeletonfunction.hh:43
SkeletonFunctionTraits< GV, RF > Traits
Definition: skeletonfunction.hh:51
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
virtual unsigned ncomps() const
return number of components of the vector
Definition: skeletonfunction.hh:107
static const unsigned dimDomain
Definition: skeletonfunction.hh:40
FieldVector< DomainField, dimDomain > Domain
Definition: skeletonfunction.hh:41
virtual void endWrite()
signal end of writing
Definition: skeletonfunction.hh:133
Definition: skeletonfunction.hh:35
unsigned dimRange() const
get dimension of the Range
Precision
which precision to use when writing out data to vtk files
Definition: common.hh:319
SkeletonFunctionWriter(const std::shared_ptr< const Func > &func_, const std::string &name, VTK::Precision prec=VTK::Precision::float32)
Definition: skeletonfunction.hh:97
SkeletonFunctionWriter(const std::shared_ptr< const Func > &func_, const std::string &name, unsigned dimR_, VTK::Precision prec=VTK::Precision::float32)
Definition: skeletonfunction.hh:91
function writer for skeleton functions
Definition: skeletonfunction.hh:79
virtual std::string name() const
return name
Definition: skeletonfunction.hh:104
Include standard header files.
Definition: agrid.hh:58
virtual bool beginWrite(VTUWriter &writer, std::size_t nitems)
start writing with the given writer
Definition: skeletonfunction.hh:115