DUNE PDELab (git)

volumeiterators.hh
1// SPDX-FileCopyrightText: Copyright © 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_VOLUMEITERATORS_HH
7#define DUNE_GRID_IO_FILE_VTK_VOLUMEITERATORS_HH
8
9#include <dune/grid/common/gridenums.hh>
10
11#include <dune/grid/io/file/vtk/corner.hh>
12#include <dune/grid/io/file/vtk/corneriterator.hh>
13#include <dune/grid/io/file/vtk/functionwriter.hh>
14#include <dune/grid/io/file/vtk/pointiterator.hh>
15
16namespace Dune {
19
20 namespace VTK {
21
22 template<typename GV>
23 class ConformingVolumeIteratorFactory {
24 const GV& gv;
25
26 typedef typename GV::IndexSet IndexSet;
27 const IndexSet& indexSet() const { return gv.indexSet(); }
28 friend class ConformingConnectivityWriter<
29 ConformingVolumeIteratorFactory<GV> >;
30
31 public:
32 static const unsigned dimCell = GV::dimension;
33
34 typedef typename GV::template Codim<0>::Entity Cell;
35 typedef typename GV::template Codim<0>::
36 template Partition<InteriorBorder_Partition>::Iterator CellIterator;
37
38 typedef VTK::Corner<Cell> Corner;
39 typedef VTK::CornerIterator<CellIterator> CornerIterator;
40
41 typedef VTK::Corner<Cell> Point;
42 typedef VTK::PointIterator<CellIterator,
43 typename GV::IndexSet> PointIterator;
44
45 typedef ConformingConnectivityWriter<ConformingVolumeIteratorFactory<GV>
46 > ConnectivityWriter;
47 typedef typename GV::Communication Communication;
48
49 explicit ConformingVolumeIteratorFactory(const GV& gv_)
50 : gv(gv_)
51 { }
52
53 CellIterator beginCells() const {
54 return gv.template begin<0, InteriorBorder_Partition>();
55 }
56 CellIterator endCells() const {
57 return gv.template end<0, InteriorBorder_Partition>();
58 }
59
60 CornerIterator beginCorners() const {
61 return CornerIterator(beginCells(), endCells());
62 }
63 CornerIterator endCorners() const {
64 return CornerIterator(endCells());
65 }
66
67 PointIterator beginPoints() const {
68 return PointIterator(beginCells(), endCells(), gv.indexSet());
69 }
70 PointIterator endPoints() const {
71 return PointIterator(endCells());
72 }
73
74 ConnectivityWriter makeConnectivity() const {
75 return ConnectivityWriter(*this);
76 }
77 const Communication& comm() const {
78 return gv.comm();
79 }
80 };
81
82 template<typename GV>
83 class NonConformingVolumeIteratorFactory {
84 const GV& gv;
85
86 public:
87 static const unsigned dimCell = GV::dimension;
88
89 typedef typename GV::template Codim<0>::Entity Cell;
90 typedef typename GV::template Codim<0>::
91 template Partition<InteriorBorder_Partition>::Iterator CellIterator;
92
93 typedef VTK::Corner<Cell> Corner;
94 typedef VTK::CornerIterator<CellIterator> CornerIterator;
95
96 typedef Corner Point;
97 typedef CornerIterator PointIterator;
98
99 typedef NonConformingConnectivityWriter<Cell> ConnectivityWriter;
100 typedef typename GV::Communication Communication;
101
102 explicit NonConformingVolumeIteratorFactory(const GV& gv_)
103 : gv(gv_)
104 { }
105
106 CellIterator beginCells() const {
107 return gv.template begin<0, InteriorBorder_Partition>();
108 }
109 CellIterator endCells() const {
110 return gv.template end<0, InteriorBorder_Partition>();
111 }
112
113 CornerIterator beginCorners() const {
114 return CornerIterator(beginCells(), endCells());
115 }
116 CornerIterator endCorners() const {
117 return CornerIterator(endCells());
118 }
119
120 PointIterator beginPoints() const { return beginCorners(); }
121 PointIterator endPoints() const { return endCorners(); }
122
123 ConnectivityWriter makeConnectivity() const {
124 return ConnectivityWriter();
125 }
126 const Communication& comm() const {
127 return gv.comm();
128 }
129 };
130
131 } // namespace VTK
132
134
135} // namespace Dune
136
137#endif // DUNE_GRID_IO_FILE_VTK_VOLUMEITERATORS_HH
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)