From 4b4128aebd02140ac26fc84627d618b70c5e82dc Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 7 Jun 2018 16:24:19 -0400 Subject: [PATCH] [Doc] Note requirement to call modifySpecies and modifyReaction Modifying Reaction and Species objects alone does not affect Kinetics or ThermoPhase objects unless the modified objects are passed back to modifyReaction or modifySpecies. --- include/cantera/kinetics/Kinetics.h | 6 ++++-- include/cantera/thermo/Phase.h | 8 ++++++-- interfaces/cython/cantera/kinetics.pyx | 7 +++++-- interfaces/cython/cantera/thermo.pyx | 4 +++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/cantera/kinetics/Kinetics.h b/include/cantera/kinetics/Kinetics.h index 2b94f2345..2175449cc 100644 --- a/include/cantera/kinetics/Kinetics.h +++ b/include/cantera/kinetics/Kinetics.h @@ -724,10 +724,12 @@ public: virtual void modifyReaction(size_t i, shared_ptr rNew); /** - * Return the Reaction object for reaction *i*. + * Return the Reaction object for reaction *i*. Changes to this object do + * not affect the Kinetics object until the #modifyReaction function is + * called. */ shared_ptr reaction(size_t i); - + shared_ptr reaction(size_t i) const; //! Determine behavior when adding a new reaction that contains species not diff --git a/include/cantera/thermo/Phase.h b/include/cantera/thermo/Phase.h index f2637f247..a5330f799 100644 --- a/include/cantera/thermo/Phase.h +++ b/include/cantera/thermo/Phase.h @@ -713,10 +713,14 @@ public: */ virtual void modifySpecies(size_t k, shared_ptr spec); - //! Return the Species object for the named species. + //! Return the Species object for the named species. Changes to this object + //! do not affect the ThermoPhase object until the #modifySpecies function + //! is called. shared_ptr species(const std::string& name) const; - //! Return the Species object for species whose index is *k*. + //! Return the Species object for species whose index is *k*. Changes to + //! this object do not affect the ThermoPhase object until the + //! #modifySpecies function is called. shared_ptr species(size_t k) const; //! Set behavior when adding a species containing undefined elements to just diff --git a/interfaces/cython/cantera/kinetics.pyx b/interfaces/cython/cantera/kinetics.pyx index d457d0ec3..271369918 100644 --- a/interfaces/cython/cantera/kinetics.pyx +++ b/interfaces/cython/cantera/kinetics.pyx @@ -79,13 +79,16 @@ cdef class Kinetics(_SolutionBase): def reaction(self, int i_reaction): """ Return a `Reaction` object representing the reaction with index - ``i_reaction``. + ``i_reaction``. Changes to this object do not affect the `Kinetics` or + `Solution` object until the `modify_reaction` function is called. """ return wrapReaction(self.kinetics.reaction(i_reaction)) def reactions(self): """ - Return a list of all `Reaction` objects + Return a list of all `Reaction` objects. Changes to these objects do not + affect the `Kinetics` or `Solution` object until the `modify_reaction` + function is called. """ return [self.reaction(i) for i in range(self.n_reactions)] diff --git a/interfaces/cython/cantera/thermo.pyx b/interfaces/cython/cantera/thermo.pyx index ce03fe44d..57ec5e811 100644 --- a/interfaces/cython/cantera/thermo.pyx +++ b/interfaces/cython/cantera/thermo.pyx @@ -435,7 +435,9 @@ cdef class ThermoPhase(_SolutionBase): """ Return the `Species` object for species *k*, where *k* is either the species index or the species name. If *k* is not specified, a list of - all species objects is returned. + all species objects is returned. Changes to this object do not affect + the `ThermoPhase` or `Solution` object until the `modify_species` + function is called. """ if k is None: return [self.species(i) for i in range(self.n_species)]