FV3 Bundle
ObsOpBaseQG.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 
8 #include "model/ObsOpBaseQG.h"
9 
10 #include "eckit/config/Configuration.h"
11 #include "oops/util/abor1_cpp.h"
12 #include "oops/util/Logger.h"
13 
14 namespace qg {
15 
16 // -----------------------------------------------------------------------------
17 
18 ObsOpFactory::ObsOpFactory(const std::string & name) {
19  if (getMakers().find(name) != getMakers().end()) {
20  oops::Log::error() << name << " already registered in qg::ObsOpFactory." << std::endl;
21  ABORT("Element already registered in ObsOpFactory.");
22  }
23  getMakers()[name] = this;
24 }
25 
26 // -----------------------------------------------------------------------------
27 
29  const eckit::Configuration & conf) {
30  oops::Log::trace() << "ObsOpBaseQG::create starting" << std::endl;
31  oops::Log::debug() << "ObsOpBaseQG::create conf" << conf << std::endl;
32  const std::string id = conf.getString("ObsType");
33  typename std::map<std::string, ObsOpFactory*>::iterator
34  jloc = getMakers().find(id);
35  if (jloc == getMakers().end()) {
36  oops::Log::error() << id << " does not exist in observation operator factory." << std::endl;
37  ABORT("Element does not exist in ObsOpFactory.");
38  }
39  ObsOpBaseQG * ptr = jloc->second->make(odb, conf);
40  oops::Log::trace() << "ObsOpBaseQG::create done" << std::endl;
41  return ptr;
42 }
43 
44 // -----------------------------------------------------------------------------
45 
46 } // namespace qg
Base class for observation operators.
Definition: ObsOpBaseQG.h:30
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT end
Definition: conf.py:1
static std::map< std::string, ObsOpFactory *> & getMakers()
Definition: ObsOpBaseQG.h:57
character(len=32) name
static ObsOpBaseQG * create(const ObsSpaceQG &, const eckit::Configuration &)
Definition: ObsOpBaseQG.cc:28
logical debug
Definition: mpp.F90:1297
integer error
Definition: mpp.F90:1310
Wrapper around ObsHelpQG, mostly to hide the factory.
Definition: ObsSpaceQG.h:35
ObsOpFactory(const std::string &)
Definition: ObsOpBaseQG.cc:18
The namespace for the qg model.