From 31d04f04b031e84041e6c2eda214d2570c3844b9 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Sat, 13 Jun 2015 22:41:37 -0400 Subject: [PATCH] [Thermo] Remove unnecessary copy constructors & assignment operators These just did the same thing as the compiler-generated ones, so there's no reason for these to exist. --- include/cantera/matlab.h | 34 ++++++++++++++ include/cantera/thermo/AdsorbateThermo.h | 11 +---- include/cantera/thermo/ConstCpPoly.h | 6 --- include/cantera/thermo/Mu0Poly.h | 6 --- include/cantera/thermo/Nasa9Poly1.h | 12 ----- include/cantera/thermo/NasaPoly1.h | 25 +---------- include/cantera/thermo/NasaPoly2.h | 27 ------------ include/cantera/thermo/ShomatePoly.h | 56 +----------------------- src/thermo/ConstCpPoly.cpp | 23 ---------- src/thermo/Mu0Poly.cpp | 27 ------------ src/thermo/Nasa9Poly1.cpp | 18 +------- 11 files changed, 39 insertions(+), 206 deletions(-) create mode 100644 include/cantera/matlab.h diff --git a/include/cantera/matlab.h b/include/cantera/matlab.h new file mode 100644 index 000000000..2582b7075 --- /dev/null +++ b/include/cantera/matlab.h @@ -0,0 +1,34 @@ +/** + * @file ctxml.h + */ +#ifndef CTC_XML_H +#define CTC_XML_H + +#include + +int xml_new(const char* name); +int xml_get_XML_File(const char* file, int debug); +int xml_del(int i); +int xml_clear(); +int xml_copy(int i); +int xml_assign(int i, int j); +int xml_build(int i, const char* file); +int xml_preprocess_and_build(int i, const char* file, int debug); +int xml_attrib(int i, const char* key, char* value); +int xml_addAttrib(int i, const char* key, const char* value); +int xml_addComment(int i, const char* comment); +int xml_value(int i, char* value); +int xml_tag(int i, char* tag); +int xml_child(int i, const char* loc); +int xml_child_bynumber(int i, int m); +int xml_findID(int i, const char* id); +int xml_findByName(int i, const char* nm); +int xml_nChildren(int i); +int xml_addChild(int i, const char* name, const char* value); +int xml_addChildNode(int i, int j); +int xml_write(int i, const char* file); +int xml_removeChild(int i, int j); +int ctml_getFloatArray(int i, size_t n, double* data, int iconvert); + +#endif + diff --git a/include/cantera/thermo/AdsorbateThermo.h b/include/cantera/thermo/AdsorbateThermo.h index 636b216cb..0a8aca488 100644 --- a/include/cantera/thermo/AdsorbateThermo.h +++ b/include/cantera/thermo/AdsorbateThermo.h @@ -69,18 +69,9 @@ public: std::copy(coeffs+2, coeffs + 2 + m_nFreqs, m_freq.begin()); } - /// Copy Constructor - Adsorbate(const Adsorbate& b) : - m_be(b.m_be) { - m_nFreqs = b.m_nFreqs; - std::copy(b.m_freq.begin(), b.m_freq.begin() + m_nFreqs, - m_freq.begin()); - } - virtual SpeciesThermoInterpType* duplMyselfAsSpeciesThermoInterpType() const { - Adsorbate* np = new Adsorbate(*this); - return (SpeciesThermoInterpType*) np; + return new Adsorbate(*this); } virtual int reportType() const { diff --git a/include/cantera/thermo/ConstCpPoly.h b/include/cantera/thermo/ConstCpPoly.h index 87e9f5b21..7deb788a1 100644 --- a/include/cantera/thermo/ConstCpPoly.h +++ b/include/cantera/thermo/ConstCpPoly.h @@ -85,12 +85,6 @@ public: */ ConstCpPoly(double tlow, double thigh, double pref, const double* coeffs); - //! copy constructor - ConstCpPoly(const ConstCpPoly&); - - //! Assignment operator - ConstCpPoly& operator=(const ConstCpPoly&); - virtual SpeciesThermoInterpType* duplMyselfAsSpeciesThermoInterpType() const; diff --git a/include/cantera/thermo/Mu0Poly.h b/include/cantera/thermo/Mu0Poly.h index acd3b983f..93acb7f51 100644 --- a/include/cantera/thermo/Mu0Poly.h +++ b/include/cantera/thermo/Mu0Poly.h @@ -131,12 +131,6 @@ public: */ Mu0Poly(double tlow, double thigh, double pref, const double* coeffs); - //! Copy constructor - Mu0Poly(const Mu0Poly&); - - //! Assignment operator - Mu0Poly& operator=(const Mu0Poly&); - virtual SpeciesThermoInterpType* duplMyselfAsSpeciesThermoInterpType() const; diff --git a/include/cantera/thermo/Nasa9Poly1.h b/include/cantera/thermo/Nasa9Poly1.h index ec05dbab9..425e4c7f6 100644 --- a/include/cantera/thermo/Nasa9Poly1.h +++ b/include/cantera/thermo/Nasa9Poly1.h @@ -98,18 +98,6 @@ public: */ Nasa9Poly1(double tlow, double thigh, double pref, const double* coeffs); - //! copy constructor - /*! - * @param b object to be copied - */ - Nasa9Poly1(const Nasa9Poly1& b); - - //! assignment operator - /*! - * @param b object to be copied - */ - Nasa9Poly1& operator=(const Nasa9Poly1& b); - virtual SpeciesThermoInterpType* duplMyselfAsSpeciesThermoInterpType() const; diff --git a/include/cantera/thermo/NasaPoly1.h b/include/cantera/thermo/NasaPoly1.h index cb11698cf..de14641f2 100644 --- a/include/cantera/thermo/NasaPoly1.h +++ b/include/cantera/thermo/NasaPoly1.h @@ -87,32 +87,9 @@ public: { } - //! copy constructor - /*! - * @param b object to be copied - */ - NasaPoly1(const NasaPoly1& b) : - SpeciesThermoInterpType(b), - m_coeff(b.m_coeff) - { - } - - //! assignment operator - /*! - * @param b object to be copied - */ - NasaPoly1& operator=(const NasaPoly1& b) { - if (&b != this) { - SpeciesThermoInterpType::operator=(b); - m_coeff = b.m_coeff; - } - return *this; - } - virtual SpeciesThermoInterpType* duplMyselfAsSpeciesThermoInterpType() const { - NasaPoly1* np = new NasaPoly1(*this); - return (SpeciesThermoInterpType*) np; + return new NasaPoly1(*this); } virtual int reportType() const { diff --git a/include/cantera/thermo/NasaPoly2.h b/include/cantera/thermo/NasaPoly2.h index dff9b39e6..338726202 100644 --- a/include/cantera/thermo/NasaPoly2.h +++ b/include/cantera/thermo/NasaPoly2.h @@ -93,33 +93,6 @@ public: m_coeff(coeffs, coeffs + 15) { } - //! Copy Constructor - /*! - * @param b object to be copied. - */ - NasaPoly2(const NasaPoly2& b) : - SpeciesThermoInterpType(b), - m_midT(b.m_midT), - mnp_low(b.mnp_low), - mnp_high(b.mnp_high), - m_coeff(b.m_coeff) { - } - - //! Assignment operator - /*! - * @param b object to be copied. - */ - NasaPoly2& operator=(const NasaPoly2& b) { - if (&b != this) { - SpeciesThermoInterpType::operator=(b); - m_midT = b.m_midT; - m_coeff = b.m_coeff; - mnp_low = b.mnp_low; - mnp_high = b.mnp_high; - } - return *this; - } - virtual SpeciesThermoInterpType* duplMyselfAsSpeciesThermoInterpType() const { NasaPoly2* np = new NasaPoly2(*this); diff --git a/include/cantera/thermo/ShomatePoly.h b/include/cantera/thermo/ShomatePoly.h index 31c7f768e..50186c359 100644 --- a/include/cantera/thermo/ShomatePoly.h +++ b/include/cantera/thermo/ShomatePoly.h @@ -106,32 +106,9 @@ public: { } - //! copy constructor - /*! - * @param b object to be copied - */ - ShomatePoly(const ShomatePoly& b) : - SpeciesThermoInterpType(b), - m_coeff(b.m_coeff) - { - } - - //! Assignment operator - /*! - * @param b - */ - ShomatePoly& operator=(const ShomatePoly& b) { - if (&b != this) { - SpeciesThermoInterpType::operator=(b); - m_coeff = b.m_coeff; - } - return *this; - } - virtual SpeciesThermoInterpType* duplMyselfAsSpeciesThermoInterpType() const { - ShomatePoly* sp = new ShomatePoly(*this); - return (SpeciesThermoInterpType*) sp; + return new ShomatePoly(*this); } virtual int reportType() const { @@ -361,38 +338,9 @@ public: { } - //! Copy constructor - /*! - * @param b object to be copied. - */ - ShomatePoly2(const ShomatePoly2& b) : - SpeciesThermoInterpType(b), - m_midT(b.m_midT), - msp_low(b.msp_low), - msp_high(b.msp_high), - m_coeff(b.m_coeff) - { - } - - //! Assignment operator - /*! - * @param b object to be copied. - */ - ShomatePoly2& operator=(const ShomatePoly2& b) { - if (&b != this) { - SpeciesThermoInterpType::operator=(b); - m_midT = b.m_midT; - m_coeff = b.m_coeff; - msp_low = b.msp_low; - msp_high = b.msp_high; - } - return *this; - } - virtual SpeciesThermoInterpType* duplMyselfAsSpeciesThermoInterpType() const { - ShomatePoly2* sp = new ShomatePoly2(*this); - return (SpeciesThermoInterpType*) sp; + return new ShomatePoly2(*this); } virtual int reportType() const { diff --git a/src/thermo/ConstCpPoly.cpp b/src/thermo/ConstCpPoly.cpp index e0b396eff..f7c59e66f 100644 --- a/src/thermo/ConstCpPoly.cpp +++ b/src/thermo/ConstCpPoly.cpp @@ -42,29 +42,6 @@ ConstCpPoly::ConstCpPoly(double tlow, double thigh, double pref, m_logt0 = log(m_t0); } -ConstCpPoly::ConstCpPoly(const ConstCpPoly& b) : - SpeciesThermoInterpType(b), - m_t0(b.m_t0), - m_cp0_R(b.m_cp0_R), - m_h0_R(b.m_h0_R), - m_s0_R(b.m_s0_R), - m_logt0(b.m_logt0) -{ -} - -ConstCpPoly& ConstCpPoly::operator=(const ConstCpPoly& b) -{ - if (&b != this) { - m_t0 = b.m_t0; - m_cp0_R = b.m_cp0_R; - m_h0_R = b.m_h0_R; - m_s0_R = b.m_s0_R; - m_logt0 = b.m_logt0; - SpeciesThermoInterpType::operator=(b); - } - return *this; -} - SpeciesThermoInterpType* ConstCpPoly::duplMyselfAsSpeciesThermoInterpType() const { diff --git a/src/thermo/Mu0Poly.cpp b/src/thermo/Mu0Poly.cpp index d118baa81..ce73e566e 100644 --- a/src/thermo/Mu0Poly.cpp +++ b/src/thermo/Mu0Poly.cpp @@ -37,33 +37,6 @@ Mu0Poly::Mu0Poly(double tlow, double thigh, double pref, const double* coeffs) : processCoeffs(coeffs); } -Mu0Poly::Mu0Poly(const Mu0Poly& b) - : SpeciesThermoInterpType(b), - m_numIntervals(b.m_numIntervals), - m_H298(b.m_H298), - m_t0_int(b.m_t0_int), - m_mu0_R_int(b.m_mu0_R_int), - m_h0_R_int(b.m_h0_R_int), - m_s0_R_int(b.m_s0_R_int), - m_cp0_R_int(b.m_cp0_R_int) -{ -} - -Mu0Poly& Mu0Poly::operator=(const Mu0Poly& b) -{ - if (&b != this) { - SpeciesThermoInterpType::operator=(b); - m_numIntervals = b.m_numIntervals; - m_H298 = b.m_H298; - m_t0_int = b.m_t0_int; - m_mu0_R_int = b.m_mu0_R_int; - m_h0_R_int = b.m_h0_R_int; - m_s0_R_int = b.m_s0_R_int; - m_cp0_R_int = b.m_cp0_R_int; - } - return *this; -} - SpeciesThermoInterpType* Mu0Poly::duplMyselfAsSpeciesThermoInterpType() const { diff --git a/src/thermo/Nasa9Poly1.cpp b/src/thermo/Nasa9Poly1.cpp index 195aa09eb..d5f3b31ae 100644 --- a/src/thermo/Nasa9Poly1.cpp +++ b/src/thermo/Nasa9Poly1.cpp @@ -36,23 +36,7 @@ Nasa9Poly1::Nasa9Poly1(double tlow, double thigh, double pref, { } -Nasa9Poly1::Nasa9Poly1(const Nasa9Poly1& b) : - SpeciesThermoInterpType(b), - m_coeff(b.m_coeff) -{ -} - -Nasa9Poly1& Nasa9Poly1::operator=(const Nasa9Poly1& b) -{ - if (&b != this) { - SpeciesThermoInterpType::operator=(b); - m_coeff = b.m_coeff; - } - return *this; -} - -SpeciesThermoInterpType* -Nasa9Poly1::duplMyselfAsSpeciesThermoInterpType() const +SpeciesThermoInterpType* Nasa9Poly1::duplMyselfAsSpeciesThermoInterpType() const { return new Nasa9Poly1(*this); }