Dune Core Modules (2.8.0)

volumewriter.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4#ifndef DUNE_GRID_IO_FILE_VTK_VOLUMEWRITER_HH
5#define DUNE_GRID_IO_FILE_VTK_VOLUMEWRITER_HH
6
7#include <memory>
8
9#include <dune/grid/io/file/vtk/basicwriter.hh>
11#include <dune/grid/io/file/vtk/functionwriter.hh>
12#include <dune/grid/io/file/vtk/volumeiterators.hh>
13
14namespace Dune {
17
18 namespace VTK {
19
20 template<typename GV>
21 class ConformingVolumeWriter
22 : public ConformingVolumeIteratorFactory<GV>,
23 public BasicWriter<ConformingVolumeIteratorFactory<GV> >
24 {
25 typedef ConformingVolumeIteratorFactory<GV> Factory;
26 typedef BasicWriter<Factory> Base;
27
28 const GV& gv;
29
30 public:
31 typedef Dune::VTKFunction< GV > VTKFunction;
32 typedef std::shared_ptr<VTKFunction> VTKFunctionPtr;
33
34 ConformingVolumeWriter(const GV& gv_)
35 : Factory(gv_), Base(static_cast<const Factory&>(*this)), gv(gv_)
36 { }
37
38 using Base::addPointData;
39
40 void addCellData(const VTKFunctionPtr& p) {
41 Base::addCellData(std::shared_ptr<typename Base::FunctionWriter>
42 (new VTKFunctionWriter<VTKFunction>(p)));
43 }
44
45 void addCellData(VTKFunction* p) {
46 addCellData(VTKFunctionPtr(p));
47 }
48
49 template<typename V>
50 void addCellData(const V &v, const std::string &name, int ncomps=1) {
51 addCellData(new P0VTKFunction<GV, V>(gv, v, name, ncomps));
52 }
53
54 void addVertexData(const VTKFunctionPtr& p) {
55 addPointData(std::shared_ptr<typename Base::FunctionWriter>
56 (new VTKFunctionWriter<VTKFunction>(p)));
57 }
58
59 void addVertexData(VTKFunction* p) {
60 addVertexData(VTKFunctionPtr(p));
61 }
62
63 template<typename V>
64 void addVertexData(const V &v, const std::string &name, int ncomps=1) {
65 addVertexData(new P1VTKFunction<GV, V>(gv, v, name, ncomps));
66 }
67
68 };
69
70 } // namespace VTK
71
73
74} // namespace Dune
75
76#endif // DUNE_GRID_IO_FILE_VTK_VOLUMEWRITER_HH
Functions for VTK output.
Dune namespace.
Definition: alignedallocator.hh:11
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 22, 23:33, 2024)