From dc66407cf201518f5d9ffc6ddade46a40d572a12 Mon Sep 17 00:00:00 2001 From: Ingmar Schoegl Date: Tue, 22 Oct 2019 13:44:50 -0500 Subject: [PATCH] [Thermo] address code review comments --- include/cantera/base/Solution.h | 6 +++--- include/cantera/thermo/Phase.h | 4 ++-- interfaces/cython/cantera/base.pyx | 5 +---- interfaces/cython/cantera/transport.pyx | 2 -- src/thermo/Phase.cpp | 12 ++++-------- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/include/cantera/base/Solution.h b/include/cantera/base/Solution.h index 50c8979e3..bf886a95d 100644 --- a/include/cantera/base/Solution.h +++ b/include/cantera/base/Solution.h @@ -61,9 +61,9 @@ public: } protected: - shared_ptr m_thermo; //! ThermoPhase manager - shared_ptr m_kinetics; //! Kinetics manager - shared_ptr m_transport; //! Transport manager + shared_ptr m_thermo; //!< ThermoPhase manager + shared_ptr m_kinetics; //!< Kinetics manager + shared_ptr m_transport; //!< Transport manager }; } diff --git a/include/cantera/thermo/Phase.h b/include/cantera/thermo/Phase.h index 86288ebfe..48635dc4c 100644 --- a/include/cantera/thermo/Phase.h +++ b/include/cantera/thermo/Phase.h @@ -68,8 +68,8 @@ class Solution; * operate on a state vector, which is in general of length (2 + nSpecies()). * The first two entries of the state vector are temperature and density. * - * A species name is referred to via "speciesName", which is unique within a - * given phase. Note that within multiphase mixtures ("MultiPhase"), both a + * A species name is referred to via speciesName(), which is unique within a + * given phase. Note that within multiphase mixtures (MultiPhase()), both a * phase name/index as well as species name are required to access information * about a species in a particular phase. For surfaces, the species names are * unique among the phases. diff --git a/interfaces/cython/cantera/base.pyx b/interfaces/cython/cantera/base.pyx index 3609ba25a..6444a4c56 100644 --- a/interfaces/cython/cantera/base.pyx +++ b/interfaces/cython/cantera/base.pyx @@ -70,16 +70,13 @@ cdef class _SolutionBase: if isinstance(self, Transport): assert self.transport is not NULL - phase_name = pystr(self.base.name()) name = kwargs.get('name') if name is not None: self.name = name - else: - self.name = phase_name property name: """ - The name assigned to this object. The default value corresponds + The name assigned to this object. The default value corresponds to the CTI/XML/YAML input file phase entry. """ def __get__(self): diff --git a/interfaces/cython/cantera/transport.pyx b/interfaces/cython/cantera/transport.pyx index 82fa37aca..b9b0bb24e 100644 --- a/interfaces/cython/cantera/transport.pyx +++ b/interfaces/cython/cantera/transport.pyx @@ -145,8 +145,6 @@ cdef class Transport(_SolutionBase): self.transport = newTransportMgr(stringify(model), self.thermo) self._transport.reset(self.transport) - base_type = kwargs.pop('base_type', 'Transport') - kwargs['base_type'] = base_type super().__init__(*args, **kwargs) self.base.setTransport(self._transport) diff --git a/src/thermo/Phase.cpp b/src/thermo/Phase.cpp index 3e827e980..2c18552e3 100644 --- a/src/thermo/Phase.cpp +++ b/src/thermo/Phase.cpp @@ -69,16 +69,14 @@ void Phase::setXMLdata(XML_Node& xmlPhase) std::string Phase::id() const { warn_deprecated("Phase::id", - "To be removed after Cantera 2.5. " - "Usage merged with 'Phase::name'"); + "To be removed after Cantera 2.5. Usage merged with 'Phase::name'"); return m_id; } void Phase::setID(const std::string& id_) { warn_deprecated("Phase::setID", - "To be removed after Cantera 2.5. " - "Usage merged with 'Phase::setName'"); + "To be removed after Cantera 2.5. Usage merged with 'Phase::setName'"); m_id = id_; m_name = id_; } @@ -215,10 +213,8 @@ size_t Phase::speciesIndex(const std::string& nameStr) const std::string sn = parseSpeciesName(nameStr, pn); if (pn == "" || pn == m_name || pn == m_id) { warn_deprecated("Phase::speciesIndex()", - "Retrieval of species indices via " - "'PhaseId:speciesName' or 'phaseName:" - "speciesName to be removed " - "after Cantera 2.5."); + "Retrieval of species indices via 'PhaseId:speciesName' or " + "'phaseName:speciesName' to be removed after Cantera 2.5."); it = m_speciesIndices.find(nameStr); if (it != m_speciesIndices.end()) { return it->second;