10 #include <yaml-cpp/yaml.h> 12 #include "../wavepackets/shapes/shape_commons.hpp" 22 if (config[
"dimensionality"].as<int>() != D) {
23 throw std::runtime_error(
"encountered shape dimensionality != requested shape dimensionality");
26 std::string type = config[
"type"].as<std::string>();
28 if (type ==
"hyperbolic") {
29 int sparsity = int(config[
"sparsity"].as<double>()+0.5);
31 if (config[
"limits"]) {
32 return new LimitedHyperbolicCutShape<D>(sparsity,
decode_limits(config[
"limits"]));
35 return new HyperbolicCutShape<D>(sparsity);
38 else if (type ==
"hypercubic") {
39 return new HyperCubicShape<D>(
decode_limits(config[
"limits"]));
42 throw std::runtime_error(
"unknown shape type");
48 std::array<int,D> limits;
50 if (node.size() != D) {
51 throw std::runtime_error(
"size of limits != shape dimensionality");
54 for (std::size_t i = 0; i < node.size(); i++) {
55 limits[i] = node[i].as<
int>();
Definition: coefficients_file_parser.cpp:10
std::array< int, D > decode_limits(YAML::Node const &node)
Definition: shape_decoder.hpp:46
AbstractShape< D > * operator()(YAML::Node const &config)
Definition: shape_decoder.hpp:20
Definition: shape_decoder.hpp:18