SABER
InterpolatorBump.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2020- UCAR
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 #include <ostream>
9 #include <string>
10 
11 #include "atlas/field.h"
12 #include "atlas/functionspace.h"
13 #include "eckit/config/Configuration.h"
14 #include "eckit/mpi/Comm.h"
15 
16 #include "oops/base/InterpolatorBase.h"
19 
20 namespace saber {
21 
22 // This is the preferred place to define the static bump interpolator factory.
23 // However, strangely, it did not work with gcc (7 and 9.3) on ubuntu 18.04
24 // So, this has been moved to the header file.
25 // static oops::InterpolatorMaker<InterpolatorBump> makerBumpInterpolator_("bump");
26 
27 // -----------------------------------------------------------------------------
28 InterpolatorBump::InterpolatorBump(const eckit::Configuration & config,
29  const atlas::FunctionSpace & infspace,
30  const atlas::FunctionSpace & outfspace,
31  const atlas::field::FieldSetImpl * masks,
32  const eckit::mpi::Comm & comm) {
33  bint_create_f90(keyBumpInterpolator_, &comm, infspace.get(), outfspace.get(),
34  masks, config);
35 }
36 
37 // -----------------------------------------------------------------------------
38  void InterpolatorBump::apply(const atlas::FieldSet & infields,
39  atlas::FieldSet & outfields) {
40  bint_apply_f90(keyBumpInterpolator_, infields.get(), outfields.get());
41 }
42 
43 // -----------------------------------------------------------------------------
44  void InterpolatorBump::apply(const atlas::Field & infield,
45  atlas::Field & outfield) {
46  atlas::FieldSet infields, outfields;
47  infields.add(infield);
48  outfields.add(outfield);
49  bint_apply_f90(keyBumpInterpolator_, infields.get(), outfields.get());
50 }
51 
52 // -----------------------------------------------------------------------------
53  void InterpolatorBump::apply_ad(const atlas::FieldSet & fields_grid2,
54  atlas::FieldSet & fields_grid1) {
55  bint_apply_ad_f90(keyBumpInterpolator_, fields_grid2.get(),
56  fields_grid1.get());
57 }
58 
59 // -----------------------------------------------------------------------------
62 }
63 
64 // -----------------------------------------------------------------------------
65 void InterpolatorBump::print(std::ostream & os) const {
66  os << " InterpolatorBump: print not implemented yet.";
67 }
68 
69 // -----------------------------------------------------------------------------
70 } // namespace saber
saber::InterpolatorBump::apply_ad
void apply_ad(const atlas::FieldSet &, atlas::FieldSet &) override
Definition: InterpolatorBump.cc:53
saber::InterpolatorBump::apply
void apply(const atlas::FieldSet &, atlas::FieldSet &) override
Definition: InterpolatorBump.cc:38
saber::InterpolatorBump::InterpolatorBump
InterpolatorBump(const eckit::Configuration &, const atlas::FunctionSpace &, const atlas::FunctionSpace &, const atlas::field::FieldSetImpl *=nullptr, const eckit::mpi::Comm &=oops::mpi::world())
Definition: InterpolatorBump.cc:28
saber
Definition: type_bump.h:22
saber::bint_apply_f90
void bint_apply_f90(const int &, const atlas::field::FieldSetImpl *, atlas::field::FieldSetImpl *)
saber::InterpolatorBump::~InterpolatorBump
~InterpolatorBump()
Definition: InterpolatorBump.cc:60
saber::bint_apply_ad_f90
void bint_apply_ad_f90(const int &, const atlas::field::FieldSetImpl *, atlas::field::FieldSetImpl *)
saber::bint_delete_f90
void bint_delete_f90(const int &)
saber::bint_create_f90
void bint_create_f90(int &, const eckit::mpi::Comm *, const atlas::functionspace::FunctionSpaceImpl *, const atlas::functionspace::FunctionSpaceImpl *, const atlas::field::FieldSetImpl *, const eckit::Configuration &)
saber::InterpolatorBump::keyBumpInterpolator_
int keyBumpInterpolator_
Definition: InterpolatorBump.h:49
InterpolatorBump.h
saber::InterpolatorBump::print
void print(std::ostream &) const override
Definition: InterpolatorBump.cc:65
interpolatorbump_f.h