Skip to content

Commit

Permalink
[Kinetics] Make ReactionRateFactory more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Oct 8, 2021
1 parent 9112600 commit ee300f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/cantera/kinetics/ReactionRateFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,14 @@ shared_ptr<ReactionRateBase> newReactionRate(
*/
shared_ptr<ReactionRateBase> newReactionRate(const AnyMap& rate_node);

//! Create a new Rate object using the specified parameters
/*!
* @param rate_node AnyMap node describing reaction rate.
* @param rate_units Vector describing unit system of the reaction rate; each element
* specifies Unit and exponent applied to the unit.
*/
shared_ptr<ReactionRateBase> newReactionRate(
const AnyMap& rate_node, const std::vector<std::pair<Units, double>>& rate_units);

}
#endif
6 changes: 6 additions & 0 deletions src/kinetics/ReactionRateFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,10 @@ shared_ptr<ReactionRateBase> newReactionRate(const AnyMap& rate_node)
return newReactionRate(node, Units(0.));
}

shared_ptr<ReactionRateBase> newReactionRate(
const AnyMap& rate_node, const std::vector<std::pair<Units, double>>& rate_units)
{
return newReactionRate(rate_node, Units::product(rate_units));
}

}

0 comments on commit ee300f9

Please sign in to comment.