Debian Codegraph @

src/atlas/option/Options.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 "Options.h"
12
13 #include "atlas/runtime/Exception.h"
14 #include "atlas/util/Earth.h"
15
16 // ----------------------------------------------------------------------------
17
18 namespace atlas {
19 namespace option {
20
21 type::type(const std::string& _type) {
22 set("type", _type);
23 }
24
25 halo::halo(size_t size) {
26 set("halo", size);
27 }
28
29 datatype::datatype(DataType::kind_t kind) {
30 set("datatype", kind);
31 }
32
33 datatype::datatype(const std::string& str) {
34 set("datatype", DataType::str_to_kind(str));
35 }
36
37 datatype::datatype(DataType dtype) {
38 set("datatype", dtype.kind());
39 }
40
41 name::name(const std::string& _name) {
42 set("name", _name);
43 }
44
45 global::global(size_t _owner) {
46 set("global", true);
47 set("owner", _owner);
48 }
49
50 levels::levels(size_t _levels) {
51 set("levels", _levels);
52 }
53
54 variables::variables(size_t _variables) {
55 set("variables", _variables);
56 }
57
58 vector::vector(size_t _components) {
59 set("variables", _components);
60 set("type", "vector");
61 }
62
63 vector_component::vector_component(const std::string& vector_field_name, size_t index) {
64 const auto conf = util::Config("vector_field_name", vector_field_name) | util::Config("index", index);
65 set("vector_component", conf);
66 }
67
68 radius::radius(double _radius) {
69 set("radius", _radius);
70 }
71
72 radius::radius(const std::string& key) {
73 if (key == "Earth") {
74 set("radius", util::Earth::radius());
75 }
76 else {
77 ATLAS_NOTIMPLEMENTED;
78 }
79 }
80
81 pole_edges::pole_edges(bool _pole_edges) {
82 set("pole_edges", _pole_edges);
83 }
84
85 alignment::alignment(int value) {
86 set("alignment", value);
87 }
88
89 on_device::on_device() {
90 set("execution_space", "device");
91 }
92
93 // ----------------------------------------------------------------------------
94
95 } // namespace option
96 } // namespace atlas