| 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/functionspace/FunctionSpace.h" |
| 14 |
#include "atlas/interpolation/method/knn/KNearestNeighboursBase.h" |
| 15 |
|
| 16 |
namespace atlas { |
| 17 |
namespace interpolation { |
| 18 |
namespace method { |
| 19 |
|
| 20 |
class NearestNeighbour : public KNearestNeighboursBase { |
| 21 |
public: |
| 22 |
NearestNeighbour(const Config& config): KNearestNeighboursBase(config) {} |
| 23 |
virtual ~NearestNeighbour() override {} |
| 24 |
|
| 25 |
virtual void print(std::ostream&) const override {} |
| 26 |
|
| 27 |
protected: |
| 28 |
virtual const FunctionSpace& source() const override { return source_; } |
| 29 |
virtual const FunctionSpace& target() const override { return target_; } |
| 30 |
|
| 31 |
private: |
| 32 |
using KNearestNeighboursBase::do_setup; |
| 33 |
|
| 34 |
/** |
| 35 |
* @brief Create an interpolant sparse matrix relating two (pre-partitioned) |
| 36 |
* meshes, |
| 37 |
* using nearest neighbour method |
| 38 |
* @param source functionspace containing source elements |
| 39 |
* @param target functionspace containing target points |
| 40 |
*/ |
| 41 |
virtual void do_setup(const FunctionSpace& source, const FunctionSpace& target) override; |
| 42 |
virtual void do_setup(const Grid& source, const Grid& target, const Cache&) override; |
| 43 |
virtual void do_setup(const FunctionSpace& source, const FunctionSpace& target, const Cache&) override; |
| 44 |
|
| 45 |
FunctionSpace source_; |
| 46 |
FunctionSpace target_; |
| 47 |
}; |
| 48 |
|
| 49 |
} // namespace method |
| 50 |
} // namespace interpolation |
| 51 |
} // namespace atlas |