Debian Codegraph @

src/atlas/interpolation/Interpolation.h

raw
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 "atlas/interpolation/method/Method.h"
14 #include "atlas/library/config.h"
15 #include "atlas/util/ObjectHandle.h"
16
17 #include "atlas/interpolation/Cache.h"
18
19 namespace eckit {
20 class Parametrisation;
21 }
22
23 namespace atlas {
24 class Field;
25 class FieldSet;
26 class FunctionSpace;
27 class Grid;
28 namespace interpolation {
29 class Method;
30 }
31 } // namespace atlas
32
33 namespace atlas {
34
35 class Interpolation : DOXYGEN_HIDE(public util::ObjectHandle<interpolation::Method>) {
36 public:
37 using Config = eckit::Parametrisation;
38 using Cache = interpolation::Cache;
39 using Metadata = interpolation::Method::Metadata;
40
41 using Handle::Handle;
42 Interpolation() = default;
43
44 // Setup Interpolation from source to target function space
45 Interpolation(const Config&, const FunctionSpace& source, const FunctionSpace& target) noexcept(false);
46
47 // Setup Interpolation from source to coordinates given in a field with multiple components
48 Interpolation(const Config&, const FunctionSpace& source, const Field& target) noexcept(false);
49
50 // Setup Interpolation from source to coordinates given by separate fields for each component
51 Interpolation(const Config&, const FunctionSpace& source, const FieldSet& target) noexcept(false);
52
53 // Setup Interpolation from source grid to target grid
54 Interpolation(const Config&, const Grid& source, const Grid& target) noexcept(false);
55
56 Metadata execute(const FieldSet& source, FieldSet& target) const;
57
58 Metadata execute(const Field& source, Field& target) const;
59
60 Metadata execute_adjoint(FieldSet& source, const FieldSet& target) const;
61
62 Metadata execute_adjoint(Field& source, const Field& target) const;
63
64 void print(std::ostream& out) const;
65
66 const FunctionSpace& source() const;
67 const FunctionSpace& target() const;
68
69 Cache createCache() const;
70
71 Interpolation(const Config&, const Grid& source, const Grid& target, const Cache&) noexcept(false);
72
73 Interpolation(const Config&, const FunctionSpace& source, const FunctionSpace& target, const Cache&) noexcept(false);
74
75 friend std::ostream& operator<<(std::ostream& out, const Interpolation& i) {
76 i.print(out);
77 return out;
78 }
79 };
80
81 #ifndef DOXYGEN_SHOULD_SKIP_THIS
82 namespace functionspace {
83 class FunctionSpaceImpl;
84 }
85 namespace field {
86 class FieldImpl;
87 class FieldSetImpl;
88 } // namespace field
89
90 extern "C" {
91
92 Interpolation::Implementation* atlas__Interpolation__new(const eckit::Parametrisation* config,
93 const functionspace::FunctionSpaceImpl* source,
94 const functionspace::FunctionSpaceImpl* target);
95
96 Interpolation::Implementation* atlas__Interpolation__new_tgt_field(const eckit::Parametrisation* config,
97 const functionspace::FunctionSpaceImpl* source,
98 const field::FieldImpl* target);
99
100 Interpolation::Implementation* atlas__Interpolation__new_tgt_fieldset(const eckit::Parametrisation* config,
101 const functionspace::FunctionSpaceImpl* source,
102 const field::FieldSetImpl* target);
103
104 void atlas__Interpolation__delete(Interpolation::Implementation* This);
105 void atlas__Interpolation__execute_field(Interpolation::Implementation* This, const field::FieldImpl* source,
106 field::FieldImpl* target);
107 void atlas__Interpolation__execute_fieldset(Interpolation::Implementation* This, const field::FieldSetImpl* source,
108 field::FieldSetImpl* target);
109 void atlas__Interpolation__execute_adjoint_field(Interpolation::Implementation* This, field::FieldImpl* source,
110 const field::FieldImpl* target);
111 void atlas__Interpolation__execute_adjoint_fieldset(Interpolation::Implementation* This, field::FieldSetImpl* source,
112 const field::FieldSetImpl* target);
113 }
114 #endif
115
116 } // namespace atlas