| 1 |
/* |
| 2 |
* (C) Copyright 1996- 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 |
* |
| 7 |
* In applying this licence, ECMWF does not waive the privileges and immunities |
| 8 |
* granted to it by virtue of its status as an intergovernmental organisation nor |
| 9 |
* does it submit to any jurisdiction. |
| 10 |
*/ |
| 11 |
|
| 12 |
|
| 13 |
#pragma once |
| 14 |
|
| 15 |
#include <string> |
| 16 |
|
| 17 |
#include "atlas/interpolation/nonlinear/NonLinear.h" |
| 18 |
#include "atlas/library/config.h" |
| 19 |
#include "atlas/util/ObjectHandle.h" |
| 20 |
|
| 21 |
|
| 22 |
namespace atlas { |
| 23 |
class Field; |
| 24 |
namespace util { |
| 25 |
class Config; |
| 26 |
} |
| 27 |
} // namespace atlas |
| 28 |
|
| 29 |
|
| 30 |
namespace atlas { |
| 31 |
namespace interpolation { |
| 32 |
|
| 33 |
|
| 34 |
/** |
| 35 |
* @brief NonLinear class applies non-linear corrections to an interpolation matrix |
| 36 |
*/ |
| 37 |
struct NonLinear : DOXYGEN_HIDE(public util::ObjectHandle<nonlinear::NonLinear>) { |
| 38 |
using Spec = util::Config; |
| 39 |
using Config = nonlinear::NonLinear::Config; |
| 40 |
using Matrix = nonlinear::NonLinear::Matrix; |
| 41 |
|
| 42 |
/** |
| 43 |
* @brief ctor |
| 44 |
*/ |
| 45 |
using Handle::Handle; |
| 46 |
NonLinear(); |
| 47 |
NonLinear(const Config&); |
| 48 |
NonLinear(const std::string& type, const Config&); |
| 49 |
|
| 50 |
/** |
| 51 |
* @brief bool operator |
| 52 |
* @return if NonLinear object has been setup |
| 53 |
*/ |
| 54 |
using Handle::operator bool; // (ensure this exists) |
| 55 |
|
| 56 |
/** |
| 57 |
* @brief if NonLinear applies to field |
| 58 |
* @param [in] f field |
| 59 |
* @return if NonLinear applies to field |
| 60 |
*/ |
| 61 |
bool operator()(const Field& f) const; |
| 62 |
|
| 63 |
/** |
| 64 |
* @brief Apply non-linear corrections to interpolation matrix |
| 65 |
* @param [inout] W interpolation matrix |
| 66 |
* @param [in] f field |
| 67 |
* @return if W was modified |
| 68 |
*/ |
| 69 |
bool execute(Matrix& W, const Field& f) const; |
| 70 |
|
| 71 |
/** |
| 72 |
* @brief Apply non-linear corrections to interpolation matrix |
| 73 |
* @param [inout] W interpolation matrix |
| 74 |
* @param [in] a array containing possibly missing values |
| 75 |
* @param [in] c configuration containing missing value diagnostic information |
| 76 |
* @return if W was modified |
| 77 |
*/ |
| 78 |
bool execute(Matrix& W, const array::Array& a, const Config& c) const; |
| 79 |
}; |
| 80 |
|
| 81 |
|
| 82 |
} // namespace interpolation |
| 83 |
} // namespace atlas |