11 #include "atlas/field.h"
12 #include "atlas/functionspace.h"
13 #include "eckit/config/Configuration.h"
14 #include "eckit/exception/Exceptions.h"
18 #include "oops/util/abor1_cpp.h"
19 #include "oops/util/Logger.h"
21 using atlas::option::name;
22 using atlas::option::levels;
30 const atlas::FunctionSpace & fspace1,
31 const atlas::FunctionSpace & fspace2,
32 const atlas::field::FieldSetImpl * masks,
33 const eckit::mpi::Comm & comm) :
34 in_fspace_(&fspace1), out_fspace_(&fspace2) {
37 fspace1.lonlat().get(), fspace2.lonlat().get(), config);
52 atlas::Field & outfield) {
59 atlas::Field & field_grid1) {
66 atlas::FieldSet & outfields) {
68 for (
int ifield = 0; ifield < infields.size(); ++ifield) {
69 std::string fname = infields.field(ifield).name();
70 if (!outfields.has_field(fname)) {
71 oops::Log::info() <<
"Allocating output fields for Unstructured Interpolation" << std::endl;
73 atlas::Field outfield =
out_fspace_->createField<
double>(name(fname) |
74 levels(infields.field(ifield).levels()));
75 outfields.add(outfield);
77 this->
apply(infields.field(fname), outfields.field(fname));
83 atlas::FieldSet & fields_grid1) {
85 for (
int ifield = 0; ifield < fields_grid2.size(); ++ifield) {
86 std::string fname = fields_grid2.field(ifield).name();
87 if (!fields_grid1.has_field(fname)) {
89 "Allocating output fields for Unstructured Interpolation Adjoint" << std::endl;
91 atlas::Field field1 =
in_fspace_->createField<
double>(name(fname) |
92 levels(fields_grid2.field(ifield).levels()));
93 fields_grid1.add(field1);
95 this->
apply_ad(fields_grid2.field(fname), fields_grid1.field(fname));
101 os <<
" InterpolatorUnstructured: print not implemented yet.";
const atlas::FunctionSpace * out_fspace_
InterpolatorUnstructured(const eckit::Configuration &, const atlas::FunctionSpace &, const atlas::FunctionSpace &, const atlas::field::FieldSetImpl *=nullptr, const eckit::mpi::Comm &=oops::mpi::world())
const atlas::FunctionSpace * in_fspace_
void print(std::ostream &) const override
int keyUnstructuredInterpolator_
int write(const eckit::Configuration &) override
void apply_ad(const atlas::Field &, atlas::Field &)
~InterpolatorUnstructured()
void apply(const atlas::Field &, atlas::Field &) override
The namespace for the main oops code.
void unstrc_delete_f90(const int &)
void unstrc_create_f90(int &, const eckit::mpi::Comm *, const atlas::field::FieldImpl *, const atlas::field::FieldImpl *, const eckit::Configuration &)
void unstrc_apply_f90(const int &, const atlas::field::FieldImpl *, atlas::field::FieldImpl *)
static InterpolatorMaker< InterpolatorUnstructured > makerUNSTR_("unstructured")
void unstrc_apply_ad_f90(const int &, const atlas::field::FieldImpl *, atlas::field::FieldImpl *)
void unstrc_write_f90(const int &, const eckit::Configuration &)