flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY
loop_library.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 <cstdlib>
20#include <memory>
21
22#include "config.h"
23#include "logger.hpp"
24#include "loop_library.hpp"
26
27#include "library_softsusy.hpp"
28
29#ifdef ENABLE_COLLIER
30#include "library_collier.hpp"
31#define COLLIER_INFO ", 1 (=COLLIER)"
32#else
33#define COLLIER_INFO
34#endif // ENABLE_COLLIER
35
36#ifdef ENABLE_LOOPTOOLS
37#include "library_looptools.hpp"
38#define LOOPTOOLS_INFO ", 2 (=LoopTools)"
39#else
40#define LOOPTOOLS_INFO
41#endif // ENABLE_LOOPTOOLS
42
43#ifdef ENABLE_FFLITE
44#include "library_fflite.hpp"
45#define FFLITE_INFO ", 3 (=fflite)"
46#else
47#define FFLITE_INFO
48#endif // ENABLE_FFLITE
49
50#define STRINGIFY(X) #X
51#define TOSTR(MACROS) STRINGIFY(MACROS)
52
53namespace flexiblesusy
54{
55
57std::unique_ptr<looplibrary::Loop_library_interface> Loop_library::lib_;
58
60{
61 Loop_library::lib_ = std::make_unique<looplibrary::Softsusy>();
63 VERBOSE_MSG("Enabling softsusy.");
64}
65
66void Loop_library::set(int new_type)
67{
69 if (new_type == -1) {
70 if (const char* flag = std::getenv("FLEXIBLESUSY_LOOP_LIBRARY")) {
71 new_type = std::atoi(flag);
72 VERBOSE_MSG("Setting looplibrary using environment variable "
73 << "FLEXIBLESUSY_LOOP_LIBRARY=" << new_type);
74 }
75 }
76 switch (new_type) {
77 case 0:
79 break;
80#ifdef ENABLE_COLLIER
81 case 1:
82 Loop_library::lib_ = std::make_unique<looplibrary::Collier>();
84 VERBOSE_MSG("Enabling COLLIER.");
85 break;
86#endif // ENABLE_COLLIER
87#ifdef ENABLE_LOOPTOOLS
88 case 2:
89 Loop_library::lib_ = std::make_unique<looplibrary::Looptools>();
91 VERBOSE_MSG("Enabling LoopTools.");
92 break;
93#endif // ENABLE_LOOPTOOLS
94#ifdef ENABLE_FFLITE
95 case 3:
96 Loop_library::lib_ = std::make_unique<looplibrary::Fflite>();
98 VERBOSE_MSG("Enabling FFlite.");
99 break;
100#endif // ENABLE_FFLITE
101 default:
102 ERROR("Warning: Check FlexibleSUSY[31] or FLEXIBLESUSY_LOOP_LIBRARY:\n"
103 "Currently configured values are 0 (=softsusy)" COLLIER_INFO
105 "Setting default library.");
107 break;
108 }
109 }
110}
111
113{
114 return type_;
115}
116
118{
120 ERROR("Loop library should be initialized before first usage.\n"
121 "Setting the library according to the FLEXIBLESUSY_LOOP_LIBRARY env variable.");
123 }
124 return *Loop_library::lib_;
125}
126
127} // namespace flexiblesusy
static looplibrary::Loop_library_interface & get()
static std::unique_ptr< looplibrary::Loop_library_interface > lib_
interface for different one loop function libraries with conventions of DE == [arXiv:0709....
#define ERROR(msg)
Definition: logger.hpp:65
#define VERBOSE_MSG(msg)
Definition: logger.hpp:57
#define LOOPTOOLS_INFO
#define COLLIER_INFO
#define FFLITE_INFO