8 #include "boost/format.hpp" 10 #include "../wavepackets/shapes/shape_enum.hpp" 17 template<dim_t D,
class MultiIndex>
25 std::vector<int> occurrences(coeffs.size());
29 while (parser.next()) {
33 for (
int i = 0; i < D; i++) {
34 int entry = parser.lattice_node[i];
36 throw std::runtime_error((boost::format(
"negative index at line %i") % parser.line_number()).str());
39 if (index[i] != entry)
40 throw std::runtime_error((boost::format(
"integer overflow at line %i") % parser.line_number()).str());
46 if (i_slice >= shape->n_slices() || !shape->slice(i_slice).try_find(index, ordinal))
47 throw std::runtime_error((boost::format(
"multi-index at line %i is not element of shape") % parser.line_number()).str());
49 ordinal += shape->slice(i_slice).offset();
51 if (occurrences[ordinal] >= 1)
52 throw std::runtime_error((boost::format(
"duplicate entry at line %i") % parser.line_number()).str());
54 coeffs[ordinal] = parser.coefficients[0];
55 occurrences[ordinal] += 1;
58 for (std::size_t i = 0; i < occurrences.size(); i++) {
59 if (occurrences[i] == 0) {
60 throw std::runtime_error((boost::format(
"missing entry for lattice node: %s") % shape->at(i)).str());
Definition: coefficients_file_parser.cpp:10
Eigen::Matrix< complex_t, Eigen::Dynamic, 1 > Coefficients
Definition: types.hpp:33
Definition: hawp_coeffs_loader.hpp:18
Coefficients operator()(std::shared_ptr< ShapeEnum< D, MultiIndex > > shape, std::string filename)
Definition: hawp_coeffs_loader.hpp:21
Definition: coefficients_file_parser.hpp:10