atlas
Interpolation.h
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 #include "atlas/library/config.h"
15 #include "atlas/util/ObjectHandle.h"
16 
17 #include "atlas/interpolation/Cache.h"
18 
19 namespace eckit {
20 class Parametrisation;
21 }
22 
23 namespace atlas {
24 class Field;
25 class FieldSet;
26 class FunctionSpace;
27 class Grid;
28 namespace interpolation {
29 class Method;
30 }
31 } // namespace atlas
32 
33 namespace atlas {
34 
35 class Interpolation : DOXYGEN_HIDE( public util::ObjectHandle<interpolation::Method> ) {
36 public:
37  using Config = eckit::Parametrisation;
39 
40  using Handle::Handle;
41  Interpolation() = default;
42 
43  // Setup Interpolation from source to target function space
44  Interpolation( const Config&, const FunctionSpace& source, const FunctionSpace& target ) noexcept( false );
45 
46  // Setup Interpolation from source to coordinates given in a field with multiple components
47  Interpolation( const Config&, const FunctionSpace& source, const Field& target ) noexcept( false );
48 
49  // Setup Interpolation from source to coordinates given by separate fields for each component
50  Interpolation( const Config&, const FunctionSpace& source, const FieldSet& target ) noexcept( false );
51 
52  // Setup Interpolation from source grid to target grid
53  Interpolation( const Config&, const Grid& source, const Grid& target ) noexcept( false );
54 
55  void execute( const FieldSet& source, FieldSet& target ) const;
56 
57  void execute( const Field& source, Field& target ) const;
58 
59  void execute_adjoint( FieldSet& source, const FieldSet& target ) const;
60 
61  void execute_adjoint( Field& source, const Field& target ) const;
62 
63  void print( std::ostream& out ) const;
64 
65  const FunctionSpace& source() const;
66  const FunctionSpace& target() const;
67 
68  Cache createCache() const;
69 
70  Interpolation( const Config&, const Grid& source, const Grid& target, const Cache& ) noexcept( false );
71 };
72 
73 #ifndef DOXYGEN_SHOULD_SKIP_THIS
74 namespace functionspace {
75 class FunctionSpaceImpl;
76 }
77 namespace field {
78 class FieldImpl;
79 class FieldSetImpl;
80 } // namespace field
81 
82 extern "C" {
83 
84 Interpolation::Implementation* atlas__Interpolation__new( const eckit::Parametrisation* config,
86  const functionspace::FunctionSpaceImpl* target );
87 
88 Interpolation::Implementation* atlas__Interpolation__new_tgt_field( const eckit::Parametrisation* config,
90  const field::FieldImpl* target );
91 
92 Interpolation::Implementation* atlas__Interpolation__new_tgt_fieldset( const eckit::Parametrisation* config,
94  const field::FieldSetImpl* target );
95 
96 void atlas__Interpolation__delete( Interpolation::Implementation* This );
97 void atlas__Interpolation__execute_field( Interpolation::Implementation* This, const field::FieldImpl* source,
98  field::FieldImpl* target );
99 void atlas__Interpolation__execute_fieldset( Interpolation::Implementation* This, const field::FieldSetImpl* source,
100  field::FieldSetImpl* target );
101 }
102 #endif
103 
104 } // namespace atlas
A Field contains an Array, Metadata, and a reference to a FunctionSpace.
Definition: Field.h:59
Definition: Domain.h:19
Most general grid container.
Definition: Grid.h:64
Represents a set of fields, where order is preserved.
Definition: FieldSet.h:42
Represents a set of fields, where order is preserved.
Definition: FieldSet.h:146
Definition: Interpolation.h:35
Contains all atlas classes and methods.
Definition: atlas-grids.cc:33
Definition: FieldImpl.h:40
FunctionSpace class helps to interprete Fields.
Definition: FunctionSpaceImpl.h:44
Definition: Cache.h:48
Definition: FunctionSpace.h:39