| 1 |
/* |
| 2 |
* (C) Crown Copyright 2022 Met Office |
| 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 |
*/ |
| 7 |
|
| 8 |
#pragma once |
| 9 |
|
| 10 |
#include "atlas/functionspace/FunctionSpace.h" |
| 11 |
#include "atlas/interpolation/method/Method.h" |
| 12 |
|
| 13 |
namespace atlas { |
| 14 |
namespace interpolation { |
| 15 |
namespace method { |
| 16 |
|
| 17 |
/// @brief Cubed sphere bilinear interpolation method. |
| 18 |
/// |
| 19 |
/// @details Performs bilinear (quads) and baycentric (triangles) interpolation |
| 20 |
/// accross cubed sphere tiles in (alpha, beta) coordinates. |
| 21 |
/// Adding int "halo" (default 0) to the config controls the amount of |
| 22 |
/// halo to consider when seraching for interpolation polygons. Adding |
| 23 |
/// int "list_size" (defualt 8) will change the number of cells |
| 24 |
/// returned by the internal kd-tree search. Increasing both values |
| 25 |
/// may resolve errors if setup method fails to find cells. |
| 26 |
/// The automatic halo exchange in the execute method can be disabled |
| 27 |
/// by setting "halo_exchange" to false. |
| 28 |
class CubedSphereBilinear : public Method { |
| 29 |
public: |
| 30 |
CubedSphereBilinear(const Config& config): Method(config) { |
| 31 |
config.get("halo", halo_); |
| 32 |
config.get("list_size", listSize_); |
| 33 |
} |
| 34 |
virtual ~CubedSphereBilinear() override {} |
| 35 |
|
| 36 |
virtual void print(std::ostream&) const override; |
| 37 |
virtual const FunctionSpace& source() const override { return source_; } |
| 38 |
virtual const FunctionSpace& target() const override { return target_; } |
| 39 |
|
| 40 |
private: |
| 41 |
using Method::do_setup; |
| 42 |
void do_setup(const FunctionSpace& source, const FunctionSpace& target) override; |
| 43 |
void do_setup(const Grid& source, const Grid& target, const Cache&) override; |
| 44 |
void do_setup(const FunctionSpace& source, const FunctionSpace& target, const Cache&) override; |
| 45 |
|
| 46 |
FunctionSpace source_; |
| 47 |
FunctionSpace target_; |
| 48 |
|
| 49 |
int halo_{0}; |
| 50 |
int listSize_{8}; |
| 51 |
}; |
| 52 |
|
| 53 |
} // namespace method |
| 54 |
} // namespace interpolation |
| 55 |
} // namespace atlas |