dune-pdelab  2.4.1
vtk.hh
Go to the documentation of this file.
1 #ifndef DUNE_PDELAB_GRIDFUNCTIONSPACE_VTK_HH
2 #define DUNE_PDELAB_GRIDFUNCTIONSPACE_VTK_HH
3 
4 #include <vector>
5 #include <sstream>
6 
7 #include <dune/common/exceptions.hh>
8 
9 #include <dune/geometry/typeindex.hh>
10 
11 #include <dune/localfunctions/common/interfaceswitch.hh>
12 
13 #include <dune/typetree/visitor.hh>
14 #include <dune/typetree/traversal.hh>
15 
22 
23 namespace Dune {
24 
25  template<typename GV>
26  class VTKWriter;
27 
28  template<typename GV>
30 
31  template<typename GV>
33 
34  template<typename GV>
36 
37  namespace PDELab {
38 
39  namespace vtk {
40 
41  namespace {
42 
43  template<typename VTKWriter>
44  struct vtk_writer_traits;
45 
46  template<typename GV>
47  struct vtk_writer_traits<Dune::VTKWriter<GV> >
48  {
49  typedef GV GridView;
50  };
51 
52  template<typename GV>
53  struct vtk_writer_traits<Dune::SubsamplingVTKWriter<GV> >
54  {
55  typedef GV GridView;
56  };
57 
58  template<typename GV>
59  struct vtk_writer_traits<Dune::VTKSequenceWriter<GV> >
60  {
61  typedef GV GridView;
62  };
63 
64  template<typename GV>
65  struct vtk_writer_traits<Dune::SubsamplingVTKSequenceWriter<GV> >
66  {
67  typedef GV GridView;
68  };
69 
70  }
71 
72  template<typename LFS, typename Data>
74 
75  template<typename LFS, typename Data>
77 
78  template<typename VTKWriter, typename Data>
80 
81 
83  template<typename GFS, typename X, typename Pred>
85  {
86 
87  template<typename LFS, typename Data>
88  friend class DGFTreeLeafFunction;
89 
90  template<typename LFS, typename Data>
91  friend class DGFTreeVectorFunction;
92 
93  template<typename, typename>
94  friend struct OutputCollector;
95 
98  typedef typename X::template ConstLocalView<LFSCache> XView;
100  using EntitySet = typename GFS::Traits::EntitySet;
101  using Cell = typename EntitySet::Traits::Element;
102  using IndexSet = typename EntitySet::Traits::IndexSet;
103  typedef typename GFS::Traits::SizeType size_type;
104 
105  static const decltype(EntitySet::dimension) dim = EntitySet::dimension;
106 
107  public:
108 
109  typedef GFS GridFunctionSpace;
110  typedef X Vector;
111  typedef Pred Predicate;
112 
113  DGFTreeCommonData(const GFS& gfs, const X& x)
114  : _lfs(gfs)
115  , _lfs_cache(_lfs)
116  , _x_view(x)
117  , _x_local(_lfs.maxSize())
118  , _index_set(gfs.entitySet().indexSet())
119  , _current_cell_index(std::numeric_limits<size_type>::max())
120  {}
121 
122  public:
123 
124  void bind(const Cell& cell)
125  {
126  auto cell_index = _index_set.uniqueIndex(cell);
127  if (_current_cell_index == cell_index)
128  return;
129 
130  _lfs.bind(cell);
131  _lfs_cache.update();
132  _x_view.bind(_lfs_cache);
133  _x_view.read(_x_local);
134  _x_view.unbind();
135  _current_cell_index = cell_index;
136  }
137 
138  LFS _lfs;
139  LFSCache _lfs_cache;
140  XView _x_view;
141  XLocalVector _x_local;
142  const IndexSet& _index_set;
144 
145  };
146 
147 
148 
149  template<typename LFS, typename Data>
150  class DGFTreeLeafFunction
151  : public TypeTree::LeafNode
152  , public GridFunctionInterface<GridFunctionTraits<
153  typename LFS::Traits::GridView,
154  typename BasisInterfaceSwitch<
155  typename FiniteElementInterfaceSwitch<
156  typename LFS::Traits::FiniteElement
157  >::Basis
158  >::RangeField,
159  BasisInterfaceSwitch<
160  typename FiniteElementInterfaceSwitch<
161  typename LFS::Traits::FiniteElement
162  >::Basis
163  >::dimRange,
164  typename BasisInterfaceSwitch<
165  typename FiniteElementInterfaceSwitch<
166  typename LFS::Traits::FiniteElement
167  >::Basis
168  >::Range
169  >,
170  DGFTreeLeafFunction<LFS,Data>
171  >
172  {
173 
174  typedef BasisInterfaceSwitch<
175  typename FiniteElementInterfaceSwitch<
176  typename LFS::Traits::FiniteElement
177  >::Basis
178  > BasisSwitch;
179 
180  typedef GridFunctionInterface<
182  typename LFS::Traits::GridView,
183  typename BasisSwitch::RangeField,
184  BasisSwitch::dimRange,
185  typename BasisSwitch::Range
186  >,
188  > BaseT;
189 
190  public:
191  typedef typename BaseT::Traits Traits;
192 
193  DGFTreeLeafFunction (const LFS& lfs, const shared_ptr<Data>& data)
194  : BaseT(lfs.gridFunctionSpace().dataSetType())
195  , _lfs(lfs)
196  , _data(data)
197  , _basis(lfs.maxSize())
198  {}
199 
200  // Evaluate
201  void evaluate (const typename Traits::ElementType& e,
202  const typename Traits::DomainType& x,
203  typename Traits::RangeType& y) const
204  {
205  _data->bind(e);
206 
207  typedef FiniteElementInterfaceSwitch<
208  typename LFS::Traits::FiniteElement
209  > FESwitch;
210 
211  y = 0;
212 
213  FESwitch::basis(_lfs.finiteElement()).evaluateFunction(x,_basis);
214  for (std::size_t i = 0; i < _lfs.size(); ++i)
215  y.axpy(_data->_x_local(_lfs,i),_basis[i]);
216  }
217 
219  const typename Traits::GridViewType& gridView() const
220  {
221  return _lfs.gridFunctionSpace().gridView();
222  }
223 
224  const LFS& localFunctionSpace() const
225  {
226  return _lfs;
227  }
228 
229  private:
230 
231  const LFS& _lfs;
232  const shared_ptr<Data> _data;
233  mutable std::vector<typename Traits::RangeType> _basis;
234 
235  };
236 
237 
238 
239  template<typename LFS, typename Data>
241  : public TypeTree::LeafNode
242  , public GridFunctionInterface<GridFunctionTraits<
243  typename LFS::Traits::GridView,
244  typename BasisInterfaceSwitch<
245  typename FiniteElementInterfaceSwitch<
246  typename LFS::ChildType::Traits::FiniteElement
247  >::Basis
248  >::RangeField,
249  LFS::CHILDREN,
250  Dune::FieldVector<
251  typename BasisInterfaceSwitch<
252  typename FiniteElementInterfaceSwitch<
253  typename LFS::ChildType::Traits::FiniteElement
254  >::Basis
255  >::RangeField,
256  LFS::CHILDREN
257  >
258  >,
259  DGFTreeVectorFunction<LFS,Data>
260  >
261  {
262 
263  typedef BasisInterfaceSwitch<
264  typename FiniteElementInterfaceSwitch<
265  typename LFS::ChildType::Traits::FiniteElement
266  >::Basis
267  > BasisSwitch;
268 
269  static_assert(BasisSwitch::dimRange == 1,
270  "Automatic conversion to vector-valued function only supported for scalar components");
271 
272  typedef GridFunctionInterface<
274  typename LFS::Traits::GridView,
275  typename BasisSwitch::RangeField,
276  LFS::CHILDREN,
277  Dune::FieldVector<
278  typename BasisSwitch::RangeField,
279  LFS::CHILDREN
280  >
281  >,
283  > BaseT;
284 
285  public:
286 
287  typedef typename BaseT::Traits Traits;
288  typedef typename LFS::ChildType ChildLFS;
289  typedef typename ChildLFS::Traits::FiniteElement::Traits::LocalBasisType::Traits::RangeFieldType RF;
290  typedef typename ChildLFS::Traits::FiniteElement::Traits::LocalBasisType::Traits::RangeType RT;
291 
292  DGFTreeVectorFunction (const LFS& lfs, const shared_ptr<Data>& data)
293  : BaseT(lfs.gridFunctionSpace().dataSetType())
294  , _lfs(lfs)
295  , _data(data)
296  , _basis(lfs.maxSize())
297  {}
298 
299  void evaluate (const typename Traits::ElementType& e,
300  const typename Traits::DomainType& x,
301  typename Traits::RangeType& y) const
302  {
303  _data->bind(e);
304 
305  typedef FiniteElementInterfaceSwitch<
306  typename ChildLFS::Traits::FiniteElement
307  > FESwitch;
308 
309  y = 0;
310 
311  for (std::size_t k = 0; k < LFS::CHILDREN; ++k)
312  {
313  const ChildLFS& child_lfs = _lfs.child(k);
314  FESwitch::basis(child_lfs.finiteElement()).evaluateFunction(x,_basis);
315 
316  for (std::size_t i = 0; i < child_lfs.size(); ++i)
317  y[k] += _data->_x_local(child_lfs,i) * _basis[i];
318  }
319  }
320 
322  const typename Traits::GridViewType& gridView() const
323  {
324  return _lfs.gridFunctionSpace().gridView();
325  }
326 
327  const LFS& localFunctionSpace() const
328  {
329  return _lfs;
330  }
331 
332  private:
333 
334  const LFS& _lfs;
335  const shared_ptr<Data> _data;
336  mutable std::vector<typename BasisSwitch::Range> _basis;
337 
338  };
339 
340 
342  {
343 
344  public:
345 
346  template<typename TreePath>
347  std::string operator()(std::string component_name, TreePath tp) const
348  {
349  if (component_name.empty())
350  {
351 
352  if (_prefix.empty() && _suffix.empty())
353  {
354  DUNE_THROW(IOError,
355  "You need to either name all GridFunctionSpaces "
356  "written to the VTK file or provide a prefix / suffix.");
357  }
358 
359  std::stringstream name_stream;
360 
361  if (!_prefix.empty())
362  name_stream << _prefix << _separator;
363 
364  // Build a simple name based on the component's TreePath (e.g. 0_2_3)
365  for (std::size_t i = 0; i < tp.size(); ++i)
366  name_stream << (i > 0 ? _separator : "") << tp.element(i);
367 
368  if (!_suffix.empty())
369  name_stream << _separator << _suffix;
370  return name_stream.str();
371  }
372  else
373  {
374  // construct name from prefix, component name and suffix
375  return _prefix + component_name + _suffix;
376  }
377  }
378 
380  {
381  _prefix = prefix;
382  return *this;
383  }
384 
386  {
387  _suffix = suffix;
388  return *this;
389  }
390 
391  DefaultFunctionNameGenerator& separator(std::string separator)
392  {
393  _separator = separator;
394  return *this;
395  }
396 
397  DefaultFunctionNameGenerator(std::string prefix = "",
398  std::string suffix = "",
399  std::string separator = "_")
400  : _prefix(prefix)
401  , _suffix(suffix)
402  , _separator(separator)
403  {}
404 
405  private:
406 
407  std::string _prefix;
408  std::string _suffix;
409  std::string _separator;
410 
411  };
412 
414  {
416  }
417 
418 
419  template<typename VTKWriter, typename Data, typename NameGenerator>
421  : public TypeTree::DefaultVisitor
422  , public TypeTree::DynamicTraversal
423  {
424 
425 
426  template<typename LFS, typename Child, typename TreePath>
427  struct VisitChild
428  {
429 
430  static const bool value =
431  // Do not descend into children of VectorGridFunctionSpace
432  !std::is_convertible<
433  typename LFS::Traits::GridFunctionSpace::ImplementationTag,
435  >::value;
436 
437  };
438 
441  template<typename DGF, typename TreePath>
442  void add_to_vtk_writer(const shared_ptr<DGF>& dgf, TreePath tp)
443  {
444  std::string name = name_generator(dgf->localFunctionSpace().gridFunctionSpace().name(),tp);
445  switch (dgf->dataSetType())
446  {
447  case DGF::Output::vertexData:
448  vtk_writer.addVertexData(std::make_shared<VTKGridFunctionAdapter<DGF> >(dgf,name.c_str()));
449  break;
450  case DGF::Output::cellData:
451  vtk_writer.addCellData(std::make_shared<VTKGridFunctionAdapter<DGF> >(dgf,name.c_str()));
452  break;
453  default:
454  DUNE_THROW(NotImplemented,"Unsupported data set type");
455  }
456  }
457 
459 
462  template<typename LFS, typename TreePath>
463  void add_vector_solution(const LFS& lfs, TreePath tp, VectorGridFunctionSpaceTag tag)
464  {
465  add_to_vtk_writer(std::make_shared<DGFTreeVectorFunction<LFS,Data> >(lfs,data),tp);
466  }
467 
469 
472  template<typename LFS, typename TreePath>
473  void add_vector_solution(const LFS& lfs, TreePath tp, GridFunctionSpaceTag tag)
474  {
475  // do nothing here - not a vector space
476  }
477 
478  // **********************************************************************
479  // Visitor functions for adding DiscreteGridFunctions to VTKWriter
480  //
481  // The visitor functions contain a switch that will make them ignore
482  // function spaces with a different underlying GridView type than
483  // the VTKWriter.
484  // This cannot happen in vanilla PDELab, but is required for MultiDomain
485  // support
486  // **********************************************************************
487 
488  // don't do anything if GridView types differ
489  template<typename LFS, typename TreePath>
490  typename enable_if<
491  !is_same<
492  typename LFS::Traits::GridFunctionSpace::Traits::GridView,
493  typename vtk_writer_traits<VTKWriter>::GridView
494  >::value
495  >::type
496  post(const LFS& lfs, TreePath tp)
497  {
498  }
499 
500  // don't do anything if GridView types differ
501  template<typename LFS, typename TreePath>
502  typename enable_if<
503  !is_same<
504  typename LFS::Traits::GridFunctionSpace::Traits::GridView,
505  typename vtk_writer_traits<VTKWriter>::GridView
506  >::value
507  >::type
508  leaf(const LFS& lfs, TreePath tp)
509  {
510  }
511 
513  template<typename LFS, typename TreePath>
514  typename enable_if<
515  is_same<
516  typename LFS::Traits::GridFunctionSpace::Traits::GridView,
517  typename vtk_writer_traits<VTKWriter>::GridView
518  >::value
519  >::type
520  post(const LFS& lfs, TreePath tp)
521  {
522  if (predicate(lfs))
523  add_vector_solution(lfs,tp,typename LFS::Traits::GridFunctionSpace::ImplementationTag());
524  }
525 
527  template<typename LFS, typename TreePath>
528  typename enable_if<
529  is_same<
530  typename LFS::Traits::GridFunctionSpace::Traits::GridView,
531  typename vtk_writer_traits<VTKWriter>::GridView
532  >::value
533  >::type
534  leaf(const LFS& lfs, TreePath tp)
535  {
536  if (predicate(lfs))
537  add_to_vtk_writer(std::make_shared<DGFTreeLeafFunction<LFS,Data> >(lfs,data),tp);
538  }
539 
540 
541  add_solution_to_vtk_writer_visitor(VTKWriter& vtk_writer_, shared_ptr<Data> data_, const NameGenerator& name_generator_, const typename Data::Predicate& predicate_)
542  : vtk_writer(vtk_writer_)
543  , data(data_)
544  , name_generator(name_generator_)
545  , predicate(predicate_)
546  {}
547 
549  shared_ptr<Data> data;
550  const NameGenerator& name_generator;
551  typename Data::Predicate predicate;
552 
553  };
554 
556  {
557  template<typename T>
558  bool operator()(const T& t) const
559  {
560  return true;
561  }
562  };
563 
564  template<typename VTKWriter, typename Data_>
565  struct OutputCollector
566  {
567 
569  typedef Data_ Data;
570 
571  typedef typename Data::GridFunctionSpace GFS;
572  typedef typename Data::Vector Vector;
573  typedef typename Data::Predicate Predicate;
574 
575  template<typename NameGenerator>
576  OutputCollector& addSolution(const NameGenerator& name_generator)
577  {
578 
579  add_solution_to_vtk_writer_visitor<VTKWriter,Data,NameGenerator> visitor(_vtk_writer,_data,name_generator,_predicate);
580  TypeTree::applyToTree(_data->_lfs,visitor);
581  return *this;
582  }
583 
584  template<typename Factory, typename TreePath>
585  OutputCollector& addCellFunction(Factory factory, TreePath tp, std::string name)
586  {
587  typedef typename std::remove_reference<decltype(*factory.create(_data->_lfs.child(tp),_data))>::type DGF;
588  _vtk_writer.addCellData(std::make_shared<VTKGridFunctionAdapter<DGF> >(factory.create(_data->_lfs.child(tp),_data),name));
589  return *this;
590  }
591 
592  template<template<typename...> class Function, typename TreePath, typename... Params>
593  OutputCollector& addCellFunction(TreePath tp, std::string name, Params&&... params)
594  {
595  using LFS = TypeTree::ChildForTreePath<typename Data::LFS,TreePath>;
596  typedef Function<LFS,Data,Params...> DGF;
597  _vtk_writer.addCellData(
598  std::make_shared<VTKGridFunctionAdapter<DGF> >(
599  std::make_shared<DGF>(
600  TypeTree::child(_data->_lfs,tp)
601  ),
602  _data,
603  std::forward<Params>(params)...
604  ),
605  name
606  );
607  return *this;
608  }
609 
610  template<typename Factory, typename TreePath>
611  OutputCollector& addVertexFunction(Factory factory, TreePath tp, std::string name)
612  {
613  typedef typename std::remove_reference<decltype(*factory.create(_data->_lfs.child(tp),_data))>::type DGF;
614  _vtk_writer.addVertexData(std::make_shared<VTKGridFunctionAdapter<DGF> >(factory.create(_data->_lfs.child(tp),_data),name));
615  return *this;
616  }
617 
618  template<template<typename...> class Function, typename TreePath, typename... Params>
619  OutputCollector& addVertexFunction(TreePath tp, std::string name, Params&&... params)
620  {
621  using LFS = TypeTree::ChildForTreePath<typename Data::LFS,TreePath>;
622  typedef Function<LFS,Data,Params...> DGF;
623  _vtk_writer.addVertexData(
624  std::make_shared<VTKGridFunctionAdapter<DGF> >(
625  std::make_shared<DGF>(
626  TypeTree::child(_data->_lfs,tp)
627  ),
628  _data,
629  std::forward<Params>(params)...
630  ),
631  name
632  );
633  return *this;
634  }
635 
636  OutputCollector(VTKWriter& vtk_writer, const shared_ptr<Data>& data, const Predicate& predicate = Predicate())
637  : _vtk_writer(vtk_writer)
638  , _data(data)
639  , _predicate(predicate)
640  {}
641 
643  shared_ptr<Data> _data;
644  Predicate _predicate;
645 
646  };
647 
648  } // namespace vtk
649 
650  template<typename VTKWriter,
651  typename GFS,
652  typename X,
653  typename NameGenerator = vtk::DefaultFunctionNameGenerator,
654  typename Predicate = vtk::DefaultPredicate>
656  VTKWriter,
658  >
659  addSolutionToVTKWriter(VTKWriter& vtk_writer,
660  const GFS& gfs,
661  const X& x,
662  const NameGenerator& name_generator = vtk::defaultNameScheme(),
663  const Predicate& predicate = Predicate())
664  {
666  vtk::OutputCollector<VTKWriter,Data> collector(vtk_writer,std::make_shared<Data>(gfs,x),predicate);
667  collector.addSolution(name_generator);
668  return collector;
669  }
670 
671 
672  } // namespace PDELab
673 } // namespace Dune
674 
675 #endif // DUNE_PDELAB_GRIDFUNCTIONSPACE_VTK_HH
BaseT::Traits Traits
Definition: vtk.hh:191
XLocalVector _x_local
Definition: vtk.hh:141
STL namespace.
Data::GridFunctionSpace GFS
Definition: vtk.hh:571
Definition: vtk.hh:29
OutputCollector & addVertexFunction(Factory factory, TreePath tp, std::string name)
Definition: vtk.hh:611
VTKWriter & _vtk_writer
Definition: vtk.hh:642
bool operator()(const T &t) const
Definition: vtk.hh:558
X Vector
Definition: vtk.hh:110
static const unsigned int value
Definition: gridfunctionspace/tags.hh:177
DefaultFunctionNameGenerator & prefix(std::string prefix)
Definition: vtk.hh:379
ChildLFS::Traits::FiniteElement::Traits::LocalBasisType::Traits::RangeType RT
Definition: vtk.hh:290
std::string operator()(std::string component_name, TreePath tp) const
Definition: vtk.hh:347
OutputCollector(VTKWriter &vtk_writer, const shared_ptr< Data > &data, const Predicate &predicate=Predicate())
Definition: vtk.hh:636
LFS::ChildType ChildLFS
Definition: vtk.hh:288
DefaultFunctionNameGenerator(std::string prefix="", std::string suffix="", std::string separator="_")
Definition: vtk.hh:397
OutputCollector & addCellFunction(TreePath tp, std::string name, Params &&...params)
Definition: vtk.hh:593
BaseT::Traits Traits
Definition: vtk.hh:287
Data::Vector Vector
Definition: vtk.hh:572
static const int dim
Definition: adaptivity.hh:83
Definition: vtk.hh:26
shared_ptr< Data > _data
Definition: vtk.hh:643
Definition: adaptivity.hh:27
Data::Predicate predicate
Definition: vtk.hh:551
void add_to_vtk_writer(const shared_ptr< DGF > &dgf, TreePath tp)
Definition: vtk.hh:442
OutputCollector & addSolution(const NameGenerator &name_generator)
Definition: vtk.hh:576
XView _x_view
Definition: vtk.hh:140
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: vtk.hh:299
Definition: gridfunctionspace/tags.hh:28
enable_if< !is_same< typename LFS::Traits::GridFunctionSpace::Traits::GridView, typename vtk_writer_traits< VTKWriter >::GridView >::value >::type leaf(const LFS &lfs, TreePath tp)
Definition: vtk.hh:508
DefaultFunctionNameGenerator & suffix(std::string suffix)
Definition: vtk.hh:385
OutputCollector & addCellFunction(Factory factory, TreePath tp, std::string name)
Definition: vtk.hh:585
DGFTreeVectorFunction(const LFS &lfs, const shared_ptr< Data > &data)
Definition: vtk.hh:292
const Entity & e
Definition: localfunctionspace.hh:111
DefaultFunctionNameGenerator defaultNameScheme()
Definition: vtk.hh:413
add_solution_to_vtk_writer_visitor(VTKWriter &vtk_writer_, shared_ptr< Data > data_, const NameGenerator &name_generator_, const typename Data::Predicate &predicate_)
Definition: vtk.hh:541
const Traits::GridViewType & gridView() const
get a reference to the GridView
Definition: vtk.hh:322
GFS GridFunctionSpace
Definition: vtk.hh:109
ChildLFS::Traits::FiniteElement::Traits::LocalBasisType::Traits::RangeFieldType RF
Definition: vtk.hh:289
const NameGenerator & name_generator
Definition: vtk.hh:550
const LFS & localFunctionSpace() const
Definition: vtk.hh:224
T Traits
Export type traits.
Definition: function.hh:191
Predicate _predicate
Definition: vtk.hh:644
Data::Predicate Predicate
Definition: vtk.hh:573
Definition: vtk.hh:32
void bind(const Cell &cell)
Definition: vtk.hh:124
void add_vector_solution(const LFS &lfs, TreePath tp, GridFunctionSpaceTag tag)
Tag dispatch-based switch that creates a vector-valued function for a VectorGridFunctionSpace.
Definition: vtk.hh:473
OutputCollector & addVertexFunction(TreePath tp, std::string name, Params &&...params)
Definition: vtk.hh:619
enable_if< !is_same< typename LFS::Traits::GridFunctionSpace::Traits::GridView, typename vtk_writer_traits< VTKWriter >::GridView >::value >::type post(const LFS &lfs, TreePath tp)
Definition: vtk.hh:496
Definition: gridfunctionspace/tags.hh:24
const Traits::GridViewType & gridView() const
get a reference to the GridView
Definition: vtk.hh:219
typename impl::BackendVectorSelector< GridFunctionSpace, FieldType >::Type Vector
alias of the return type of BackendVectorSelector
Definition: backend/interface.hh:113
const IndexSet & _index_set
Definition: vtk.hh:142
enable_if< is_same< typename LFS::Traits::GridFunctionSpace::Traits::GridView, typename vtk_writer_traits< VTKWriter >::GridView >::value >::type post(const LFS &lfs, TreePath tp)
Handle VectorGridFunctionSpace components in here.
Definition: vtk.hh:520
DefaultFunctionNameGenerator & separator(std::string separator)
Definition: vtk.hh:391
VTKWriter & vtk_writer
Definition: vtk.hh:548
Pred Predicate
Definition: vtk.hh:111
Data_ Data
Common data container (hierarchic LFS, global solution data etc.)
Definition: vtk.hh:569
void add_vector_solution(const LFS &lfs, TreePath tp, VectorGridFunctionSpaceTag tag)
Tag dispatch-based switch that creates a vector-valued function for a VectorGridFunctionSpace.
Definition: vtk.hh:463
wrap a GridFunction so it can be used with the VTKWriter from dune-grid.
Definition: vtkexport.hh:22
enable_if< is_same< typename LFS::Traits::GridFunctionSpace::Traits::GridView, typename vtk_writer_traits< VTKWriter >::GridView >::value >::type leaf(const LFS &lfs, TreePath tp)
Create a standard leaf function for leaf GridFunctionSpaces.
Definition: vtk.hh:534
vtk::OutputCollector< VTKWriter, vtk::DGFTreeCommonData< GFS, X, Predicate > > addSolutionToVTKWriter(VTKWriter &vtk_writer, const GFS &gfs, const X &x, const NameGenerator &name_generator=vtk::defaultNameScheme(), const Predicate &predicate=Predicate())
Definition: vtk.hh:659
size_type _current_cell_index
Definition: vtk.hh:143
void evaluate(const typename Traits::ElementType &e, const typename Traits::DomainType &x, typename Traits::RangeType &y) const
Definition: vtk.hh:201
Helper class for common data of a DGFTree.
Definition: vtk.hh:84
DGFTreeLeafFunction(const LFS &lfs, const shared_ptr< Data > &data)
Definition: vtk.hh:193
LFS _lfs
Definition: vtk.hh:138
a GridFunction maps x in DomainType to y in RangeType
Definition: function.hh:186
shared_ptr< Data > data
Definition: vtk.hh:549
const LFS & localFunctionSpace() const
Definition: vtk.hh:327
LFSCache _lfs_cache
Definition: vtk.hh:139
traits class holding the function signature, same as in local function
Definition: function.hh:175