14 auto startIt = str.begin();
15 auto endIt = str.end();
17 while (startIt != endIt && std::isspace(
static_cast<unsigned char>(*startIt))) {
20 if (startIt == endIt) {
23 auto ritr = std::find_if(str.rbegin(), std::string::const_reverse_iterator(startIt),
24 [](
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& record = records[i];
96 const std::string_view label_sv(record.label, strnlen(record.label,
sizeof(record.label)));
97 const std::string_view rpName_sv(record.rpName, strnlen(record.rpName,
sizeof(record.rpName)));
98 const std::string_view reactants_sv(record.reactants_str, strnlen(record.reactants_str,
sizeof(record.reactants_str)));
99 const std::string_view products_sv(record.products_str, strnlen(record.products_str,
sizeof(record.products_str)));
105 record.coeffs[0], record.coeffs[1], record.coeffs[2],
106 record.coeffs[3], record.coeffs[4], record.coeffs[5],
111 reaction_list.emplace_back(