Debian Codegraph @

src/atlas/grid/detail/tiles/TilesFactory.cc

raw
1 /*
2 * (C) Crown Copyright 2021, Met Office
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 * In applying this licence, ECMWF does not waive the privileges and immunities
7 * granted to it by virtue of its status as an intergovernmental organisation
8 * nor does it submit to any jurisdiction.
9 */
10
11 #include <string>
12
13 #include "atlas/grid/detail/tiles/FV3Tiles.h"
14 #include "atlas/grid/detail/tiles/LFRicTiles.h"
15 #include "atlas/grid/detail/tiles/Tiles.h"
16 #include "atlas/grid/detail/tiles/TilesFactory.h"
17 #include "atlas/util/Factory.h"
18
19 namespace atlas {
20 namespace grid {
21 namespace detail {
22
23 //----------------------------------------------------------------------------------------------------------------------
24
25 namespace {
26 void force_link() {
27 static struct Link {
28 Link() {
29 CubedSphereTilesBuilder<FV3CubedSphereTiles>();
30 CubedSphereTilesBuilder<LFRicCubedSphereTiles>();
31 }
32 } link;
33 }
34 } // namespace
35
36 //----------------------------------------------------------------------------------------------------------------------
37
38 const CubedSphereTiles* CubedSphereTilesFactory::build(const std::string& builder) {
39 return build(builder, util::NoConfig());
40 }
41
42 const CubedSphereTiles* CubedSphereTilesFactory::build(const std::string& builder,
43 const eckit::Parametrisation& param) {
44 force_link();
45 auto factory = get(builder);
46 return factory->make(param);
47 }
48
49 //----------------------------------------------------------------------------------------------------------------------
50
51 } // namespace detail
52 } // namespace grid
53 } // namespace atlas