-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathradial_factory.hpp
More file actions
85 lines (68 loc) · 2.52 KB
/
Copy pathradial_factory.hpp
File metadata and controls
85 lines (68 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#pragma once
#include <integratorxx/quadratures/radial.hpp>
namespace IntegratorXX {
/// High-level specification of radial quadratures
enum class RadialQuad : uint32_t {
Becke = 0x0010,
MurrayHandyLaming = 0x0020,
MuraKnowles = 0x0030,
TreutlerAhlrichs = 0x0040
};
template <typename RadQuadType>
RadialQuad radial_from_type() {
if constexpr (detail::is_becke_v<RadQuadType>) return RadialQuad::Becke;
if constexpr (detail::is_mk_v<RadQuadType> ) return RadialQuad::MuraKnowles;
if constexpr (detail::is_mhl_v<RadQuadType>) return RadialQuad::MurrayHandyLaming;
if constexpr (detail::is_ta_v<RadQuadType>) return RadialQuad::TreutlerAhlrichs;
throw std::runtime_error("Unrecognized Radial Quadrature");
};
RadialQuad radial_from_string(std::string name);
namespace detail {
template <typename RadialTraitsType, typename... Args>
std::unique_ptr<RadialTraits> make_radial_traits(Args&&... args) {
using traits_type = RadialTraitsType;
if constexpr (std::is_constructible_v<traits_type,Args...>)
return std::make_unique<traits_type>(std::forward<Args>(args)...);
else return nullptr;
}
}
template <typename... Args>
std::unique_ptr<RadialTraits> make_radial_traits(RadialQuad rq, Args&&... args) {
std::unique_ptr<RadialTraits> ptr;
switch(rq) {
case RadialQuad::Becke:
ptr =
detail::make_radial_traits<BeckeRadialTraits>(std::forward<Args>(args)...);
break;
case RadialQuad::MurrayHandyLaming:
ptr =
detail::make_radial_traits<MurrayHandyLamingRadialTraits<2>>(std::forward<Args>(args)...);
break;
case RadialQuad::MuraKnowles:
ptr =
detail::make_radial_traits<MuraKnowlesRadialTraits>(std::forward<Args>(args)...);
break;
case RadialQuad::TreutlerAhlrichs:
ptr =
detail::make_radial_traits<TreutlerAhlrichsRadialTraits>(std::forward<Args>(args)...);
break;
}
if(!ptr) throw std::runtime_error("RadialTraits Construction Failed");
return ptr;
}
struct RadialFactory {
using radial_grid_ptr = std::shared_ptr<
QuadratureBase<
std::vector<double>,
std::vector<double>
>
>;
static radial_grid_ptr generate(RadialQuad rq, const RadialTraits& traits);
};
}
// Header-only builds carry the implementation with the declarations. This is
// included last so that the declarations above are already visible; the impl
// headers include this one back, which #pragma once makes a no-op.
#ifdef INTEGRATORXX_HEADER_ONLY
#include <integratorxx/generators/impl/radial_factory.hpp>
#endif