Debian Codegraph @

src/atlas/meshgenerator/MeshGenerator.cc

raw
1 /*
2 * (C) Copyright 2013 ECMWF.
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/Distribution.h"
14 #include "atlas/grid/Grid.h"
15 #include "atlas/mesh/Mesh.h"
16 #include "atlas/meshgenerator/MeshGenerator.h"
17 #include "atlas/runtime/Exception.h"
18
19 #include "atlas/meshgenerator/detail/MeshGeneratorFactory.h"
20 #include "atlas/meshgenerator/detail/MeshGeneratorImpl.h"
21
22 using atlas::Mesh;
23
24 namespace atlas {
25
26 //----------------------------------------------------------------------------------------------------------------------
27
28 MeshGenerator::MeshGenerator(const std::string& key, const eckit::Parametrisation& config):
29 Handle(meshgenerator::MeshGeneratorFactory::build(key, config)) {}
30
31 MeshGenerator::MeshGenerator(const eckit::Parametrisation& config):
32 Handle(meshgenerator::MeshGeneratorFactory::build(
33 [&config]() {
34 std::string key;
35 ATLAS_ASSERT(config.get("type", key), "type must be specified in MeshGenerator configuration");
36 return key;
37 }(),
38 config)) {}
39
40 void MeshGenerator::hash(eckit::Hash& h) const {
41 get()->hash(h);
42 }
43
44 Mesh MeshGenerator::generate(const Grid& g, const grid::Distribution& d) const {
45 return get()->generate(g, d);
46 }
47 Mesh MeshGenerator::generate(const Grid& g, const grid::Partitioner& p) const {
48 return get()->generate(g, p);
49 }
50 Mesh MeshGenerator::generate(const Grid& g) const {
51 return get()->generate(g);
52 }
53
54 Mesh MeshGenerator::operator()(const Grid& g, const grid::Distribution& d) const {
55 return get()->operator()(g, d);
56 }
57 Mesh MeshGenerator::operator()(const Grid& g, const grid::Partitioner& p) const {
58 return get()->operator()(g, p);
59 }
60 Mesh MeshGenerator::operator()(const Grid& g) const {
61 return get()->operator()(g);
62 }
63
64 std::string MeshGenerator::type() const {
65 return get()->type();
66 }
67
68 //----------------------------------------------------------------------------------------------------------------------
69
70 } // namespace atlas