Dune Core Modules (2.3.1)

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
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 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::addCellData;
39 using Base::addPointData;
40
41 void addCellData(const VTKFunctionPtr& p) {
42 addCellData(shared_ptr<typename Base::FunctionWriter>
43 (new VTKFunctionWriter<VTKFunction>(p)));
44 }
45
46 void addCellData(VTKFunction* p) {
47 addCellData(VTKFunctionPtr(p));
48 }
49
50 template<typename V>
51 void addCellData(const V &v, const std::string &name, int ncomps=1) {
52 addCellData(new P0VTKFunction<GV, V>(gv, v, name, ncomps));
53 }
54
55 void addVertexData(const VTKFunctionPtr& p) {
56 addPointData(shared_ptr<typename Base::FunctionWriter>
57 (new VTKFunctionWriter<VTKFunction>(p)));
58 }
59
60 void addVertexData(VTKFunction* p) {
61 addVertexData(VTKFunctionPtr(p));
62 }
63
64 template<typename V>
65 void addVertexData(const V &v, const std::string &name, int ncomps=1) {
66 addVertexData(new P1VTKFunction<GV, V>(gv, v, name, ncomps));
67 }
68
69 };
70
71 } // namespace VTK
72
74
75} // namespace Dune
76
77#endif // DUNE_GRID_IO_FILE_VTK_VOLUMEWRITER_HH
Functions for VTK output.
Dune namespace.
Definition: alignment.hh:14
This file implements the class shared_ptr (a reference counting pointer), for those systems that don'...
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)