dune-grid
2.11
Toggle main menu visibility
Loading...
Searching...
No Matches
dune
grid
io
file
vtk
pointiterator.hh
Go to the documentation of this file.
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_POINTITERATOR_HH
7
#define DUNE_GRID_IO_FILE_VTK_POINTITERATOR_HH
8
9
#include <iterator>
10
#include <vector>
11
12
#include <dune/common/iteratorfacades.hh>
13
#include <dune/common/typetraits.hh>
14
15
#include <
dune/grid/io/file/vtk/corner.hh
>
16
#include <
dune/grid/io/file/vtk/corneriterator.hh
>
17
18
namespace
Dune
19
{
22
23
namespace
VTK
{
24
26
49
template
<
typename
CellIterator,
typename
IS>
50
class
PointIterator
51
:
public
ForwardIteratorFacade
52
< PointIterator<CellIterator, IS>,
53
const Corner<typename std::remove_const<typename std::iterator_traits<
54
CellIterator>::value_type>::type>,
55
const Corner<typename std::remove_const<typename std::iterator_traits<
56
CellIterator>::value_type>::type>&,
57
typename std::iterator_traits<CellIterator>::difference_type>
58
{
59
public
:
60
typedef
VTK::Corner
<
typename
std::remove_const<
typename
std::iterator_traits<
61
CellIterator>::value_type>::type>
Corner
;
62
63
// reiterate the facades typedefs here
64
typedef
PointIterator<CellIterator, IS>
DerivedType
;
65
typedef
const
Corner
Value
;
66
typedef
Value
&
Reference
;
67
typedef
typename
std::iterator_traits<CellIterator>::difference_type
68
DifferenceType
;
69
70
static
const
unsigned
mydim
= std::iterator_traits<CellIterator>::
71
value_type::mydimension;
72
73
private
:
74
typedef
ForwardIteratorFacade<
DerivedType
,
Value
,
Reference
,
75
DifferenceType
> Facade;
76
77
CornerIterator<CellIterator>
cornerit;
78
const
IS* is;
79
std::vector<bool> seen;
80
81
public
:
82
Reference
dereference
()
const
{
83
return
*cornerit;
84
}
85
86
bool
isDereferencable
()
const
{
87
return
cornerit.isDereferencable();
88
}
89
90
bool
equals
(
const
DerivedType
& other)
const
{
91
return
cornerit == other.cornerit;
92
}
93
94
void
increment
() {
95
for
(++cornerit;
isDereferencable
(); ++cornerit) {
96
typename
IS::IndexType index =
97
is->subIndex(cornerit->cell(), cornerit->duneIndex(),
mydim
);
98
99
if
(!seen[index]) {
100
seen[index] =
true
;
101
break
;
102
}
103
}
104
}
105
107
112
PointIterator
(
const
CellIterator& cellit,
const
CellIterator& cellend,
113
const
IS& is_)
114
: cornerit(cellit, cellend), is(&is_), seen(is->size(
mydim
), false)
115
{ }
116
117
120
PointIterator
(
const
CellIterator& cellend_)
121
: cornerit(cellend_), is(0)
122
{ }
123
};
124
125
}
// namespace VTK
126
128
129
}
// namespace Dune
130
131
#endif
// DUNE_GRID_IO_FILE_VTK_POINTITERATOR_HH
corner.hh
corneriterator.hh
Dune
Include standard header files.
Definition
agrid.hh:60
Dune::VTK
Definition
basicwriter.hh:32
Dune::VTK::Corner
simple class representing a corner of a cell
Definition
corner.hh:25
Dune::VTK::CornerIterator
iterate over the corners of some cell range
Definition
corneriterator.hh:39
Dune::VTK::PointIterator::PointIterator
PointIterator(const CellIterator &cellit, const CellIterator &cellend, const IS &is_)
construct a CornerIterator
Definition
pointiterator.hh:112
Dune::VTK::PointIterator::increment
void increment()
Definition
pointiterator.hh:94
Dune::VTK::PointIterator::Corner
VTK::Corner< typename std::remove_const< typename std::iterator_traits< CellIterator >::value_type >::type > Corner
Definition
pointiterator.hh:61
Dune::VTK::PointIterator::dereference
Reference dereference() const
Definition
pointiterator.hh:82
Dune::VTK::PointIterator::DifferenceType
std::iterator_traits< CellIterator >::difference_type DifferenceType
Definition
pointiterator.hh:68
Dune::VTK::PointIterator< CellIterator, typename GV::IndexSet >::mydim
static const unsigned mydim
Definition
pointiterator.hh:70
Dune::VTK::PointIterator::PointIterator
PointIterator(const CellIterator &cellend_)
construct a CornerIterator
Definition
pointiterator.hh:120
Dune::VTK::PointIterator::equals
bool equals(const DerivedType &other) const
Definition
pointiterator.hh:90
Dune::VTK::PointIterator::DerivedType
PointIterator< CellIterator, IS > DerivedType
Definition
pointiterator.hh:64
Dune::VTK::PointIterator::Value
const Corner Value
Definition
pointiterator.hh:65
Dune::VTK::PointIterator::Reference
Value & Reference
Definition
pointiterator.hh:66
Dune::VTK::PointIterator::isDereferencable
bool isDereferencable() const
Definition
pointiterator.hh:86
Generated by
1.17.0