From b2713d232468693b6061fd2bad06aec80d7e2122 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 27 Jan 2020 13:39:37 +0100 Subject: [PATCH 1/3] ENH: declare generated methods for lagrangian and thermo/functions --- .../functions/Function1/Uniform/Uniform.H | 18 +++++--- .../functions/Polynomial/Polynomial.C | 24 +++------- .../functions/Polynomial/Polynomial.H | 23 +++++----- .../referredWallFace/referredWallFace.C | 35 ++------------ .../referredWallFace/referredWallFace.H | 27 ++++------- .../referredWallFace/referredWallFaceI.H | 2 - .../CollisionRecordList/CollisionRecordList.C | 33 ------------- .../CollisionRecordList/CollisionRecordList.H | 24 ++++------ .../CollisionRecordListI.H | 5 -- .../phaseProperties/phaseProperties.C | 10 ---- .../phaseProperties/phaseProperties.H | 23 +++------- .../phaseProperties/phasePropertiesIO.C | 8 +--- .../ParticleForces/forceSuSp/forceSuSp.H | 15 +++--- .../ParticleForces/forceSuSp/forceSuSpI.H | 14 +----- .../SingleKineticRateDevolatilisation.C | 23 ---------- .../SingleKineticRateDevolatilisation.H | 46 ++++++------------- .../const/constAnIsoSolidTransport.H | 20 ++++---- .../const/constAnIsoSolidTransportI.H | 12 +---- .../transport/const/constIsoSolidTransport.H | 20 ++++---- .../transport/const/constIsoSolidTransportI.H | 14 +----- .../exponential/exponentialSolidTransport.H | 22 +++++---- .../exponential/exponentialSolidTransportI.H | 15 +----- .../polynomial/polynomialSolidTransport.H | 19 ++++---- .../polynomial/polynomialSolidTransportI.H | 14 +----- .../icoPolynomial/icoPolynomial.H | 18 ++++---- .../icoPolynomial/icoPolynomialI.H | 12 ----- .../incompressiblePerfectGas.H | 19 ++++---- .../incompressiblePerfectGasI.H | 15 +----- .../specie/specie/specie.H | 26 +++++++---- .../specie/specie/specieI.H | 38 ++++++--------- .../specie/specieElement/specieElement.H | 9 ++-- .../specie/specieElement/specieElementI.H | 4 ++ .../thermo/hPolynomial/hPolynomialThermo.H | 17 ++++--- .../thermo/hPolynomial/hPolynomialThermoI.H | 16 ------- .../specie/transport/WLF/WLFTransport.H | 22 +++++---- .../specie/transport/WLF/WLFTransportI.H | 16 ------- .../specie/transport/const/constTransport.H | 22 +++++---- .../specie/transport/const/constTransportI.H | 13 ------ .../logPolynomial/logPolynomialTransport.H | 20 ++++---- .../logPolynomial/logPolynomialTransportI.H | 13 ------ .../polynomial/polynomialTransport.H | 20 ++++---- .../polynomial/polynomialTransportI.H | 13 ------ .../sutherland/sutherlandTransport.H | 20 ++++---- .../sutherland/sutherlandTransportI.H | 13 ------ 44 files changed, 268 insertions(+), 544 deletions(-) diff --git a/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H b/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H index a809ae9a92..46078cea7d 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H +++ b/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,18 +64,21 @@ class Uniform : public Constant { - // Private Member Functions +public: + + //- Declare type-name, virtual type (with debug switch) + TypeName("uniform"); + + + // Generated Methods + + //- Copy construct + Uniform(const Uniform&) = default; //- No copy assignment void operator=(const Uniform&) = delete; -public: - - // Runtime type information - TypeName("uniform"); - - // Constructors //- Construct from entry name and dictionary diff --git a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C index fe32dfbc81..97576ba7b4 100644 --- a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C +++ b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C @@ -34,33 +34,21 @@ Foam::Polynomial::Polynomial() : VectorSpace, scalar, PolySize>(), logActive_(false), - logCoeff_(0.0) + logCoeff_(0) { for (int i = 0; i < PolySize; ++i) { - this->v_[i] = 0.0; + this->v_[i] = 0; } } -template -Foam::Polynomial::Polynomial -( - const Polynomial& poly -) -: - VectorSpace, scalar, PolySize>(poly), - logActive_(poly.logActive_), - logCoeff_(poly.logCoeff_) -{} - - template Foam::Polynomial::Polynomial(const scalar coeffs[PolySize]) : VectorSpace, scalar, PolySize>(), logActive_(false), - logCoeff_(0.0) + logCoeff_(0) { for (int i=0; i::Polynomial(const UList& coeffs) : VectorSpace, scalar, PolySize>(), logActive_(false), - logCoeff_(0.0) + logCoeff_(0) { if (coeffs.size() != PolySize) { @@ -96,7 +84,7 @@ Foam::Polynomial::Polynomial(Istream& is) : VectorSpace, scalar, PolySize>(is), logActive_(false), - logCoeff_(0.0) + logCoeff_(0) {} @@ -105,7 +93,7 @@ Foam::Polynomial::Polynomial(const word& name, Istream& is) : VectorSpace, scalar, PolySize>(), logActive_(false), - logCoeff_(0.0) + logCoeff_(0) { word isName(is); diff --git a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H index f608b638ef..99c5c4faff 100644 --- a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H +++ b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,11 +64,10 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward Declarations template class Polynomial; -// Forward declaration of friend functions template Ostream& operator<< ( @@ -87,7 +87,7 @@ class Polynomial { static_assert(PolySize > 0, "Size must be positive (non-zero)"); - // Private data + // Private Data //- Include the log term? - only activated using integralMinus1() bool logActive_; @@ -98,19 +98,20 @@ class Polynomial public: - typedef Polynomial polyType; + // Public Typedefs - typedef Polynomial intPolyType; + typedef Polynomial polyType; + typedef Polynomial intPolyType; + + + // Generated Methods: copy construct, copy assignment // Constructors - //- Construct null, with all coefficients = 0.0 + //- Default construct, with all coefficients = 0 Polynomial(); - //- Copy constructor - Polynomial(const Polynomial&); - //- Construct from C-array of coefficients explicit Polynomial(const scalar coeffs[PolySize]); @@ -118,10 +119,10 @@ public: explicit Polynomial(const UList& coeffs); //- Construct from Istream - Polynomial(Istream&); + explicit Polynomial(Istream& is); //- Construct from name and Istream - Polynomial(const word& name, Istream&); + Polynomial(const word& name, Istream& is); // Member Functions diff --git a/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.C b/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.C index 1637cfa145..129a233b4d 100644 --- a/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.C +++ b/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,14 +30,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::referredWallFace::referredWallFace() -: - face(), - pts_(), - patchi_() -{} - - Foam::referredWallFace::referredWallFace ( const face& f, @@ -48,36 +41,16 @@ Foam::referredWallFace::referredWallFace pts_(pts), patchi_(patchi) { - if (this->size() != pts_.size()) + if (face::size() != pts_.size()) { FatalErrorInFunction - << "Face and pointField are not the same size. " << nl << (*this) + << "Face and pointField are not the same size." << nl + << (*this) << nl << abort(FatalError); } } -Foam::referredWallFace::referredWallFace(const referredWallFace& rWF) -: - face(rWF), - pts_(rWF.pts_), - patchi_(rWF.patchi_) -{ - if (this->size() != pts_.size()) - { - FatalErrorInFunction - << "Face and pointField are not the same size. " << nl << (*this) - << abort(FatalError); - } -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::referredWallFace::~referredWallFace() -{} - - // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // bool Foam::referredWallFace::operator==(const referredWallFace& rhs) const diff --git a/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.H b/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.H index 19836e5180..77322cfb92 100644 --- a/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.H +++ b/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -47,16 +48,11 @@ SourceFiles namespace Foam { -// Forward declaration of classes -class Istream; -class Ostream; - -// Forward declaration of friend functions and operators +// Forward Declarations class referredWallFace; Istream& operator>>(Istream&, referredWallFace&); Ostream& operator<<(Ostream&, const referredWallFace&); - /*---------------------------------------------------------------------------*\ Class referredWallFace Declaration \*---------------------------------------------------------------------------*/ @@ -65,7 +61,7 @@ class referredWallFace : public face { - // Private data + // Private Data //- Points of face pointField pts_; @@ -76,10 +72,13 @@ class referredWallFace public: - // Constructors + // Generated Methods - //- Construct null - referredWallFace(); + //- Default construct + referredWallFace() = default; + + + // Constructors //- Construct from components referredWallFace @@ -89,13 +88,6 @@ public: label patchi ); - //- Construct as copy - referredWallFace(const referredWallFace&); - - - //- Destructor - ~referredWallFace(); - // Member Functions @@ -119,6 +111,7 @@ public: bool operator==(const referredWallFace&) const; bool operator!=(const referredWallFace&) const; + // IOstream Operators friend Istream& operator>>(Istream&, referredWallFace&); diff --git a/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFaceI.H b/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFaceI.H index d07e7c41b4..4636e3efeb 100644 --- a/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFaceI.H +++ b/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFaceI.H @@ -25,8 +25,6 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // const Foam::pointField& Foam::referredWallFace::points() const diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.C b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.C index fecdcb9177..3e38d8d720 100644 --- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.C +++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.C @@ -31,14 +31,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::CollisionRecordList::CollisionRecordList() -: - pairRecords_(), - wallRecords_() -{} - - template Foam::CollisionRecordList::CollisionRecordList(Istream& is) : @@ -123,13 +115,6 @@ Foam::CollisionRecordList::CollisionRecordList } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * / - -template -Foam::CollisionRecordList::~CollisionRecordList() -{} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // template @@ -386,24 +371,6 @@ void Foam::CollisionRecordList::update() } -// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // - -template -void Foam::CollisionRecordList::operator= -( - const CollisionRecordList& rhs -) -{ - if (this == &rhs) - { - return; // Self-assignment is a no-op - } - - pairRecords_ = rhs.pairRecords_; - wallRecords_ = rhs.wallRecords_; -} - - // * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // template diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.H b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.H index f59e29e308..16e25e452c 100644 --- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.H +++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -47,7 +48,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations template class CollisionRecordList; @@ -79,7 +80,7 @@ Ostream& operator<<(Ostream&, const CollisionRecordList&); template class CollisionRecordList { - // Private data + // Private Data //- List of active pair collisions DynamicList> pairRecords_; @@ -90,13 +91,16 @@ class CollisionRecordList public: + // Generated Methods + + //- Default construct + CollisionRecordList() = default; + + // Constructors - //- Construct null - CollisionRecordList(); - //- Construct from Istream - CollisionRecordList(Istream&); + explicit CollisionRecordList(Istream& is); //- Construct from component fields (for IO) CollisionRecordList @@ -110,9 +114,6 @@ public: const Field& wallData ); - //- Destructor - ~CollisionRecordList(); - // Member Functions @@ -196,11 +197,6 @@ public: void update(); - // Member Operators - - void operator=(const CollisionRecordList&); - - // Friend Operators friend bool operator== diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordListI.H b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordListI.H index a3539d273a..ec47de3c3e 100644 --- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordListI.H +++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordListI.H @@ -25,8 +25,6 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -45,7 +43,4 @@ Foam::CollisionRecordList::wallRecords() const } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - // ************************************************************************* // diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C index bf957935ed..35076e8718 100644 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C @@ -188,16 +188,6 @@ Foam::phaseProperties::phaseProperties() {} -Foam::phaseProperties::phaseProperties(const phaseProperties& pp) -: - phase_(pp.phase_), - stateLabel_(pp.stateLabel_), - names_(pp.names_), - Y_(pp.Y_), - carrierIds_(pp.carrierIds_) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::phaseProperties::reorder diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H index cd4993e68d..81cbd7ae53 100644 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,14 +49,11 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators - +// Forward Declarations class phaseProperties; - Istream& operator>>(Istream&, phaseProperties&); Ostream& operator<<(Ostream&, const phaseProperties&); - /*---------------------------------------------------------------------------*\ Class phaseProperties Declaration \*---------------------------------------------------------------------------*/ @@ -64,7 +62,7 @@ class phaseProperties { public: - // Public data + // Public Data //- Phase type enumeration enum phaseType @@ -81,7 +79,7 @@ public: private: - // Private data + // Private Data //- Phase type phaseType phase_; @@ -118,21 +116,14 @@ public: // Constructors - //- Null constructor + //- Default construct, as 'UNKNOWN' state phaseProperties(); //- Construct from Istream - phaseProperties(Istream& is); - - //- Construct as copy - phaseProperties(const phaseProperties& pp); + explicit phaseProperties(Istream& is); - //- Destructor - ~phaseProperties() = default; - - - // Public Member Functions + // Member Functions //- Reorder species to be consistent with the corresponding // phase specie name list diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C index ae1e30ed5f..7f1a6d1d5f 100644 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C @@ -32,11 +32,7 @@ License Foam::phaseProperties::phaseProperties(Istream& is) : - phase_(UNKNOWN), - stateLabel_("(unknown)"), - names_(), - Y_(), - carrierIds_() + phaseProperties() { is >> *this; } @@ -59,7 +55,7 @@ Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp) const label nComponents = pp.names_.size(); - pp.Y_.resize(nComponents, 0.0); + pp.Y_.resize(nComponents, Zero); pp.carrierIds_.resize(nComponents, -1); for (label cmpti = 0; cmpti < nComponents; ++cmpti) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H index 90aa101bc1..0c82746cb6 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSp.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -50,7 +51,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations class forceSuSp; inline forceSuSp operator+(const forceSuSp& susp1, const forceSuSp& susp2); @@ -65,13 +66,12 @@ class forceSuSp : public Tuple2 { - public: // Constructors - //- Construct null - inline forceSuSp(); + //- Default construct + forceSuSp() = default; //- Construct zero-initialized content inline forceSuSp(const zero); @@ -83,7 +83,7 @@ public: inline forceSuSp(const vector& Su, const scalar Sp); //- Construct from Istream - inline forceSuSp(Istream& is); + inline explicit forceSuSp(Istream& is); // Member Functions @@ -108,9 +108,6 @@ public: // Operators - //- Assignment - inline void operator=(const forceSuSp& susp); - //- Addition inline void operator+=(const forceSuSp& susp); @@ -118,7 +115,7 @@ public: inline void operator-=(const forceSuSp& susp); - // Friend operators + // Friend Operators //- Addition friend inline forceSuSp operator* diff --git a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H index 55d28fca81..8c13d855fb 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/ParticleForces/forceSuSp/forceSuSpI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,13 +28,9 @@ License // * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * // -inline Foam::forceSuSp::forceSuSp() -{} - - inline Foam::forceSuSp::forceSuSp(const zero) : - Tuple2(vector::zero, 0.0) + Tuple2(vector::zero, 0) {} @@ -87,13 +84,6 @@ inline Foam::scalar& Foam::forceSuSp::Sp() // * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * * // -inline void Foam::forceSuSp::operator=(const forceSuSp& susp) -{ - first() = susp.first(); - second() = susp.second(); -} - - inline void Foam::forceSuSp::operator+=(const forceSuSp& susp) { first() += susp.first(); diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C index 931a149e50..d4ef00e084 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C @@ -71,29 +71,6 @@ SingleKineticRateDevolatilisation } -template -Foam::SingleKineticRateDevolatilisation:: -SingleKineticRateDevolatilisation -( - const SingleKineticRateDevolatilisation& dm -) -: - DevolatilisationModel(dm), - volatileData_(dm.volatileData_), - YVolatile0_(dm.YVolatile0_), - volatileToGasMap_(dm.volatileToGasMap_), - residualCoeff_(dm.residualCoeff_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::SingleKineticRateDevolatilisation:: -~SingleKineticRateDevolatilisation() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H index ed853be55e..ac2cbad75f 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -68,6 +68,7 @@ Description namespace Foam { + /*---------------------------------------------------------------------------*\ Class SingleKineticRateDevolatilisation Declaration \*---------------------------------------------------------------------------*/ @@ -77,10 +78,10 @@ class SingleKineticRateDevolatilisation : public DevolatilisationModel { - // Helper class to store specie-local volatile data + //- Helper class to store specie-local volatile data class volatileData { - // Private data + // Private Data //- Specie name word name_; @@ -91,41 +92,28 @@ class SingleKineticRateDevolatilisation //- Pre-exponential factor scalar E_; - public: // Constructors - //- Null constructor + //- Default construct volatileData() : - name_(word::null), - A1_(0.0), - E_(0.0) + name_(), + A1_(0), + E_(0) {} //- Construct from Istream - volatileData(Istream& is) + explicit volatileData(Istream& is) : name_(is), A1_(readScalar(is)), E_(readScalar(is)) {} - //- Construct as copy - volatileData(const volatileData& vd) - : - name_(vd.name_), - A1_(vd.A1_), - E_(vd.E_) - {} - - //- Destructor - ~volatileData() = default; - - - // Public Member Functions + // Member Functions // Access @@ -174,9 +162,9 @@ class SingleKineticRateDevolatilisation }; - // Private data + // Private Data - // Model constants + // Model Constants //- List of volatile data - (name A1 E) List volatileData_; @@ -195,7 +183,7 @@ class SingleKineticRateDevolatilisation public: - //- Runtime type information + //- Declare type-name, virtual type (with debug switch) TypeName("singleKineticRateDevolatilisation"); @@ -208,12 +196,6 @@ public: CloudType& owner ); - //- Construct copy - SingleKineticRateDevolatilisation - ( - const SingleKineticRateDevolatilisation& dm - ); - //- Construct and return a clone virtual autoPtr> clone() const { @@ -225,7 +207,7 @@ public: //- Destructor - virtual ~SingleKineticRateDevolatilisation(); + virtual ~SingleKineticRateDevolatilisation() = default; // Member Functions diff --git a/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H index 80a7057e00..1edd3d8f8e 100644 --- a/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H +++ b/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransport.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -39,13 +40,14 @@ SourceFiles #ifndef constAnIsoSolidTransport_H #define constAnIsoSolidTransport_H + #include "vector.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - +// Forward Declarations template class constAnIsoSolidTransport; template @@ -72,7 +74,7 @@ class constAnIsoSolidTransport : public Thermo { - // Private data + // Private Data //- Constant anisotropic thermal conductivity. vector kappa_; @@ -86,6 +88,9 @@ class constAnIsoSolidTransport public: + // Generated Methods: copy construct, copy assignment + + // Constructors //- Construct as named copy @@ -96,7 +101,7 @@ public: ); //- Construct from dictionary - constAnIsoSolidTransport(const dictionary&); + explicit constAnIsoSolidTransport(const dictionary& dict); // Selector from dictionary inline static autoPtr New @@ -105,7 +110,7 @@ public: ); - // Member functions + // Member Functions //- Return the instantiated type name static word typeName() @@ -133,13 +138,12 @@ public: void write(Ostream& os) const; - // Member operators + // Member Operators - inline void operator=(const constAnIsoSolidTransport&); inline void operator+=(const constAnIsoSolidTransport&); - // Friend operators + // Friend Operators friend constAnIsoSolidTransport operator* ( @@ -148,7 +152,7 @@ public: ); - // Ostream Operator + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransportI.H b/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransportI.H index 4b5a5061ba..a39ad88ecd 100644 --- a/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransportI.H +++ b/src/thermophysicalModels/solidSpecie/transport/const/constAnIsoSolidTransportI.H @@ -83,7 +83,7 @@ inline Foam::scalar Foam::constAnIsoSolidTransport:: mu(const scalar p, const scalar T) const { NotImplemented; - return scalar(0); + return 0; } @@ -96,16 +96,6 @@ alphah(const scalar p, const scalar T) const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::constAnIsoSolidTransport::operator= -( - const constAnIsoSolidTransport& ct -) -{ - kappa_ = ct.kappa_; -} - - template inline void Foam::constAnIsoSolidTransport::operator+= ( diff --git a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H index 4dff53de15..294fd8ec2e 100644 --- a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H +++ b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransport.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -47,6 +48,7 @@ SourceFiles namespace Foam { +// Forward Declarations template class constIsoSolidTransport; template @@ -73,7 +75,7 @@ class constIsoSolidTransport : public Thermo { - // Private data + // Private Data //- Constant isotropic thermal conductivity scalar kappa_; @@ -87,6 +89,9 @@ class constIsoSolidTransport public: + // Generated Methods: copy construct, copy assignment + + // Constructors //- Construct as named copy @@ -97,7 +102,7 @@ public: ); //- Construct from dictionary - constIsoSolidTransport(const dictionary& dict); + explicit constIsoSolidTransport(const dictionary& dict); // Selector from dictionary inline static autoPtr New @@ -106,7 +111,7 @@ public: ); - // Member functions + // Member Functions //- Return the instantiated type name static word typeName() @@ -123,7 +128,7 @@ public: //- Un-isotropic thermal conductivity [W/mK] inline vector Kappa(const scalar p, const scalar T) const; - //- Dynamic viscosity [kg/ms] + //- Dynamic viscosity [kg/ms] inline scalar mu(const scalar p, const scalar T) const; //- Thermal diffusivity of enthalpy [kg/ms] @@ -134,13 +139,12 @@ public: void write(Ostream& os) const; - // Member operators + // Member Operators - inline void operator=(const constIsoSolidTransport&); inline void operator+=(const constIsoSolidTransport&); - // Friend operators + // Friend Operators friend constIsoSolidTransport operator* ( @@ -149,7 +153,7 @@ public: ); - // Ostream Operator + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransportI.H b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransportI.H index 64333e09c6..55730310dc 100644 --- a/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransportI.H +++ b/src/thermophysicalModels/solidSpecie/transport/const/constIsoSolidTransportI.H @@ -83,7 +83,7 @@ inline Foam::scalar Foam::constIsoSolidTransport:: mu(const scalar p, const scalar T) const { NotImplemented; - return scalar(0); + return 0; } @@ -96,17 +96,6 @@ alphah(const scalar p, const scalar T) const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::constIsoSolidTransport::operator= -( - const constIsoSolidTransport& ct -) -{ - thermo::operator=(ct); - kappa_ = ct.kappa_; -} - - template inline void Foam::constIsoSolidTransport::operator+= ( @@ -125,7 +114,6 @@ inline void Foam::constIsoSolidTransport::operator+= // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - template inline Foam::constIsoSolidTransport Foam::operator* ( diff --git a/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H index 09154da058..463bfc9820 100644 --- a/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H +++ b/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransport.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -44,6 +45,8 @@ SourceFiles namespace Foam { +// Forward Declarations + template class exponentialSolidTransport; template @@ -70,7 +73,7 @@ class exponentialSolidTransport : public Thermo { - // Private data + // Private Data //- Constant thermal coefficient. scalar kappa0_; @@ -96,6 +99,9 @@ class exponentialSolidTransport public: + // Generated Methods: copy construct, copy assignment + + // Constructors //- Construct as named copy @@ -106,7 +112,7 @@ public: ); //- Construct from dictionary - exponentialSolidTransport(const dictionary&); + explicit exponentialSolidTransport(const dictionary&); // Selector from dictionary inline static autoPtr New @@ -115,7 +121,7 @@ public: ); - // Member functions + // Member Functions //- Return the instantiated type name static word typeName() @@ -132,7 +138,7 @@ public: //- Thermal conductivity [W/mK] inline vector Kappa(const scalar p, const scalar T) const; - //- Dynamic viscosity [kg/ms] + //- Dynamic viscosity [kg/ms] inline scalar mu(const scalar p, const scalar T) const; //- Thermal diffusivity of enthalpy [kg/ms] @@ -142,13 +148,12 @@ public: void write(Ostream& os) const; - // Member operators + // Member Operators - inline void operator=(const exponentialSolidTransport&); inline void operator+=(const exponentialSolidTransport&); - // Friend operators + // Friend Operators friend exponentialSolidTransport operator* ( @@ -156,7 +161,8 @@ public: const exponentialSolidTransport& ); - // Ostream Operator + + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransportI.H b/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransportI.H index c6ca542a95..b90d34136d 100644 --- a/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransportI.H +++ b/src/thermophysicalModels/solidSpecie/transport/exponential/exponentialSolidTransportI.H @@ -95,7 +95,7 @@ inline Foam::scalar Foam::exponentialSolidTransport:: mu(const scalar p, const scalar T) const { NotImplemented; - return scalar(0); + return 0; } @@ -108,19 +108,6 @@ alphah(const scalar p, const scalar T) const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -template -inline void Foam::exponentialSolidTransport::operator= -( - const exponentialSolidTransport& ct -) -{ - kappa0_ = ct.kappa0_; - n0_ = ct.n0_; - Tref_ = ct.Tref_; -} - - template inline void Foam::exponentialSolidTransport::operator+= ( diff --git a/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.H b/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.H index dab5e94af3..8f966ae042 100644 --- a/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.H +++ b/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransport.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -73,7 +74,7 @@ See also namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations template class polynomialSolidTransport; @@ -108,7 +109,7 @@ class polynomialSolidTransport : public Thermo { - // Private data + // Private Data //- Thermal conductivity polynomial coefficients // Note: input in [W/m/K] @@ -133,6 +134,9 @@ class polynomialSolidTransport public: + // Generated Methods: copy construct, copy assignment + + // Constructors //- Construct as named copy @@ -143,7 +147,7 @@ public: ); //- Construct from dictionary - polynomialSolidTransport(const dictionary& dict); + explicit polynomialSolidTransport(const dictionary& dict); //- Construct and return a clone inline autoPtr clone() const; @@ -155,7 +159,7 @@ public: ); - // Member functions + // Member Functions //- Return the instantiated type name static word typeName() @@ -183,14 +187,13 @@ public: void write(Ostream& os) const; - // Member operators + // Member Operators - inline void operator=(const polynomialSolidTransport&); inline void operator+=(const polynomialSolidTransport&); inline void operator*=(const scalar); - // Friend operators + // Friend Operators friend polynomialSolidTransport operator+ ( @@ -205,7 +208,7 @@ public: ); - // Ostream Operator + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransportI.H b/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransportI.H index c27deab24e..622838018a 100644 --- a/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransportI.H +++ b/src/thermophysicalModels/solidSpecie/transport/polynomial/polynomialSolidTransportI.H @@ -81,7 +81,7 @@ inline Foam::scalar Foam::polynomialSolidTransport::mu ) const { NotImplemented; - return scalar(0); + return 0; } @@ -120,18 +120,6 @@ inline Foam::scalar Foam::polynomialSolidTransport::alphah // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::polynomialSolidTransport::operator= -( - const polynomialSolidTransport& pt -) -{ - Thermo::operator=(pt); - - kappaCoeffs_ = pt.kappaCoeffs_; -} - - template inline void Foam::polynomialSolidTransport::operator+= ( diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H index 690d7f09e6..bd32d7c8a1 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -76,7 +77,7 @@ See also namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations template class icoPolynomial; @@ -119,7 +120,7 @@ class icoPolynomial : public Specie { - // Private data + // Private Data //- Density polynomial coefficients Polynomial rhoCoeffs_; @@ -136,6 +137,8 @@ class icoPolynomial public: + // Generated Methods: copy construct, copy assignment + // Constructors //- Construct from components @@ -146,7 +149,7 @@ public: ); //- Construct from dictionary - icoPolynomial(const dictionary& dict); + explicit icoPolynomial(const dictionary& dict); //- Construct as named copy inline icoPolynomial(const word& name, const icoPolynomial&); @@ -158,7 +161,7 @@ public: inline static autoPtr New(const dictionary& dict); - // Member functions + // Member Functions //- Return the instantiated type name static word typeName() @@ -209,14 +212,13 @@ public: void write(Ostream& os) const; - // Member operators + // Member Operators - inline void operator=(const icoPolynomial&); inline void operator+=(const icoPolynomial&); inline void operator*=(const scalar); - // Friend operators + // Friend Operators friend icoPolynomial operator+ ( @@ -237,7 +239,7 @@ public: ); - // Ostream Operator + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H index 684c34434d..66aa55583c 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H @@ -174,18 +174,6 @@ inline Foam::scalar Foam::icoPolynomial::CpMCv // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::icoPolynomial::operator= -( - const icoPolynomial& ip -) -{ - Specie::operator=(ip); - - rhoCoeffs_ = ip.rhoCoeffs_; -} - - template inline void Foam::icoPolynomial::operator+= ( diff --git a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H index a558796944..70c5f8eaf8 100644 --- a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H +++ b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGas.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -50,7 +51,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations template class incompressiblePerfectGas; @@ -92,7 +93,7 @@ class incompressiblePerfectGas : public Specie { - // Private data + // Private Data //- Reference pressure scalar pRef_; @@ -100,13 +101,16 @@ class incompressiblePerfectGas public: + // Generated Methods: copy construct, copy assignment + + // Constructors //- Construct from components inline incompressiblePerfectGas(const Specie& sp, const scalar pRef); //- Construct from dictionary - incompressiblePerfectGas(const dictionary& dict); + explicit incompressiblePerfectGas(const dictionary& dict); //- Construct as named copy inline incompressiblePerfectGas @@ -125,7 +129,7 @@ public: ); - // Member functions + // Member Functions //- Return the instantiated type name static word typeName() @@ -178,14 +182,13 @@ public: void write(Ostream& os) const; - // Member operators + // Member Operators - inline void operator=(const incompressiblePerfectGas&); inline void operator+=(const incompressiblePerfectGas&); inline void operator*=(const scalar); - // Friend operators + // Friend Operators friend incompressiblePerfectGas operator+ ( @@ -206,7 +209,7 @@ public: ); - // Ostream Operator + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H index c14e1c30c1..497557b7fb 100644 --- a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H @@ -27,13 +27,13 @@ License #include "incompressiblePerfectGas.H" - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template inline Foam::incompressiblePerfectGas::incompressiblePerfectGas ( - const Specie& sp, const scalar pRef + const Specie& sp, + const scalar pRef ) : Specie(sp), @@ -175,17 +175,6 @@ inline Foam::scalar Foam::incompressiblePerfectGas::CpMCv // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::incompressiblePerfectGas::operator= -( - const incompressiblePerfectGas& ipg -) -{ - Specie::operator=(ipg); - pRef_ = ipg.pRef_; -} - - template inline void Foam::incompressiblePerfectGas::operator+= ( diff --git a/src/thermophysicalModels/specie/specie/specie.H b/src/thermophysicalModels/specie/specie/specie.H index 62144a1b65..9c115b8b46 100644 --- a/src/thermophysicalModels/specie/specie/specie.H +++ b/src/thermophysicalModels/specie/specie/specie.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -50,8 +51,7 @@ using namespace Foam::constant::thermodynamic; namespace Foam { -// Forward declaration of friend functions and operators - +// Forward Declarations class specie; inline specie operator+(const specie&, const specie&); @@ -67,7 +67,7 @@ Ostream& operator<<(Ostream&, const specie&); class specie { - // Private data + // Private Data //- Name of specie word name_; @@ -81,10 +81,16 @@ class specie public: - //- Runtime type information + //- Declare type-name (with debug switch) ClassName("specie"); + // Generated Methods + + //- Copy construct + specie(const specie&) = default; + + // Constructors //- Construct from components without name @@ -102,7 +108,7 @@ public: inline specie(const word& name, const specie&); //- Construct from dictionary - specie(const dictionary& dict); + explicit specie(const dictionary& dict); // Member Functions @@ -122,27 +128,29 @@ public: inline scalar R() const; - // I-O + // IO //- Write to Ostream void write(Ostream& os) const; - // Member operators + // Member Operators + //- Copy assignment, preserve original name inline void operator=(const specie&); + inline void operator+=(const specie&); inline void operator*=(const scalar); - // Friend operators + // Friend Operators inline friend specie operator+(const specie&, const specie&); inline friend specie operator*(const scalar, const specie&); inline friend specie operator==(const specie&, const specie&); - // Ostream Operator + // IOstream Operators friend Ostream& operator<<(Ostream&, const specie&); }; diff --git a/src/thermophysicalModels/specie/specie/specieI.H b/src/thermophysicalModels/specie/specie/specieI.H index 4c104dc862..b4893a7fe5 100644 --- a/src/thermophysicalModels/specie/specie/specieI.H +++ b/src/thermophysicalModels/specie/specie/specieI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,14 +28,9 @@ License #include "specie.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -inline specie::specie +inline Foam::specie::specie ( const word& name, const scalar Y, @@ -47,7 +43,7 @@ inline specie::specie {} -inline specie::specie +inline Foam::specie::specie ( const scalar Y, const scalar molWeight @@ -60,7 +56,7 @@ inline specie::specie // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -inline specie::specie(const word& name, const specie& st) +inline Foam::specie::specie(const word& name, const specie& st) : name_(name), Y_(st.Y_), @@ -70,25 +66,25 @@ inline specie::specie(const word& name, const specie& st) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const word& specie::name() const +inline const Foam::word& Foam::specie::name() const { return name_; } -inline scalar specie::W() const +inline Foam::scalar Foam::specie::W() const { return molWeight_; } -inline scalar specie::Y() const +inline Foam::scalar Foam::specie::Y() const { return Y_; } -inline scalar specie::R() const +inline Foam::scalar Foam::specie::R() const { return RR/molWeight_; } @@ -96,15 +92,15 @@ inline scalar specie::R() const // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -inline void specie::operator=(const specie& st) +inline void Foam::specie::operator=(const specie& st) { - //name_ = st.name_; + // Preserve original name Y_ = st.Y_; molWeight_ = st.molWeight_; } -inline void specie::operator+=(const specie& st) +inline void Foam::specie::operator+=(const specie& st) { const scalar sumY = Y_ + st.Y_; if (mag(sumY) > SMALL) @@ -116,7 +112,7 @@ inline void specie::operator+=(const specie& st) } -inline void specie::operator*=(const scalar s) +inline void Foam::specie::operator*=(const scalar s) { Y_ *= s; } @@ -124,7 +120,7 @@ inline void specie::operator*=(const scalar s) // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // -inline specie operator+(const specie& st1, const specie& st2) +inline Foam::specie Foam::operator+(const specie& st1, const specie& st2) { const scalar sumY = max(st1.Y_ + st2.Y_, SMALL); @@ -143,7 +139,7 @@ inline specie operator+(const specie& st1, const specie& st2) } -inline specie operator*(const scalar s, const specie& st) +inline Foam::specie Foam::operator*(const scalar s, const specie& st) { return specie ( @@ -153,7 +149,7 @@ inline specie operator*(const scalar s, const specie& st) } -inline specie operator==(const specie& st1, const specie& st2) +inline Foam::specie Foam::operator==(const specie& st1, const specie& st2) { scalar diffY = st2.Y_ - st1.Y_; if (mag(diffY) < SMALL) @@ -180,8 +176,4 @@ inline specie operator==(const specie& st1, const specie& st2) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/specieElement/specieElement.H b/src/thermophysicalModels/specie/specieElement/specieElement.H index 156a4ddbc8..6721608ea7 100644 --- a/src/thermophysicalModels/specie/specieElement/specieElement.H +++ b/src/thermophysicalModels/specie/specieElement/specieElement.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -43,7 +44,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations class specieElement; Ostream& operator<<(Ostream&, const specieElement&); @@ -54,7 +55,7 @@ Ostream& operator<<(Ostream&, const specieElement&); class specieElement { - // Private data + // Private Data //- Name of the element word name_; @@ -67,14 +68,14 @@ public: // Constructors - //- Construct null + //- Default construct inline specieElement(); //- Construct from components inline specieElement(const word& name, const label nAtoms); //- Construct from Istream - inline specieElement(Istream&); + inline explicit specieElement(Istream& is); // Member Functions diff --git a/src/thermophysicalModels/specie/specieElement/specieElementI.H b/src/thermophysicalModels/specie/specieElement/specieElementI.H index 2daa7a5470..59c1992b39 100644 --- a/src/thermophysicalModels/specie/specieElement/specieElementI.H +++ b/src/thermophysicalModels/specie/specieElement/specieElementI.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,6 +31,9 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // inline Foam::specieElement::specieElement() +: + name_(), + nAtoms_(0) {} diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H index f665d0093d..53fa23425d 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -86,7 +87,7 @@ See also namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations template class hPolynomialThermo; @@ -129,7 +130,7 @@ class hPolynomialThermo : public EquationOfState { - // Private data + // Private Data //- Heat of formation scalar Hf_; @@ -170,6 +171,9 @@ class hPolynomialThermo public: + // Generated Methods: copy construct, copy assignment + + // Constructors //- Construct from dictionary @@ -222,20 +226,19 @@ public: - // I-O + // IO //- Write to Ostream void write(Ostream& os) const; - // Member operators + // Member Operators - inline void operator=(const hPolynomialThermo&); inline void operator+=(const hPolynomialThermo&); inline void operator*=(const scalar); - // Friend operators + // Friend Operators friend hPolynomialThermo operator+ ( @@ -256,7 +259,7 @@ public: ); - // Ostream Operator + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H index 23dc92596b..3fb36c86d7 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H @@ -159,22 +159,6 @@ inline Foam::scalar Foam::hPolynomialThermo::dCpdT // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::hPolynomialThermo::operator= -( - const hPolynomialThermo& pt -) -{ - EquationOfState::operator=(pt); - - Hf_ = pt.Hf_; - Sf_ = pt.Sf_; - CpCoeffs_ = pt.CpCoeffs_; - hCoeffs_ = pt.hCoeffs_; - sCoeffs_ = pt.sCoeffs_; -} - - template inline void Foam::hPolynomialThermo::operator+= ( diff --git a/src/thermophysicalModels/specie/transport/WLF/WLFTransport.H b/src/thermophysicalModels/specie/transport/WLF/WLFTransport.H index 775f0eabc0..6cd6b9fa7e 100644 --- a/src/thermophysicalModels/specie/transport/WLF/WLFTransport.H +++ b/src/thermophysicalModels/specie/transport/WLF/WLFTransport.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2018 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,7 +60,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations template class WLFTransport; @@ -94,7 +95,7 @@ class WLFTransport : public Thermo { - // Private data + // Private Data //- Dynamic viscosity at the reference temperature [Pa.s] scalar mu0_; @@ -108,7 +109,7 @@ class WLFTransport //- WLF coefficient 2 [T] scalar C2_; - //- Reciprocal Prandtl Number [] + //- Reciprocal Prandtl Number [-] scalar rPr_; @@ -120,13 +121,16 @@ class WLFTransport public: + // Generated Methods: copy construct, copy assignment + + // Constructors //- Construct as named copy inline WLFTransport(const word&, const WLFTransport&); //- Construct from dictionary - WLFTransport(const dictionary& dict); + explicit WLFTransport(const dictionary& dict); //- Construct and return a clone inline autoPtr clone() const; @@ -135,7 +139,7 @@ public: inline static autoPtr New(const dictionary& dict); - // Member functions + // Member Functions //- Return the instantiated type name static word typeName() @@ -159,16 +163,14 @@ public: void write(Ostream& os) const; - // Member operators - - inline void operator=(const WLFTransport&); + // Member Operators inline void operator+=(const WLFTransport&); inline void operator*=(const scalar); - // Friend operators + // Friend Operators friend WLFTransport operator+ ( @@ -183,7 +185,7 @@ public: ); - // Ostream Operator + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/specie/transport/WLF/WLFTransportI.H b/src/thermophysicalModels/specie/transport/WLF/WLFTransportI.H index 759d9096bb..36d2af5a76 100644 --- a/src/thermophysicalModels/specie/transport/WLF/WLFTransportI.H +++ b/src/thermophysicalModels/specie/transport/WLF/WLFTransportI.H @@ -107,22 +107,6 @@ inline Foam::scalar Foam::WLFTransport::alphah // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::WLFTransport::operator= -( - const WLFTransport& wlft -) -{ - Thermo::operator=(wlft); - - mu0_ = wlft.mu0_; - Tr_ = wlft.Tr_; - C1_ = wlft.C1_; - C2_ = wlft.C2_; - rPr_ = wlft.rPr_; -} - - template inline void Foam::WLFTransport::operator+= ( diff --git a/src/thermophysicalModels/specie/transport/const/constTransport.H b/src/thermophysicalModels/specie/transport/const/constTransport.H index 9f1a788c20..14b15f45de 100644 --- a/src/thermophysicalModels/specie/transport/const/constTransport.H +++ b/src/thermophysicalModels/specie/transport/const/constTransport.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,7 +49,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations template class constTransport; @@ -83,12 +84,12 @@ class constTransport : public Thermo { - // Private data + // Private Data //- Constant dynamic viscosity [Pa.s] scalar mu_; - //- Reciprocal Prandtl Number [] + //- Reciprocal Prandtl Number [-] scalar rPr_; @@ -105,13 +106,16 @@ class constTransport public: + // Generated Methods: copy construct, copy assignment + + // Constructors //- Construct as named copy inline constTransport(const word&, const constTransport&); //- Construct from dictionary - constTransport(const dictionary& dict); + explicit constTransport(const dictionary& dict); //- Construct and return a clone inline autoPtr clone() const; @@ -120,7 +124,7 @@ public: inline static autoPtr New(const dictionary& dict); - // Member functions + // Member Functions //- Return the instantiated type name static word typeName() @@ -144,16 +148,14 @@ public: void write(Ostream& os) const; - // Member operators - - inline void operator=(const constTransport&); + // Member Operators inline void operator+=(const constTransport&); inline void operator*=(const scalar); - // Friend operators + // Friend Operators friend constTransport operator+ ( @@ -168,7 +170,7 @@ public: ); - // Ostream Operator + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/specie/transport/const/constTransportI.H b/src/thermophysicalModels/specie/transport/const/constTransportI.H index 881cd9fe68..a3692d19c4 100644 --- a/src/thermophysicalModels/specie/transport/const/constTransportI.H +++ b/src/thermophysicalModels/specie/transport/const/constTransportI.H @@ -110,19 +110,6 @@ inline Foam::scalar Foam::constTransport::alphah // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::constTransport::operator= -( - const constTransport& ct -) -{ - Thermo::operator=(ct); - - mu_ = ct.mu_; - rPr_ = ct.rPr_; -} - - template inline void Foam::constTransport::operator+= ( diff --git a/src/thermophysicalModels/specie/transport/logPolynomial/logPolynomialTransport.H b/src/thermophysicalModels/specie/transport/logPolynomial/logPolynomialTransport.H index c82403590b..cdaa6b9ea1 100644 --- a/src/thermophysicalModels/specie/transport/logPolynomial/logPolynomialTransport.H +++ b/src/thermophysicalModels/specie/transport/logPolynomial/logPolynomialTransport.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -93,7 +94,7 @@ See also namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations template class logPolynomialTransport; @@ -128,7 +129,7 @@ class logPolynomialTransport : public Thermo { - // Private data + // Private Data //- Dynamic viscosity polynomial coefficients // Note: input in [Pa.s], but internally uses [Pa.s/kmol] @@ -158,6 +159,9 @@ class logPolynomialTransport public: + // Generated Methods: copy construct, copy assignment + + // Constructors //- Construct as named copy @@ -168,7 +172,7 @@ public: ); //- Construct from dictionary - logPolynomialTransport(const dictionary& dict); + explicit logPolynomialTransport(const dictionary& dict); //- Construct and return a clone inline autoPtr clone() const; @@ -180,7 +184,7 @@ public: ); - // Member functions + // Member Functions //- Return the instantiated type name static word typeName() @@ -204,16 +208,14 @@ public: void write(Ostream& os) const; - // Member operators - - inline void operator=(const logPolynomialTransport&); + // Member Operators inline void operator+=(const logPolynomialTransport&); inline void operator*=(const scalar); - // Friend operators + // Friend Operators friend logPolynomialTransport operator+ ( @@ -228,7 +230,7 @@ public: ); - // Ostream Operator + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/specie/transport/logPolynomial/logPolynomialTransportI.H b/src/thermophysicalModels/specie/transport/logPolynomial/logPolynomialTransportI.H index ddf64edf4c..9b53370576 100644 --- a/src/thermophysicalModels/specie/transport/logPolynomial/logPolynomialTransportI.H +++ b/src/thermophysicalModels/specie/transport/logPolynomial/logPolynomialTransportI.H @@ -108,19 +108,6 @@ inline Foam::scalar Foam::logPolynomialTransport::alphah // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::logPolynomialTransport::operator= -( - const logPolynomialTransport& pt -) -{ - Thermo::operator=(pt); - - muCoeffs_ = pt.muCoeffs_; - kappaCoeffs_ = pt.kappaCoeffs_; -} - - template inline void Foam::logPolynomialTransport::operator+= ( diff --git a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H index c312e1b4b1..054a141ca9 100644 --- a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H +++ b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -84,7 +85,7 @@ See also namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations template class polynomialTransport; @@ -119,7 +120,7 @@ class polynomialTransport : public Thermo { - // Private data + // Private Data //- Dynamic viscosity polynomial coefficients Polynomial muCoeffs_; @@ -147,13 +148,16 @@ class polynomialTransport public: + // Generated Methods: copy construct, copy assignment + + // Constructors //- Construct as named copy inline polynomialTransport(const word&, const polynomialTransport&); //- Construct from dictionary - polynomialTransport(const dictionary& dict); + explicit polynomialTransport(const dictionary& dict); //- Construct and return a clone inline autoPtr clone() const; @@ -162,7 +166,7 @@ public: inline static autoPtr New(const dictionary& dict); - // Member functions + // Member Functions //- Return the instantiated type name static word typeName() @@ -186,16 +190,14 @@ public: void write(Ostream& os) const; - // Member operators - - inline void operator=(const polynomialTransport&); + // Member Operators inline void operator+=(const polynomialTransport&); inline void operator*=(const scalar); - // Friend operators + // Friend Operators friend polynomialTransport operator+ ( @@ -210,7 +212,7 @@ public: ); - // Ostream Operator + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H index 64ac742740..3599c62e7c 100644 --- a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H +++ b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H @@ -108,19 +108,6 @@ inline Foam::scalar Foam::polynomialTransport::alphah // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::polynomialTransport::operator= -( - const polynomialTransport& pt -) -{ - Thermo::operator=(pt); - - muCoeffs_ = pt.muCoeffs_; - kappaCoeffs_ = pt.kappaCoeffs_; -} - - template inline void Foam::polynomialTransport::operator+= ( diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H index 014d5e45a1..0d8322942a 100644 --- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H +++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,7 +55,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators +// Forward Declarations template class sutherlandTransport; @@ -89,7 +90,7 @@ class sutherlandTransport : public Thermo { - // Private data + // Private Data // Sutherland's coefficients scalar As_, Ts_; @@ -111,6 +112,9 @@ class sutherlandTransport public: + // Generated Methods: copy construct, copy assignment + + // Constructors //- Construct from components @@ -133,7 +137,7 @@ public: inline sutherlandTransport(const word&, const sutherlandTransport&); //- Construct from dictionary - sutherlandTransport(const dictionary& dict); + explicit sutherlandTransport(const dictionary& dict); //- Construct from base thermo and dictionary sutherlandTransport(const Thermo& t,const dictionary& dict); @@ -145,7 +149,7 @@ public: inline static autoPtr New(const dictionary& dict); - // Member functions + // Member Functions //- Return the instantiated type name static word typeName() @@ -169,16 +173,14 @@ public: void write(Ostream& os) const; - // Member operators - - inline void operator=(const sutherlandTransport&); + // Member Operators inline void operator+=(const sutherlandTransport&); inline void operator*=(const scalar); - // Friend operators + // Friend Operators friend sutherlandTransport operator+ ( @@ -193,7 +195,7 @@ public: ); - // Ostream Operator + // IOstream Operators friend Ostream& operator<< ( diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H index 7c65cc9955..33f59fc804 100644 --- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H +++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H @@ -146,19 +146,6 @@ inline Foam::scalar Foam::sutherlandTransport::alphah // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // -template -inline void Foam::sutherlandTransport::operator= -( - const sutherlandTransport& st -) -{ - Thermo::operator=(st); - - As_ = st.As_; - Ts_ = st.Ts_; -} - - template inline void Foam::sutherlandTransport::operator+= ( From 6953760460c36d8f3a8c7fd8e934b19e8eff548a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 27 Jan 2020 13:54:30 +0100 Subject: [PATCH 2/3] ENH: declare generated methods for containers --- .../containers/Bits/PackedList/PackedList.H | 15 +++++-- src/OpenFOAM/containers/Bits/bitSet/bitSet.H | 18 ++++++--- .../HashTables/HashTable/HashTable.H | 19 ++++++--- .../linkTypes/DLListBase/DLListBase.H | 38 +++++++++--------- .../linkTypes/SLListBase/SLListBase.H | 40 +++++++++---------- .../containers/Lists/FixedList/FixedList.H | 10 ++--- .../containers/Lists/SubList/SubList.H | 14 +++++-- src/OpenFOAM/containers/Lists/UList/UList.H | 18 ++++++--- src/OpenFOAM/primitives/Tuple2/Tuple2.H | 6 +-- .../primitives/strings/lists/hashedWordList.H | 6 +-- 10 files changed, 110 insertions(+), 74 deletions(-) diff --git a/src/OpenFOAM/containers/Bits/PackedList/PackedList.H b/src/OpenFOAM/containers/Bits/PackedList/PackedList.H index 47525c617e..f4d01f94dd 100644 --- a/src/OpenFOAM/containers/Bits/PackedList/PackedList.H +++ b/src/OpenFOAM/containers/Bits/PackedList/PackedList.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -105,7 +105,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations template class PackedList; class labelRange; @@ -230,7 +230,7 @@ public: // Constructors - //- Null constructor + //- Default construct, zero-sized and no allocation inline constexpr PackedList() noexcept; //- Construct for given number of elements, initializes values to 0 @@ -451,6 +451,7 @@ public: class reference { protected: + friend class PackedList; // Access for parent void operator&() = delete; // Refuse to provide its address @@ -472,10 +473,16 @@ public: public: + //- Copy construct + reference(const reference&) = default; + + //- Move construct + reference(reference&&) = default; + //- Value assignment inline void operator=(const reference& other); - //- Value assignment. + //- Value assignment inline void operator=(const unsigned int val); //- Conversion operator. diff --git a/src/OpenFOAM/containers/Bits/bitSet/bitSet.H b/src/OpenFOAM/containers/Bits/bitSet/bitSet.H index a617a9434d..076e4e97a6 100644 --- a/src/OpenFOAM/containers/Bits/bitSet/bitSet.H +++ b/src/OpenFOAM/containers/Bits/bitSet/bitSet.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,7 +54,7 @@ See also namespace Foam { -// Forward declarations +// Forward Declarations class bitSet; class labelRange; @@ -131,13 +131,14 @@ public: class const_iterator; typedef unsigned int const_reference; - //- Define class name and debug + + //- Declare type-name (with debug switch) ClassName("bitSet"); // Constructors - //- Construct an empty, zero-sized set + //- Default construct an empty, zero-sized set inline bitSet() noexcept; //- Construct from Istream @@ -438,6 +439,7 @@ public: public PackedList<1>::reference { protected: + friend class bitSet; // Access for parent void operator&() = delete; // Refuse to provide its address @@ -447,6 +449,12 @@ public: public: + //- Copy construct + reference(const reference&) = default; + + //- Move construct + reference(reference&&) = default; + //- Flip the bit at the position, no range-checking inline void flip(); @@ -474,7 +482,7 @@ public: //- Global position of the current \a on bit label pos_; - //- Construct null - an end iterator + //- Default construct - an end iterator inline const_iterator() noexcept; //- Construct begin iterator diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H index 9fc07ea5e8..3f15e87c25 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H @@ -206,7 +206,7 @@ public: // Constructors - //- Construct null with default (128) table capacity + //- Default construct with default (128) table capacity HashTable(); //- Construct given initial table capacity @@ -550,6 +550,7 @@ protected: class Iterator { public: + // Typedefs using iterator_category = std::forward_iterator_tag; using difference_type = this_type::difference_type; @@ -671,6 +672,7 @@ public: public Iterator { public: + // Typedefs using iterator_category = std::forward_iterator_tag; using difference_type = this_type::difference_type; @@ -684,8 +686,8 @@ public: // Constructors - //- Construct null (end iterator) - inline iterator() = default; + //- Default construct (end iterator) + iterator() = default; //- Copy construct from similar access type inline explicit iterator(const Iterator& iter) @@ -729,6 +731,7 @@ public: public Iterator { public: + // Typedefs using iterator_category = std::forward_iterator_tag; using difference_type = this_type::difference_type; @@ -741,8 +744,11 @@ public: // Constructors - //- Construct null (end iterator) - inline const_iterator() = default; + //- Default construct (end iterator) + const_iterator() = default; + + //- Copy construct + const_iterator(const const_iterator&) = default; //- Copy construct from similar access type inline explicit const_iterator(const Iterator& iter) @@ -781,8 +787,10 @@ public: inline const_iterator& operator++(); inline const_iterator operator++(int); + // Assignment + //- Copy assignment const_iterator& operator=(const const_iterator&) = default; // Allow assign from iterator to const_iterator @@ -805,6 +813,7 @@ public: public Iter { public: + using value_type = this_type::key_type; using reference = const Key&; diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H index 3c8bff4203..54f6a6276c 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -72,7 +72,7 @@ public: //- Pointer to next entry in list link* next_ = nullptr; - //- Null construct + //- Default construct link() = default; //- Check if the node is registered with the list @@ -85,7 +85,7 @@ public: private: - // Private Member Data + // Private Data //- Pointer to first element link *first_ = nullptr; @@ -97,15 +97,6 @@ private: label size_ = 0; - // Private Member Functions - - //- No copy construct - DLListBase(const DLListBase&) = delete; - - //- No copy assignment - void operator=(const DLListBase&) = delete; - - protected: // Protected Member Functions @@ -142,14 +133,19 @@ public: friend class const_iterator; - // Constructors + // Generated Methods - //- Null construct + //- Default construct DLListBase() = default; + //- No copy construct + DLListBase(const DLListBase&) = delete; - //- Destructor - ~DLListBase() = default; + //- No copy assignment + void operator=(const DLListBase&) = delete; + + //- Destructor + ~DLListBase() = default; // Member Functions @@ -233,6 +229,9 @@ public: public: + //- Copy construct + iterator(const iterator&) = default; + //- Construct for a node on a list inline iterator(DLListBase* list, link* item); @@ -280,15 +279,15 @@ public: public: + //- Copy construct + const_iterator(const const_iterator&) = default; + //- Construct for a node on a list inline const_iterator(const DLListBase* list, const link* item); //- Copy construct from a non-const iterator inline const_iterator(const DLListBase::iterator& iter); - //- Copy construct - const_iterator(const const_iterator&) = default; - //- The storage node inline const link* get_node() const; @@ -308,6 +307,7 @@ public: //- Move forward through list inline void next(); + //- Copy assignment const_iterator& operator=(const const_iterator&) = default; inline bool operator==(const const_iterator&) const; diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H index ccc7c9ab97..53e2b16da6 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -69,14 +69,14 @@ public: //- Pointer to next entry in list link* next_ = nullptr; - //- Null construct + //- Default construct link() = default; }; private: - // Private Member Data + // Private Data //- A pointer to the last element. // last_->next_ points to first element, i.e. circular storage @@ -86,15 +86,6 @@ private: label size_ = 0; - // Private Member Functions - - //- No copy construct - SLListBase(const SLListBase&) = delete; - - //- No copy assignment - void operator=(const SLListBase&) = delete; - - protected: // Protected Member Functions @@ -130,14 +121,19 @@ public: friend class const_iterator; - // Constructors + // Generated Methods - //- Null construct + //- Default construct SLListBase() = default; + //- No copy construct + SLListBase(const SLListBase&) = delete; - //- Destructor - ~SLListBase() = default; + //- No copy assignment + void operator=(const SLListBase&) = delete; + + //- Destructor + ~SLListBase() = default; // Member Functions @@ -209,6 +205,9 @@ public: public: + //- Copy construct + iterator(const iterator&) = default; + //- Construct for a node on the list inline iterator(SLListBase* list, link* item); @@ -231,6 +230,7 @@ public: //- Move forward through list inline void next(); + //- Copy assignment inline void operator=(const iterator& iter); inline bool operator==(const iterator& iter) const; @@ -254,15 +254,15 @@ public: public: + //- Copy construct + const_iterator(const const_iterator&) = default; + //- Construct for a node on the list inline const_iterator(const SLListBase* list, const link* item); //- Construct from a non-const iterator inline const_iterator(const SLListBase::iterator& iter); - //- Copy construct - const_iterator(const const_iterator&) = default; - //- The storage node inline const link* get_node() const; @@ -282,6 +282,7 @@ public: //- Move forward through list inline void next(); + //- Copy assignment const_iterator& operator=(const const_iterator&) = default; inline bool operator==(const const_iterator& iter) const; @@ -306,7 +307,6 @@ public: //- No reverse iteration const const_iterator& crend() const = delete; - }; diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H index 2f5e0b1e95..5c7ef7f958 100644 --- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H +++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -135,7 +135,7 @@ public: typedef std::reverse_iterator const_reverse_iterator; - // Static Member Functions + // Static Functions //- Return a null FixedList inline static const FixedList& null(); @@ -143,8 +143,8 @@ public: // Constructors - //- Null constructor - inline FixedList() = default; + //- Default construct + FixedList() = default; //- Construct and initialize all entries to given value inline explicit FixedList(const T& val); @@ -155,7 +155,7 @@ public: //- Copy construct from C-array inline explicit FixedList(const T list[N]); - //- Copy constructor + //- Copy construct inline FixedList(const FixedList& list); //- Move construct by using move assignment for the individual diff --git a/src/OpenFOAM/containers/Lists/SubList/SubList.H b/src/OpenFOAM/containers/Lists/SubList/SubList.H index 4d9773d706..02ab2d896e 100644 --- a/src/OpenFOAM/containers/Lists/SubList/SubList.H +++ b/src/OpenFOAM/containers/Lists/SubList/SubList.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -50,7 +50,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations template class SubList; // Common list types @@ -70,12 +70,18 @@ class SubList { public: - // Static Member Functions + // Static Functions //- Return a null SubList inline static const SubList& null(); + // Generated Methods + + //- Copy construct + SubList(const SubList&) = default; + + // Constructors //- Construct from UList, the entire size @@ -122,7 +128,7 @@ public: //- Copy assign entries from given sub-list inline void operator=(const SubList& list); - //- Copy assign entries to the given list + //- Copy assign entries from given list inline void operator=(const UList& list); //- Assign all entries to the given value diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index 3ce31eb20b..c8c131ba85 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -66,7 +66,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations class labelRange; template class List; template class SubList; @@ -87,7 +87,7 @@ typedef UList