FV3-JEDI
GeometryIterator.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2019 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 #ifndef FV3JEDI_GEOMETRYITERATOR_GEOMETRYITERATOR_H_
9 #define FV3JEDI_GEOMETRYITERATOR_GEOMETRYITERATOR_H_
10 
11 #include <iterator>
12 #include <string>
13 
14 #include "eckit/geometry/Point2.h"
15 
18 
19 #include "oops/util/ObjectCounter.h"
20 #include "oops/util/Printable.h"
21 
22 namespace fv3jedi {
23 
24 class Geometry;
25 
26 // -----------------------------------------------------------------------------
27 class GeometryIterator: public std::iterator<std::forward_iterator_tag,
28  eckit::geometry::Point2>,
29  public util::Printable,
30  private util::ObjectCounter<GeometryIterator> {
31  public:
32  static const std::string classname() {return "fv3jedi::GeometryIterator";}
33 
35  explicit GeometryIterator(const Geometry & geom,
36  const int & iindex = 1, const int & jindex = 1);
38 
39  bool operator==(const GeometryIterator &) const;
40  bool operator!=(const GeometryIterator &) const;
41  eckit::geometry::Point2 operator*() const;
43 
44 // Utilities
45  F90iter & toFortran() {return keyIter_;}
46  const F90iter & toFortran() const {return keyIter_;}
47 
48  private:
49  void print(std::ostream &) const;
51  const Geometry & geom_;
52 };
53 
54 } // namespace fv3jedi
55 
56 #endif // FV3JEDI_GEOMETRYITERATOR_GEOMETRYITERATOR_H_
fv3jedi::GeometryIterator::operator*
eckit::geometry::Point2 operator*() const
Definition: GeometryIterator.cc:60
fv3jedi::GeometryIterator::print
void print(std::ostream &) const
Definition: GeometryIterator.cc:75
fv3jedi::GeometryIterator::geom_
const Geometry & geom_
Definition: GeometryIterator.h:51
fv3jedi::GeometryIterator::GeometryIterator
GeometryIterator(const GeometryIterator &)
Definition: GeometryIterator.cc:20
fv3jedi::GeometryIterator::toFortran
const F90iter & toFortran() const
Definition: GeometryIterator.h:46
fv3jedi::GeometryIterator::operator==
bool operator==(const GeometryIterator &) const
Definition: GeometryIterator.cc:44
fv3jedi::GeometryIterator::classname
static const std::string classname()
Definition: GeometryIterator.h:32
Geometry.h
fv3jedi::F90iter
int F90iter
Definition: interface.h:26
fv3jedi::GeometryIterator::operator++
GeometryIterator & operator++()
Definition: GeometryIterator.cc:68
fv3jedi::GeometryIterator::keyIter_
F90iter keyIter_
Definition: GeometryIterator.h:50
fv3jedi::GeometryIterator::~GeometryIterator
~GeometryIterator()
Definition: GeometryIterator.cc:38
GeometryIterator.interface.h
fv3jedi::GeometryIterator::operator!=
bool operator!=(const GeometryIterator &) const
Definition: GeometryIterator.cc:52
fv3jedi::Geometry
Geometry handles geometry for FV3JEDI model.
Definition: Geometry.h:41
fv3jedi::GeometryIterator
Definition: GeometryIterator.h:30
fv3jedi
Configuration files should be formatted as e.g.
Definition: ErrorCovariance.cc:20
fv3jedi::GeometryIterator::toFortran
F90iter & toFortran()
Definition: GeometryIterator.h:45