flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY
settings.cpp
Go to the documentation of this file.
1// ====================================================================
2// This file is part of FlexibleSUSY.
3//
4// FlexibleSUSY is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published
6// by the Free Software Foundation, either version 3 of the License,
7// or (at your option) any later version.
8//
9// FlexibleSUSY is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with FlexibleSUSY. If not, see
16// <http://www.gnu.org/licenses/>.
17// ====================================================================
18
19#include "settings.hpp"
20#include "error.hpp"
21#include "string_format.hpp"
22
23#include <cmath>
24#include <iostream>
25#include <string>
26
27namespace flexiblesusy {
28
29namespace {
30const std::array<std::string, LToLConversion_settings::NUMBER_OF_OPTIONS> descriptions = {
31 "include tensor contribution",
32 "include gluonic contribution",
33 "scalar form factor G^S_{p,u} without masses",
34 "scalar form factor G^S_{n,u} without masses",
35 "scalar form factor G^S_{p,d} without masses",
36 "scalar form factor G^S_{n,d} without masses",
37 "scalar form factor G^S_{p,s} without masses",
38 "scalar form factor G^T_{n,s} without masses",
39 "vector form factor G^V_{p,u}",
40 "vector form factor G^V_{n,u}",
41 "vector form factor G^V_{p,d}",
42 "vector form factor G^V_{n,d}",
43 "tensor form factor G^T_{p,u}",
44 "tensor form factor G^T_{n,u}",
45 "tensor form factor G^T_{p,d}",
46 "tensor form factor G^T_{n,d}",
47 "tensor form factor G^T_{p,s}",
48 "tensor form factor G^T_{n,s}"
49};
50
51void assert_bool(double value, const char* quantity)
52{
53 if (value != 0.0 && value != 1.0) {
54 throw SetupError(std::string(quantity) + " must be either 0 or 1");
55 }
56}
57
58} // anonymous namespace
59
67{
68 reset();
69}
70
72{
73 return values.at(o);
74}
75
77{
78 Settings_t s(&values[0]);
79 return s;
80}
81
83{
84 return descriptions.at(o);
85}
86
88{
89 switch (o) {
90 case include_tensor_contribution: // [bool]
91 assert_bool(value, descriptions.at(o).c_str());
92 break;
93 case include_gluonic_contribution: // [bool]
94 assert_bool(value, descriptions.at(o).c_str());
95 break;
96 default:
97 break;
98 }
99
100 values.at(o) = value;
101}
102
104{
105 std::copy(s.data(), s.data() + s.size(), values.begin());
106}
107
118{
121 values[scalar_pu] = 0.021;
122 values[scalar_nu] = 0.019;
123 values[scalar_pd] = 0.041;
124 values[scalar_nd] = 0.045;
125 values[scalar_ps] = 0.043;
126 values[scalar_ns] = 0.043;
127 values[vector_pu] = 2.0;
128 values[vector_nu] = 1.0;
129 values[vector_pd] = 1.0;
130 values[vector_nd] = 2.0;
131 values[tensor_pu] = 0.77;
132 values[tensor_nu] = -0.23;
133 values[tensor_pd] = -0.23;
134 values[tensor_nd] = 0.77;
135 values[tensor_ps] = 0.008;
136 values[tensor_ns] = 0.008;
137}
138
139} // namespace flexiblesusy
Settings_t get() const
get all settings
Definition: settings.cpp:76
void reset()
resets all settings to defaults
Definition: settings.cpp:117
std::string get_description(Settings) const
get description
Definition: settings.cpp:82
std::array< double, NUMBER_OF_OPTIONS > values
settings
Definition: settings.hpp:56
void set(Settings, double)
set value of setting
Definition: settings.cpp:87
Eigen::Array< double, NUMBER_OF_OPTIONS, 1 > Settings_t
Definition: settings.hpp:44
Settings
LToLConversion settings.
Definition: settings.hpp:30
Spectrum generator was not setup correctly.
Definition: error.hpp:46
void assert_bool(double value, const char *quantity)
Definition: settings.cpp:51
const std::array< std::string, LToLConversion_settings::NUMBER_OF_OPTIONS > descriptions
Definition: settings.cpp:30