| 226 | } |
| 227 | |
| 228 | void Reaction::getParameters(AnyMap& reactionNode) const |
| 229 | { |
| 230 | if (!m_rate) { |
| 231 | throw CanteraError("Reaction::getParameters", |
| 232 | "Serialization of empty Reaction object is not supported."); |
| 233 | } |
| 234 | |
| 235 | reactionNode["equation"] = equation(); |
| 236 | |
| 237 | if (duplicate) { |
| 238 | reactionNode["duplicate"] = true; |
| 239 | } else { |
| 240 | reactionNode.exclude("duplicate"); |
| 241 | } |
| 242 | if (orders.size()) { |
| 243 | reactionNode["orders"] = orders; |
| 244 | } else { |
| 245 | reactionNode.exclude("orders"); |
| 246 | } |
| 247 | if (allow_negative_orders) { |
| 248 | reactionNode["negative-orders"] = true; |
| 249 | } else { |
| 250 | reactionNode.exclude("negative-orders"); |
| 251 | } |
| 252 | if (allow_nonreactant_orders) { |
| 253 | reactionNode["nonreactant-orders"] = true; |
| 254 | } else { |
| 255 | reactionNode.exclude("nonreactant-orders"); |
| 256 | } |
| 257 | |
| 258 | reactionNode.update(m_rate->parameters()); |
| 259 | |
| 260 | // strip information not needed for reconstruction |
| 261 | string rtype = reactionNode["type"].asString(); |
| 262 | if (rtype == "pressure-dependent-Arrhenius") { |
| 263 | // skip |
| 264 | } else if (m_explicit_type && ba::ends_with(rtype, "Arrhenius")) { |
| 265 | // retain type information |
| 266 | if (m_third_body) { |
| 267 | reactionNode["type"] = "three-body"; |
| 268 | } else { |
| 269 | reactionNode["type"] = "elementary"; |
| 270 | } |
| 271 | } else if (ba::ends_with(rtype, "Arrhenius")) { |
| 272 | reactionNode.exclude("type"); |
| 273 | } else if (m_explicit_type) { |
| 274 | reactionNode["type"] = type(); |
| 275 | } else if (ba::ends_with(rtype, "Blowers-Masel")) { |
| 276 | reactionNode["type"] = "Blowers-Masel"; |
| 277 | } |
| 278 | |
| 279 | if (m_third_body) { |
| 280 | m_third_body->getParameters(reactionNode); |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | void Reaction::setParameters(const AnyMap& node, const Kinetics& kin) |
| 285 | { |
nothing calls this directly
no test coverage detected