31
31
32
32
#include " orca-jedi/interpolator/Interpolator.h"
33
33
34
+ #include < boost/uuid/uuid.hpp> // uuid class DJL
35
+ #include < boost/uuid/uuid_generators.hpp> // generators DJL
36
+ #include < boost/uuid/uuid_io.hpp> // streaming operators etc. DJL
37
+
38
+ #include " orca-jedi/utilities/IOUtils.h" // DJL
39
+
40
+
34
41
namespace eckit {
35
42
class Configuration ;
36
43
}
@@ -178,6 +185,11 @@ template void Interpolator::executeInterpolation<float>(
178
185
const std::vector<bool > & mask,
179
186
std::vector<double >::iterator& iter) const ;
180
187
188
+ // / \brief Interpolate from model space to observation space
189
+ // / \param vars Oops variables
190
+ // / \param inc Increment object (input)
191
+ // / \param mask Mask vector in observation space
192
+ // / \param result Result (output) vector in observation space
181
193
void Interpolator::apply (const oops::Variables& vars, const Increment& inc,
182
194
const std::vector<bool > & mask,
183
195
std::vector<double >& result) const {
@@ -230,6 +242,11 @@ void Interpolator::apply(const oops::Variables& vars, const Increment& inc,
230
242
}
231
243
}
232
244
245
+ // / \brief Interpolate from observation space to model space
246
+ // / \param vars Oops variables
247
+ // / \param inc Increment object (output)
248
+ // / \param mask Mask (observation space) vector
249
+ // / \param resultin Values (observation space) vector (input)
233
250
void Interpolator::applyAD (const oops::Variables& vars, Increment& inc,
234
251
const std::vector<bool > & mask,
235
252
const std::vector<double > & resultin) const
@@ -242,7 +259,7 @@ void Interpolator::applyAD(const oops::Variables& vars, Increment& inc,
242
259
243
260
oops::Log::debug () << " DJL ** Interpolator::applyAD this needs checking **" << std::endl;
244
261
245
- // ** Not sure what I'm doing yet - Just trying to do the opposite of applyAD
262
+ // ** Trying to do the opposite of apply DJL
246
263
247
264
const size_t nvars = vars.size ();
248
265
@@ -263,13 +280,15 @@ void Interpolator::applyAD(const oops::Variables& vars, Increment& inc,
263
280
inc.geometry ()->variableSizes (vars);
264
281
size_t nvals = 0 ;
265
282
266
- // boost::uuids::uuid uuid = boost::uuids::random_generator()();
267
- // std::shared_ptr<const Geometry> geom = inc.geometry();
268
- // writeGenFieldsToFile("applyADpre"+ boost::uuids::to_string(uuid) +".nc", *geom, inc.validTime(), inc.incrementFields());
283
+ // DJL write debug fields to file
284
+ boost::uuids::uuid uuid = boost::uuids::random_generator ()();
285
+ std::shared_ptr<const Geometry> geom = inc.geometry ();
286
+ writeFieldsToFile (" applyADpre" + boost::uuids::to_string (uuid) +" .nc" , *geom, inc.validTime (), inc.incrementFields ());
269
287
270
288
for (size_t jvar=0 ; jvar < nvars; ++jvar) nvals += nlocs_ * varSizes[jvar];
271
289
// result.resize(nvals);
272
290
291
+
273
292
std::size_t out_idx = 0 ;
274
293
for (size_t jvar=0 ; jvar < nvars; ++jvar) {
275
294
oops::Log::debug () << " DJL ** jvar " << jvar << " " << nvars
@@ -301,21 +320,19 @@ void Interpolator::applyAD(const oops::Variables& vars, Increment& inc,
301
320
}
302
321
}
303
322
323
+ // halo exchange update ghost points DJL
324
+ geom->functionSpace ().haloExchange (inc.incrementFields ()[gv_varname]);
304
325
305
326
// atlas::field::MissingValue mv(inc.incrementFields()[gv_varname]);
306
327
// bool has_mv = static_cast<bool>(mv);
307
328
interpolator_.execute_adjoint (inc.incrementFields ()[gv_varname], tgt_field);
308
329
309
330
} // jvar
310
331
311
- // DJL write to file
312
-
313
- // boost::uuids::uuid uuid = boost::uuids::random_generator()();
314
- // std::shared_ptr<const Geometry> geom = inc.geometry();
315
- // std::ostringstream out;
316
- // out << std::setfill('0') << std::setw(6) << uuid;
317
- // writeGenFieldsToFile("applyAD"+ boost::uuids::to_string(uuid) +".nc", *geom, inc.validTime(), inc.incrementFields());
318
- // fileCounter_++;
332
+ // DJL write debug fields to file
333
+ // boost::uuids::uuid uuid = boost::uuids::random_generator()();
334
+ // std::shared_ptr<const Geometry> geom = inc.geometry();
335
+ writeFieldsToFile (" applyAD" + boost::uuids::to_string (uuid) +" .nc" , *geom, inc.validTime (), inc.incrementFields ());
319
336
320
337
oops::Log::trace () << " orcamodel::Interpolator::applyAD done "
321
338
<< std::endl;
0 commit comments