Debian Codegraph @

src/atlas/interpolation/method/structured/StructuredInterpolation2D.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
15 #include <memory>
16
17 #include "atlas/field/Field.h"
18 #include "atlas/field/FieldSet.h"
19 #include "atlas/functionspace/FunctionSpace.h"
20
21 namespace atlas {
22 namespace interpolation {
23 namespace method {
24
25 /**
26 * @class StructuredInterpolation2D
27 *
28 * Horizontal interpolation making use of Structure of grid
29 * Multiple (vertical) levels can be interpolated as well but
30 * assumes that input and output levels are the same.
31 */
32
33 template <typename Kernel>
34 class StructuredInterpolation2D : public Method {
35 public:
36 StructuredInterpolation2D(const Config& config);
37
38 ~StructuredInterpolation2D() override {}
39
40 void print(std::ostream&) const override;
41
42 const Kernel& kernel() const { return *kernel_; }
43
44 const FunctionSpace& source() const override { return source_; }
45
46 const FunctionSpace& target() const override { return target_; }
47
48 protected:
49 void setup(const FunctionSpace& source);
50
51 private:
52 virtual void do_setup(const Grid& source, const Grid& target, const Cache&) override;
53
54 virtual void do_setup(const FunctionSpace& source, const FunctionSpace& target, const Cache&) override;
55
56 virtual void do_setup(const FunctionSpace& source, const FunctionSpace& target) override;
57
58 virtual void do_setup(const FunctionSpace& source, const Field& target) override;
59
60 virtual void do_setup(const FunctionSpace& source, const FieldSet& target) override;
61
62 virtual void do_execute(const Field& src, Field& tgt, Metadata&) const override;
63
64 virtual void do_execute(const FieldSet& src, FieldSet& tgt, Metadata&) const override;
65
66 template <typename Value, int Rank>
67 void execute_impl(const Kernel& kernel, const FieldSet& src, FieldSet& tgt) const;
68
69 static double convert_units_multiplier(const Field& field);
70
71 protected:
72 Field target_lonlat_;
73 Field target_ghost_;
74
75 FieldSet target_lonlat_fields_;
76
77 FunctionSpace source_;
78 FunctionSpace target_;
79
80 bool verbose_;
81 bool limiter_;
82 bool matrix_free_;
83 double convert_units_;
84 idx_t out_npts_;
85
86 std::unique_ptr<Kernel> kernel_;
87 };
88
89
90 } // namespace method
91 } // namespace interpolation
92 } // namespace atlas
93
94 #include "StructuredInterpolation2D.tcc"