OOPS
Iterator.cc
Go to the documentation of this file.
1
/*
2
* (C) Copyright 2018 UCAR
3
*
4
* This software is licensed under the terms of the Apache Licence Version 2.0
5
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6
*/
7
8
#include "
lorenz95/Iterator.h
"
9
#include <vector>
10
11
// -----------------------------------------------------------------------------
12
namespace
lorenz95
{
13
14
// -----------------------------------------------------------------------------
15
Iterator::Iterator
(
const
Resolution
& res,
const
int
& index): res_(res.npoints()), index_(index) {
16
}
17
18
// -----------------------------------------------------------------------------
19
Iterator::~Iterator
() {
20
}
21
22
// -----------------------------------------------------------------------------
23
bool
Iterator::operator==
(
const
Iterator
& other)
const
{
24
return
((
res_
== other.
res_
) && (
index_
== other.
index_
));
25
}
26
27
// -----------------------------------------------------------------------------
28
bool
Iterator::operator!=
(
const
Iterator
& other)
const
{
29
return
((
res_
!= other.
res_
) || (
index_
!= other.
index_
));
30
}
31
32
// -----------------------------------------------------------------------------
33
eckit::geometry::Point2
Iterator::operator*
()
const
{
34
return
eckit::geometry::Point2(
index_
/
static_cast<
double
>
(
res_
), 0.0);
35
}
36
37
// -----------------------------------------------------------------------------
38
Iterator
&
Iterator::operator++
() {
39
index_
++;
40
return
*
this
;
41
}
42
43
// -----------------------------------------------------------------------------
44
45
}
// namespace lorenz95
lorenz95::Iterator::operator*
eckit::geometry::Point2 operator*() const
Definition:
Iterator.cc:33
lorenz95::Resolution
Handles resolution.
Definition:
Resolution.h:42
lorenz95::Iterator::operator!=
bool operator!=(const Iterator &) const
Definition:
Iterator.cc:28
lorenz95::Iterator::Iterator
Iterator(const Resolution &res, const int &index=0)
Definition:
Iterator.cc:15
lorenz95::Iterator::index_
int index_
Definition:
Iterator.h:47
lorenz95::Iterator::operator++
Iterator & operator++()
Definition:
Iterator.cc:38
Iterator.h
lorenz95::Iterator::~Iterator
~Iterator()
Definition:
Iterator.cc:19
lorenz95::Iterator
Definition:
Iterator.h:30
lorenz95::Iterator::operator==
bool operator==(const Iterator &) const
Definition:
Iterator.cc:23
lorenz95::Iterator::res_
const int res_
Definition:
Iterator.h:46
lorenz95
The namespace for the L95 model.
Definition:
l95/src/lorenz95/AnalyticInit.cc:17
fv3-bundle
oops
l95
src
lorenz95
Iterator.cc
Generated on Sun Oct 25 2020 12:42:57 for OOPS by
1.8.18