| 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 |
#include "atlas/grid/Vertical.h" |
| 21 |
|
| 22 |
namespace atlas { |
| 23 |
namespace interpolation { |
| 24 |
namespace method { |
| 25 |
|
| 26 |
/** |
| 27 |
* @class StructuredInterpolation3D |
| 28 |
* |
| 29 |
* Three-dimensional interpolation making use of Structure of grid. |
| 30 |
*/ |
| 31 |
|
| 32 |
template <typename Kernel> |
| 33 |
class StructuredInterpolation3D : public Method { |
| 34 |
public: |
| 35 |
StructuredInterpolation3D(const Config& config); |
| 36 |
|
| 37 |
virtual ~StructuredInterpolation3D() override {} |
| 38 |
|
| 39 |
virtual void print(std::ostream&) const override; |
| 40 |
|
| 41 |
protected: |
| 42 |
void setup(const FunctionSpace& source); |
| 43 |
|
| 44 |
virtual const FunctionSpace& source() const override { return source_; } |
| 45 |
|
| 46 |
virtual const FunctionSpace& target() const override { return target_; } |
| 47 |
|
| 48 |
private: |
| 49 |
virtual void do_setup(const Grid& source, const Grid& target, const Cache&) override; |
| 50 |
|
| 51 |
virtual void do_setup(const FunctionSpace& source, const FunctionSpace& target, const Cache&) override; |
| 52 |
|
| 53 |
virtual void do_setup(const FunctionSpace& source, const FunctionSpace& target) override; |
| 54 |
|
| 55 |
virtual void do_setup(const FunctionSpace& source, const Field& target) override; |
| 56 |
|
| 57 |
virtual void do_setup(const FunctionSpace& source, const FieldSet& target) override; |
| 58 |
|
| 59 |
virtual void do_execute(const Field& src, Field& tgt, Metadata&) const override; |
| 60 |
|
| 61 |
virtual void do_execute(const FieldSet& src, FieldSet& tgt, Metadata&) const override; |
| 62 |
|
| 63 |
template <typename Value, int Rank> |
| 64 |
void execute_impl(const Kernel& kernel, const FieldSet& src, FieldSet& tgt) const; |
| 65 |
|
| 66 |
static double convert_units_multiplier(const Field& field); |
| 67 |
|
| 68 |
protected: |
| 69 |
Field target_ghost_; |
| 70 |
Field target_lonlat_; |
| 71 |
Field target_vertical_; |
| 72 |
|
| 73 |
Field target_3d_; |
| 74 |
|
| 75 |
FieldSet target_xyz_; |
| 76 |
|
| 77 |
FunctionSpace source_; |
| 78 |
FunctionSpace target_; |
| 79 |
|
| 80 |
bool matrix_free_; |
| 81 |
bool limiter_; |
| 82 |
|
| 83 |
std::unique_ptr<Kernel> kernel_; |
| 84 |
}; |
| 85 |
|
| 86 |
|
| 87 |
} // namespace method |
| 88 |
} // namespace interpolation |
| 89 |
} // namespace atlas |
| 90 |
|
| 91 |
#include "StructuredInterpolation3D.tcc" |