17 #include "eckit/filesystem/PathName.h" 18 #include "eckit/io/Buffer.h" 20 #include "eckit/linalg/SparseMatrix.h" 22 #include "atlas/runtime/Exception.h" 23 #include "atlas/util/KDTree.h" 35 namespace interpolation {
42 virtual size_t footprint()
const = 0;
43 virtual std::string type()
const = 0;
53 operator bool()
const {
return not cache_.empty(); }
55 size_t footprint()
const {
57 for (
auto& entry : cache_ ) {
58 footprint += entry.second->footprint();
62 void add(
const Cache& );
65 Cache( std::shared_ptr<InterpolationCacheEntry> cache );
69 auto it = cache_.find( type );
70 if ( it != cache_.end() ) {
71 return it->second.get();
77 std::map<std::string, std::shared_ptr<InterpolationCacheEntry>> cache_;
84 using Matrix = eckit::linalg::SparseMatrix;
86 MatrixCacheEntry(
const Matrix* matrix ) : matrix_{matrix} { ATLAS_ASSERT( matrix_ !=
nullptr ); }
87 const Matrix& matrix()
const {
return *matrix_; }
88 size_t footprint()
const override {
return matrix_->footprint(); }
89 operator bool()
const {
return not matrix_->empty(); }
90 static std::string static_type() {
return "Matrix"; }
91 std::string type()
const override {
return static_type(); }
94 const Matrix* matrix_;
101 using Matrix = MatrixCacheEntry::Matrix;
110 operator bool()
const;
111 const Matrix& matrix()
const;
112 size_t footprint()
const;
115 MatrixCache( std::shared_ptr<InterpolationCacheEntry> entry );
127 size_t footprint()
const override {
return tree().footprint(); }
128 operator bool()
const {
return bool( tree_ ); }
129 static std::string static_type() {
return "IndexKDTree"; }
130 std::string type()
const override {
return static_type(); }
145 operator bool()
const;
147 size_t footprint()
const;
Definition: Interpolation.h:35
k-dimensional tree constructable both with 2D (lon,lat) points as with 3D (x,y,z) points ...
Definition: KDTree.h:49
Contains all atlas classes and methods.
Definition: atlas-grids.cc:33