Loading...
Searching...
No Matches
factory.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * create_interpolation_exporter — resolve an export format name to its
5 * InterpolationExporter. "none" and the empty string are the Null object, so
6 * a call site exports unconditionally; an unknown name is refused with the
7 * list of known ones. Mirrors create_mean_field_exporter().
8 */
9
10#include <memory>
11#include <stdexcept>
12#include <string>
13
17
18namespace q3 {
19
20[[nodiscard]] inline std::unique_ptr<InterpolationExporter>
21create_interpolation_exporter(const std::string& format) {
22 if (format.empty() || format == "none") {
23 return std::make_unique<NullInterpolationExporter>();
24 }
25 if (format == "wannier90") {
26 return std::make_unique<Wannier90Exporter>();
27 }
28 throw std::runtime_error("Unknown interpolation export format '" + format +
29 "'. Supported: none, wannier90");
30}
31
32} // namespace q3
std::unique_ptr< InterpolationExporter > create_interpolation_exporter(const std::string &format)
Definition factory.hpp:21