14 auto startIt = str.begin();
15 const auto endIt = str.end();
17 while (startIt != endIt && std::isspace(
static_cast<unsigned char>(*startIt))) {
20 if (startIt == endIt) {
23 const auto ritr = std::find_if(str.rbegin(), std::string::const_reverse_iterator(startIt),
24 [](
const unsigned char ch){ return !std::isspace(ch); });
25 return std::string(startIt, ritr.base());
59 std::vector<fourdst::atomic::Species> result;
60 std::stringstream ss{std::string(str)};
66 if (trimmed_name.empty())
continue;
68 auto it = fourdst::atomic::species.find(trimmed_name);
69 if (it != fourdst::atomic::species.end()) {
70 result.push_back(it->second);
73 throw std::runtime_error(
"Unknown species in reaction data: " + std::string(trimmed_name));
88 std::vector<reaction::Reaction> reaction_list;
89 reaction_list.reserve(num_reactions);
91 for (
size_t i = 0; i < num_reactions; ++i) {
92 const auto&[chapter, qValue, coeffs, reverse, label, rpName, reactants_str, products_str] = records[i];
96 const std::string_view label_sv(label, strnlen(label,
sizeof(label)));
97 const std::string_view rpName_sv(rpName, strnlen(rpName,
sizeof(rpName)));
98 const std::string_view reactants_sv(reactants_str, strnlen(reactants_str,
sizeof(reactants_str)));
99 const std::string_view products_sv(products_str, strnlen(products_str,
sizeof(products_str)));
105 coeffs[0], coeffs[1], coeffs[2],
106 coeffs[3], coeffs[4], coeffs[5],
111 reaction_list.emplace_back(