UFO
LinearObsOperatorBase.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2017-2018 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 
9 
10 #include "eckit/config/Configuration.h"
11 #include "ioda/ObsSpace.h"
12 #include "oops/util/abor1_cpp.h"
13 #include "oops/util/Logger.h"
14 
15 namespace ufo {
16 
17 // -----------------------------------------------------------------------------
18 
20  if (getMakers().find(name) != getMakers().end()) {
21  oops::Log::error() << name << " already registered in ufo::LinearObsOperatorFactory."
22  << std::endl;
23  ABORT("Element already registered in ufo::LinearObsOperatorFactory.");
24  }
25  getMakers()[name] = this;
26 }
27 
28 // -----------------------------------------------------------------------------
29 
31  const eckit::Configuration & conf) {
32  oops::Log::trace() << "LinearObsOperatorBase::create starting" << std::endl;
33 
34  std::string id;
35 
36  id = conf.getString("name");
37 
38  typename std::map<std::string, LinearObsOperatorFactory*>::iterator jloc = getMakers().find(id);
39  if (jloc == getMakers().end()) {
40  oops::Log::error() << id << " does not exist in ufo::LinearObsOperatorFactory." << std::endl;
41  ABORT("Element does not exist in ufo::LinearObsOperatorFactory.");
42  }
43  LinearObsOperatorBase * ptr = jloc->second->make(odb, conf);
44  oops::Log::trace() << "LinearObsOperatorBase::create done" << std::endl;
45  return ptr;
46 }
47 
48 // -----------------------------------------------------------------------------
49 
50 } // namespace ufo
ufo::LinearObsOperatorFactory::LinearObsOperatorFactory
LinearObsOperatorFactory(const std::string &)
Definition: LinearObsOperatorBase.cc:19
LinearObsOperatorBase.h
ufo
Definition: RunCRTM.h:27
ufo::LinearObsOperatorFactory::create
static LinearObsOperatorBase * create(const ioda::ObsSpace &, const eckit::Configuration &)
Definition: LinearObsOperatorBase.cc:30
ufo::LinearObsOperatorBase
Base class for observation operators.
Definition: LinearObsOperatorBase.h:35
conf
Definition: conf.py:1
ufo::LinearObsOperatorFactory::getMakers
static std::map< std::string, LinearObsOperatorFactory * > & getMakers()
Definition: LinearObsOperatorBase.h:63