atlas
Grid.h
1 /*
2  * (C) Copyright 2013 ECMWF.
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  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation
8  * nor does it submit to any jurisdiction.
9  */
10 
11 #pragma once
12 
13 #include <functional>
14 #include <initializer_list>
15 #include <string>
16 
17 #include "atlas/domain/Domain.h"
18 #include "atlas/library/config.h"
19 #include "atlas/projection/Projection.h"
20 #include "atlas/util/ObjectHandle.h"
21 
22 namespace eckit {
23 class Hash;
24 }
25 namespace atlas {
26 class PointXY;
27 class PointLonLat;
28 namespace util {
29 class Config;
30 }
31 namespace grid {
32 class IterateXY;
33 class IterateLonLat;
34 namespace detail {
35 namespace grid {
36 class Grid;
37 }
38 } // namespace detail
39 } // namespace grid
40 } // namespace atlas
41 
42 namespace atlas {
43 
44 //---------------------------------------------------------------------------------------------------------------------
45 
64 class Grid : DOXYGEN_HIDE( public util::ObjectHandle<grid::detail::grid::Grid> ) {
65 public:
66  using Config = util::Config;
67  using Spec = util::Config;
68  using Domain = atlas::Domain;
70  using PointXY = atlas::PointXY; // must be sizeof(double)*2
71  using PointLonLat = atlas::PointLonLat; // must be sizeof(double)*2
72  using IterateXY = grid::IterateXY;
74 
75 public:
76  IterateXY xy() const;
77  IterateLonLat lonlat() const;
78 
79  using Handle::Handle;
80  Grid() = default;
81  Grid( const std::string& name, const Domain& = Domain() );
82  Grid( const std::string& name, const Projection&, const Domain& = Domain() );
83  Grid( const Grid&, const Domain& );
84  Grid( const Config& );
85 
86  bool operator==( const Grid& other ) const { return uid() == other.uid(); }
87  bool operator!=( const Grid& other ) const { return uid() != other.uid(); }
88 
89  idx_t size() const;
90 
91  const Projection& projection() const;
92  const Domain& domain() const;
93  RectangularLonLatDomain lonlatBoundingBox() const;
94  std::string name() const;
95  std::string uid() const;
96 
98  void hash( eckit::Hash& h ) const;
99 
100  size_t footprint() const;
101 
102  Spec spec() const;
103 
104  Config meshgenerator() const;
105  Config partitioner() const;
106 };
107 
108 //---------------------------------------------------------------------------------------------------------------------
109 
110 } // namespace atlas
Definition: Iterator.h:149
Point in longitude-latitude coordinate system.
Definition: Point.h:103
Definition: Projection.h:49
Definition: Domain.h:130
Definition: Domain.h:19
Most general grid container.
Definition: Grid.h:64
Definition: Iterator.h:131
Definition: Domain.h:48
Point in arbitrary XY-coordinate system.
Definition: Point.h:40
Contains all atlas classes and methods.
Definition: atlas-grids.cc:33
long idx_t
Integer type for indices in connectivity tables.
Definition: config.h:42
Configuration class used to construct various atlas components.
Definition: Config.h:27