atlas
FunctionSpace.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 <string>
14 
15 #include "atlas/library/config.h"
16 #include "atlas/util/ObjectHandle.h"
17 
18 namespace eckit {
19 class Configuration;
20 }
21 
22 namespace atlas {
23 class Field;
24 class FieldSet;
25 class Projection;
26 namespace functionspace {
27 class FunctionSpaceImpl;
28 }
29 namespace util {
30 class PartitionPolygon;
31 class PartitionPolygons;
32 } // namespace util
33 } // namespace atlas
34 
35 namespace atlas {
36 
37 //------------------------------------------------------------------------------------------------------
38 
39 class FunctionSpace : DOXYGEN_HIDE( public util::ObjectHandle<functionspace::FunctionSpaceImpl> ) {
40 public:
41  using Handle::Handle;
42  FunctionSpace();
43 
44  std::string type() const;
45  operator bool() const;
46  size_t footprint() const;
47  std::string distribution() const;
48 
49  Field createField( const eckit::Configuration& ) const;
50 
51  Field createField( const Field& ) const;
52  Field createField( const Field&, const eckit::Configuration& ) const;
53 
54  template <typename DATATYPE>
55  Field createField( const eckit::Configuration& ) const;
56 
57  template <typename DATATYPE>
58  Field createField() const;
59 
60  void haloExchange( const FieldSet&, bool on_device = false ) const;
61  void haloExchange( const Field&, bool on_device = false ) const;
62 
63  void adjointHaloExchange( const FieldSet&, bool on_device = false ) const;
64  void adjointHaloExchange( const Field&, bool on_device = false ) const;
65 
66  const util::PartitionPolygon& polygon( idx_t halo = 0 ) const;
67 
68  const util::PartitionPolygons& polygons() const;
69 
70  const Projection& projection() const;
71 
72  idx_t nb_partitions() const;
73 
74  idx_t size() const;
75 
76  Field lonlat() const;
77 
78  Field ghost() const;
79 };
80 
81 //------------------------------------------------------------------------------------------------------
82 
83 extern template Field FunctionSpace::createField<float>() const;
84 extern template Field FunctionSpace::createField<double>() const;
85 extern template Field FunctionSpace::createField<int>() const;
86 extern template Field FunctionSpace::createField<long>() const;
87 extern template Field FunctionSpace::createField<float>( const eckit::Configuration& ) const;
88 extern template Field FunctionSpace::createField<double>( const eckit::Configuration& ) const;
89 extern template Field FunctionSpace::createField<int>( const eckit::Configuration& ) const;
90 extern template Field FunctionSpace::createField<long>( const eckit::Configuration& ) const;
91 
92 //------------------------------------------------------------------------------------------------------
93 
94 } // namespace atlas
A Field contains an Array, Metadata, and a reference to a FunctionSpace.
Definition: Field.h:59
Definition: Polygon.h:155
Definition: Projection.h:49
Definition: Polygon.h:98
Definition: Domain.h:19
Represents a set of fields, where order is preserved.
Definition: FieldSet.h:146
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
Definition: FunctionSpace.h:39