From e11c072bc4722ad53ab88aa1957faa74d600a36f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 20 Oct 2020 14:14:40 +0200 Subject: [PATCH] CONFIG: incorrect BC code templates (fixes #1885) - autoPtr to Function requires clone() method, not optional copy/move argument. - fix bad character range for 'sed' --- bin/foamNewBC | 2 +- etc/codeTemplates/BC/BC.C | 14 +++++------ etc/codeTemplates/BC/BC.H | 25 +++++++++---------- etc/codeTemplates/BC/BCs.C | 2 +- etc/codeTemplates/BC/BCs.H | 2 +- etc/codeTemplates/BC/BCsFwd.H | 2 +- etc/codeTemplates/app/app.C | 2 +- .../dynamicCode/codedPatchFunction1Template.C | 2 +- .../dynamicCode/functionObjectTemplate.H | 2 +- .../functionObject/FUNCTIONOBJECT.C | 2 +- etc/codeTemplates/source/_Template.H | 18 ++++++------- etc/codeTemplates/source/_TemplateI.H | 1 - .../template/_TemplateTemplate.H | 14 +++++------ .../template/_TemplateTemplateI.H | 1 - 14 files changed, 43 insertions(+), 46 deletions(-) diff --git a/bin/foamNewBC b/bin/foamNewBC index 5b5384a9cb..67bfad41ac 100755 --- a/bin/foamNewBC +++ b/bin/foamNewBC @@ -207,7 +207,7 @@ do sed -i \ -e '/^template$/d' \ -e 's/this->//g' \ - -e 's/\.template[\t ]*\([a-Z]\)/\.\1/g' \ + -e 's/\.template[\t ]*\([A-Za-z]\)/\.\1/g' \ -e '/#ifdef NoRepository/,/\/\/ */d' \ ${NAME}/${NEWFILE} ;; diff --git a/etc/codeTemplates/BC/BC.C b/etc/codeTemplates/BC/BC.C index a36fd713af..beeb273e14 100644 --- a/etc/codeTemplates/BC/BC.C +++ b/etc/codeTemplates/BC/BC.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) YEAR YEAR AUTHOR,AFFILIATION + Copyright (C) YEAR AUTHOR,AFFILIATION ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -51,7 +51,7 @@ CONSTRUCT ) : PARENT(p, iF), - scalarData_(0.0), + scalarData_(0), data_(Zero), fieldData_(p.size(), Zero), timeVsData_(), @@ -61,7 +61,7 @@ CONSTRUCT { this->refValue() = Zero; this->refGrad() = Zero; - this->valueFraction() = 0.0; + this->valueFraction() = Zero; } @@ -84,7 +84,7 @@ CONSTRUCT boolData_(false) { this->refGrad() = Zero; - this->valueFraction() = 0.0; + this->valueFraction() = Zero; this->refValue() = FIELD("fieldData", dict, p.size()); FVPATCHF::operator=(this->refValue()); @@ -116,7 +116,7 @@ CONSTRUCT scalarData_(ptf.scalarData_), data_(ptf.data_), fieldData_(ptf.fieldData_, mapper), - timeVsData_(ptf.timeVsData_, false), + timeVsData_(ptf.timeVsData_.clone()), wordData_(ptf.wordData_), labelData_(-1), boolData_(ptf.boolData_) @@ -134,7 +134,7 @@ CONSTRUCT scalarData_(ptf.scalarData_), data_(ptf.data_), fieldData_(ptf.fieldData_), - timeVsData_(ptf.timeVsData_, false), + timeVsData_(ptf.timeVsData_.clone()), wordData_(ptf.wordData_), labelData_(-1), boolData_(ptf.boolData_) @@ -153,7 +153,7 @@ CONSTRUCT scalarData_(ptf.scalarData_), data_(ptf.data_), fieldData_(ptf.fieldData_), - timeVsData_(ptf.timeVsData_, false), + timeVsData_(ptf.timeVsData_.clone()), wordData_(ptf.wordData_), labelData_(-1), boolData_(ptf.boolData_) diff --git a/etc/codeTemplates/BC/BC.H b/etc/codeTemplates/BC/BC.H index 636cad1113..8b1fb21796 100644 --- a/etc/codeTemplates/BC/BC.H +++ b/etc/codeTemplates/BC/BC.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) YEAR YEAR AUTHOR,AFFILIATION + Copyright (C) YEAR AUTHOR,AFFILIATION ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -47,12 +47,12 @@ Description Usage \table - Property | Description | Req'd? | Default - scalarData | single scalar value | yes | - data | single TYPE value | yes | - fieldData | TYPE field across patch | yes | - timeVsData | TYPE function of time | yes | - wordData | word, eg name of data object | no | wordDefault + Property | Description | Req'd | Default + scalarData | single scalar value | yes | + data | single TYPE value | yes | + fieldData | TYPE field across patch | yes | + timeVsData | TYPE function of time | yes | + wordData | word, eg name of data object | no | wordDefault \endtable Example of the boundary condition specification: @@ -97,7 +97,7 @@ class CONSTRUCT : public PARENT { - // Private data + // Private Data //- Single valued scalar quantity, e.g. a coefficient scalar scalarData_; @@ -152,8 +152,7 @@ public: const dictionary& ); - //- Construct by mapping given BASETypeFvPatchField - // onto a new patch + //- Construct by mapping onto a new patch CONSTRUCT ( const CLASS&, @@ -162,7 +161,7 @@ public: const fvPatchFieldMapper& ); - //- Construct as copy + //- Copy construct CONSTRUCT ( const CLASS& @@ -201,7 +200,7 @@ public: } - // Member functions + // Member Functions // Mapping functions @@ -226,7 +225,7 @@ public: //- Write - virtual void write(Ostream&) const; + virtual void write(Ostream& os) const; }; diff --git a/etc/codeTemplates/BC/BCs.C b/etc/codeTemplates/BC/BCs.C index 932b47f212..c45f74178b 100644 --- a/etc/codeTemplates/BC/BCs.C +++ b/etc/codeTemplates/BC/BCs.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) YEAR YEAR AUTHOR,AFFILIATION + Copyright (C) YEAR AUTHOR,AFFILIATION ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/etc/codeTemplates/BC/BCs.H b/etc/codeTemplates/BC/BCs.H index 68383803d7..f72f1bdd33 100644 --- a/etc/codeTemplates/BC/BCs.H +++ b/etc/codeTemplates/BC/BCs.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) YEAR YEAR AUTHOR,AFFILIATION + Copyright (C) YEAR AUTHOR,AFFILIATION ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/etc/codeTemplates/BC/BCsFwd.H b/etc/codeTemplates/BC/BCsFwd.H index 14ff789164..4dce0ebca4 100644 --- a/etc/codeTemplates/BC/BCsFwd.H +++ b/etc/codeTemplates/BC/BCsFwd.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) YEAR YEAR AUTHOR,AFFILIATION + Copyright (C) YEAR AUTHOR,AFFILIATION ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/etc/codeTemplates/app/app.C b/etc/codeTemplates/app/app.C index 49ae9b0f31..4851af3885 100644 --- a/etc/codeTemplates/app/app.C +++ b/etc/codeTemplates/app/app.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) YEAR YEAR AUTHOR,AFFILIATION + Copyright (C) YEAR AUTHOR,AFFILIATION ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/etc/codeTemplates/dynamicCode/codedPatchFunction1Template.C b/etc/codeTemplates/dynamicCode/codedPatchFunction1Template.C index de80fee7a3..79bc49b9ed 100644 --- a/etc/codeTemplates/dynamicCode/codedPatchFunction1Template.C +++ b/etc/codeTemplates/dynamicCode/codedPatchFunction1Template.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) YEAR YEAR AUTHOR,AFFILIATION + Copyright (C) YEAR AUTHOR,AFFILIATION ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/etc/codeTemplates/dynamicCode/functionObjectTemplate.H b/etc/codeTemplates/dynamicCode/functionObjectTemplate.H index f8c036fe57..e56ae69538 100644 --- a/etc/codeTemplates/dynamicCode/functionObjectTemplate.H +++ b/etc/codeTemplates/dynamicCode/functionObjectTemplate.H @@ -46,7 +46,7 @@ ${codeInclude} namespace Foam { -// Forward declarations +// Forward Declarations class fvMesh; /*---------------------------------------------------------------------------*\ diff --git a/etc/codeTemplates/functionObject/FUNCTIONOBJECT.C b/etc/codeTemplates/functionObject/FUNCTIONOBJECT.C index e6cb9ceb6c..07606e89c3 100644 --- a/etc/codeTemplates/functionObject/FUNCTIONOBJECT.C +++ b/etc/codeTemplates/functionObject/FUNCTIONOBJECT.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) YEAR YEAR AUTHOR,AFFILIATION + Copyright (C) YEAR AUTHOR,AFFILIATION ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/etc/codeTemplates/source/_Template.H b/etc/codeTemplates/source/_Template.H index 4cbc6bb3af..e1bc727580 100644 --- a/etc/codeTemplates/source/_Template.H +++ b/etc/codeTemplates/source/_Template.H @@ -45,11 +45,11 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations class Istream; class Ostream; - class CLASSNAME; + Istream& operator>>(Istream&, CLASSNAME&); Ostream& operator<<(Ostream&, const CLASSNAME&); @@ -87,7 +87,7 @@ public: // Generated Methods -// //- Construct null +// //- Default construct // CLASSNAME() = default; // // //- Copy construct @@ -99,22 +99,22 @@ public: // Constructors - //- Construct null + //- Default construct CLASSNAME(); //- Construct from components CLASSNAME(const dataType& data); - //- Construct from Istream - CLASSNAME(Istream& is); - - //- Construct as copy + //- Copy construct CLASSNAME(const CLASSNAME&); + //- Construct from Istream + explicit CLASSNAME(Istream& is); + // Selectors - //- Select null constructed + //- Select default constructed static autoPtr New(); diff --git a/etc/codeTemplates/source/_TemplateI.H b/etc/codeTemplates/source/_TemplateI.H index 1eaba0830c..89c847f54a 100644 --- a/etc/codeTemplates/source/_TemplateI.H +++ b/etc/codeTemplates/source/_TemplateI.H @@ -25,7 +25,6 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/etc/codeTemplates/template/_TemplateTemplate.H b/etc/codeTemplates/template/_TemplateTemplate.H index 7d6500b666..9efb942478 100644 --- a/etc/codeTemplates/template/_TemplateTemplate.H +++ b/etc/codeTemplates/template/_TemplateTemplate.H @@ -45,7 +45,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations class someClass; template @@ -90,7 +90,7 @@ public: // Generated Methods -// //- Construct null +// //- Default construct // CLASSNAME() = default; // // //- Copy construct @@ -102,22 +102,22 @@ public: // Constructors - //- Construct null + //- Default construct CLASSNAME(); //- Construct from components CLASSNAME(const dataType& data); - //- Construct from Istream - CLASSNAME(Istream& is); - //- Construct as copy CLASSNAME(const CLASSNAME&); + //- Construct from Istream + explicit CLASSNAME(Istream& is); + // Selectors - //- Select null constructed + //- Select default constructed static autoPtr> New(); diff --git a/etc/codeTemplates/template/_TemplateTemplateI.H b/etc/codeTemplates/template/_TemplateTemplateI.H index 1eaba0830c..89c847f54a 100644 --- a/etc/codeTemplates/template/_TemplateTemplateI.H +++ b/etc/codeTemplates/template/_TemplateTemplateI.H @@ -25,7 +25,6 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //