dune-grid 2.9.0
volumewriter.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5
6#ifndef DUNE_GRID_IO_FILE_VTK_VOLUMEWRITER_HH
7#define DUNE_GRID_IO_FILE_VTK_VOLUMEWRITER_HH
8
9#include <memory>
10
15
16namespace Dune {
19
20 namespace VTK {
21
22 template<typename GV>
25 public BasicWriter<ConformingVolumeIteratorFactory<GV> >
26 {
29
30 const GV& gv;
31
32 public:
34 typedef std::shared_ptr<VTKFunction> VTKFunctionPtr;
35
37 : Factory(gv_), Base(static_cast<const Factory&>(*this)), gv(gv_)
38 { }
39
41
42 void addCellData(const VTKFunctionPtr& p) {
43 Base::addCellData(std::shared_ptr<typename Base::FunctionWriter>
45 }
46
49 }
50
51 template<typename V>
52 void addCellData(const V &v, const std::string &name, int ncomps=1) {
53 addCellData(new P0VTKFunction<GV, V>(gv, v, name, ncomps));
54 }
55
57 addPointData(std::shared_ptr<typename Base::FunctionWriter>
59 }
60
63 }
64
65 template<typename V>
66 void addVertexData(const V &v, const std::string &name, int ncomps=1) {
67 addVertexData(new P1VTKFunction<GV, V>(gv, v, name, ncomps));
68 }
69
70 };
71
72 } // namespace VTK
73
75
76} // namespace Dune
77
78#endif // DUNE_GRID_IO_FILE_VTK_VOLUMEWRITER_HH
Functions for VTK output.
Include standard header files.
Definition: agrid.hh:60
Definition: basicwriter.hh:35
void addCellData(const std::shared_ptr< FunctionWriter > &writer)
Definition: basicwriter.hh:76
void addPointData(const std::shared_ptr< FunctionWriter > &writer)
Definition: basicwriter.hh:80
Take a vector and interpret it as cell data for the VTKWriter.
Definition: function.hh:97
Take a vector and interpret it as point data for the VTKWriter.
Definition: function.hh:205
Base class for function writers.
Definition: functionwriter.hh:90
Definition: volumeiterators.hh:23
Definition: volumewriter.hh:26
std::shared_ptr< VTKFunction > VTKFunctionPtr
Definition: volumewriter.hh:34
void addCellData(const VTKFunctionPtr &p)
Definition: volumewriter.hh:42
void addVertexData(const VTKFunctionPtr &p)
Definition: volumewriter.hh:56
void addCellData(VTKFunction *p)
Definition: volumewriter.hh:47
void addVertexData(const V &v, const std::string &name, int ncomps=1)
Definition: volumewriter.hh:66
void addVertexData(VTKFunction *p)
Definition: volumewriter.hh:61
void addCellData(const V &v, const std::string &name, int ncomps=1)
Definition: volumewriter.hh:52
ConformingVolumeWriter(const GV &gv_)
Definition: volumewriter.hh:36
Dune::VTKFunction< GV > VTKFunction
Definition: volumewriter.hh:33
void addPointData(const std::shared_ptr< FunctionWriter > &writer)
Definition: basicwriter.hh:80