From 7b3eb9da1407f7ffc32d8e48f1ebe70260d76bef Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 16 Jul 2009 13:17:40 +0200 Subject: [PATCH 01/14] needed to drop backwardsCompatibility/derivedFvPatchFields again - as Henry pointed out, they all go into one single table. So they'll clash with the correct incompressible versions. --- .../compressible/RAS/Make/files | 2 - ...urbulentMixingLengthDissipationRateInlet.C | 156 ----------------- ...urbulentMixingLengthDissipationRateInlet.H | 158 ----------------- ...ilityTurbulentMixingLengthFrequencyInlet.C | 163 ------------------ ...ilityTurbulentMixingLengthFrequencyInlet.H | 162 ----------------- .../incompressible/RAS/Make/files | 2 +- .../backwardsCompatibilityWallFunctions.C | 0 .../backwardsCompatibilityWallFunctions.H | 0 ...wardsCompatibilityWallFunctionsTemplates.C | 0 9 files changed, 1 insertion(+), 642 deletions(-) delete mode 100644 src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet.C delete mode 100644 src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet.H delete mode 100644 src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthFrequencyInlet.C delete mode 100644 src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthFrequencyInlet.H rename src/turbulenceModels/incompressible/RAS/{backwardsCompatibilityWallFunctions => backwardsCompatibility/wallFunctions}/backwardsCompatibilityWallFunctions.C (100%) rename src/turbulenceModels/incompressible/RAS/{backwardsCompatibilityWallFunctions => backwardsCompatibility/wallFunctions}/backwardsCompatibilityWallFunctions.H (100%) rename src/turbulenceModels/incompressible/RAS/{backwardsCompatibilityWallFunctions => backwardsCompatibility/wallFunctions}/backwardsCompatibilityWallFunctionsTemplates.C (100%) diff --git a/src/turbulenceModels/compressible/RAS/Make/files b/src/turbulenceModels/compressible/RAS/Make/files index 56644ea6d3..7642142d56 100644 --- a/src/turbulenceModels/compressible/RAS/Make/files +++ b/src/turbulenceModels/compressible/RAS/Make/files @@ -38,7 +38,5 @@ derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLe derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C -backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet.C -backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthFrequencyInlet.C LIB = $(FOAM_LIBBIN)/libcompressibleRASModels diff --git a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet.C b/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet.C deleted file mode 100644 index 83902514a0..0000000000 --- a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet.C +++ /dev/null @@ -1,156 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2006-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet.H" -#include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" -#include "surfaceFields.H" -#include "volFields.H" -#include "RASModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField:: -backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - fixedValueFvPatchField(p, iF), - mixingLength_(0.001) -{} - -backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField:: -backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField -( - const backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchField(ptf, p, iF, mapper), - mixingLength_(ptf.mixingLength_) -{} - -backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField:: -backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - fixedValueFvPatchField(p, iF, dict), - mixingLength_(readScalar(dict.lookup("mixingLength"))) -{} - -backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField:: -backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField -( - const backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf -) -: - fixedValueFvPatchField(ptf), - mixingLength_(ptf.mixingLength_) -{} - -backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField:: -backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField -( - const backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf, - const DimensionedField& iF -) -: - fixedValueFvPatchField(ptf, iF), - mixingLength_(ptf.mixingLength_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - // Lookup Cmu corresponding to the turbulence model selected - const RASModel& rasModel = db().lookupObject("RASProperties"); - - const scalar Cmu = readScalar(rasModel.coeffDict().lookup("Cmu")); - const scalar Cmu75 = pow(Cmu, 0.75); - - const fvPatchField& kp = - patch().lookupPatchField("k"); - - operator==(Cmu75*kp*sqrt(kp)/mixingLength_); - - fixedValueFvPatchField::updateCoeffs(); -} - - -void backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField::write -( - Ostream& os -) const -{ - // write with prefix for forwards compatibility - // mimic - fvPatchField::write(os); - - os.writeKeyword("type") - << "compressible::" << type() << token::END_STATEMENT << nl; - - os.writeKeyword("mixingLength") - << mixingLength_ << token::END_STATEMENT << nl; - writeEntry("value", os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet.H b/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet.H deleted file mode 100644 index fec530e1fc..0000000000 --- a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet.H +++ /dev/null @@ -1,158 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2006-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::compressible:: - backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField - -Description - Compatibility for the new namespace qualifier - Foam::compressible::turbulentMixingLengthDissipationRateInletFvPatchScalarField - -SourceFiles - backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet.C - -\*---------------------------------------------------------------------------*/ - -#ifndef backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet_H -#define backwardsCompatibilityTurbulentMixingLengthDissipationRateInlet_H - -#include "fixedValueFvPatchFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ - -/*---------------------------------------------------------------------------*\ - Class backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField -: - public fixedValueFvPatchScalarField -{ - // Private data - - //- turbulent length scale - scalar mixingLength_; - -public: - - //- Runtime type information - TypeName("turbulentMixingLengthDissipationRateInlet"); - - - // Constructors - - //- Construct from patch and internal field - backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField - // onto a new patch - backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField - ( - const backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField - ( - const backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField& - ); - - //- Construct and return a clone - virtual tmp clone() const - { - return tmp - ( - new backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField - ( - *this - ) - ); - } - - //- Construct as copy setting internal field reference - backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField - ( - const backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new backwardsCompatibilityTurbulentMixingLengthDissipationRateInletFvPatchScalarField - ( - *this, - iF - ) - ); - } - - - // Member functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthFrequencyInlet.C b/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthFrequencyInlet.C deleted file mode 100644 index e9e1cd11b4..0000000000 --- a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthFrequencyInlet.C +++ /dev/null @@ -1,163 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2006-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "backwardsCompatibilityTurbulentMixingLengthFrequencyInlet.H" -#include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" -#include "surfaceFields.H" -#include "volFields.H" -#include "RASModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField:: -backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - fixedValueFvPatchField(p, iF), - mixingLength_(0.0), - kName_("k") -{} - -backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField:: -backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField -( - const backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchField(ptf, p, iF, mapper), - mixingLength_(ptf.mixingLength_), - kName_(ptf.kName_) -{} - -backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField:: -backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - fixedValueFvPatchField(p, iF, dict), - mixingLength_(readScalar(dict.lookup("mixingLength"))), - kName_(dict.lookupOrDefault("k", "k")) -{} - -backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField:: -backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField -( - const backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField& ptf -) -: - fixedValueFvPatchField(ptf), - mixingLength_(ptf.mixingLength_), - kName_(ptf.kName_) -{} - -backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField:: -backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField -( - const backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField& ptf, - const DimensionedField& iF -) -: - fixedValueFvPatchField(ptf, iF), - mixingLength_(ptf.mixingLength_), - kName_(ptf.kName_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - // Lookup Cmu corresponding to the turbulence model selected - const RASModel& rasModel = db().lookupObject("RASProperties"); - - const scalar Cmu = readScalar(rasModel.coeffDict().lookup("Cmu")); - const scalar Cmu25 = pow(Cmu, 0.25); - - const fvPatchField& kp = - patch().lookupPatchField(kName_); - - operator==(sqrt(kp)/(Cmu25*mixingLength_)); - - fixedValueFvPatchField::updateCoeffs(); -} - - -void backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField::write -( - Ostream& os -) const -{ - // write with prefix for forwards compatibility - // mimic - fvPatchField::write(os); - - os.writeKeyword("type") - << "compressible::" << type() << token::END_STATEMENT << nl; - - os.writeKeyword("mixingLength") - << mixingLength_ << token::END_STATEMENT << nl; - - os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl; - writeEntry("value", os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthFrequencyInlet.H b/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthFrequencyInlet.H deleted file mode 100644 index ebe6e5445e..0000000000 --- a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/derivedFvPatchFields/backwardsCompatibilityTurbulentMixingLengthFrequencyInlet.H +++ /dev/null @@ -1,162 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2006-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Class - Foam::compressible:: - backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField - -Description - Compatibility for the new namespace qualifier - Foam::compressible::turbulentMixingLengthFrequencyInletFvPatchScalarField - -SourceFiles - backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef compressiblebackwardsCompatibilityTurbulentMixingLengthFrequencyInlet_H -#define compressiblebackwardsCompatibilityTurbulentMixingLengthFrequencyInlet_H - -#include "fixedValueFvPatchFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ - -/*---------------------------------------------------------------------------*\ - Class backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField -: - public fixedValueFvPatchScalarField -{ - // Private data - - //- Turbulent length scale - scalar mixingLength_; - - //- Name of the turbulent kinetic energy field - word kName_; - - -public: - - //- Runtime type information - TypeName("turbulentMixingLengthFrequencyInlet"); - - - // Constructors - - //- Construct from patch and internal field - backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField - // onto a new patch - backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField - ( - const backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField - ( - const backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField& - ); - - //- Construct and return a clone - virtual tmp clone() const - { - return tmp - ( - new backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField - ( - *this - ) - ); - } - - //- Construct as copy setting internal field reference - backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField - ( - const backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new backwardsCompatibilityTurbulentMixingLengthFrequencyInletFvPatchScalarField - ( - *this, - iF - ) - ); - } - - - // Member functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/Make/files b/src/turbulenceModels/incompressible/RAS/Make/files index d5736d3064..95322d4f68 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/files +++ b/src/turbulenceModels/incompressible/RAS/Make/files @@ -42,6 +42,6 @@ derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFv derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C -backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C +backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C LIB = $(FOAM_LIBBIN)/libincompressibleRASModels diff --git a/src/turbulenceModels/incompressible/RAS/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C b/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C similarity index 100% rename from src/turbulenceModels/incompressible/RAS/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C rename to src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C diff --git a/src/turbulenceModels/incompressible/RAS/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.H b/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.H similarity index 100% rename from src/turbulenceModels/incompressible/RAS/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.H rename to src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.H diff --git a/src/turbulenceModels/incompressible/RAS/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctionsTemplates.C b/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctionsTemplates.C similarity index 100% rename from src/turbulenceModels/incompressible/RAS/backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctionsTemplates.C rename to src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctionsTemplates.C From 33358fd38332f71ba772cac447ccac5a221012fb Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 16 Jul 2009 13:32:40 +0200 Subject: [PATCH 02/14] fix wmake bug introduced by a9699afbb46a764d05b98276ca58c267794f9b8d - skip including java rather than having recursive includes (and too many files open error) when WM_JAVAC_OPTION isn't defined. --- wmake/rules/General/java | 3 ++- wmake/rules/General/standard | 4 ++-- wmake/rules/linuxmingw32/general | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wmake/rules/General/java b/wmake/rules/General/java index 4f5db4ce84..e2dd6ced7d 100644 --- a/wmake/rules/General/java +++ b/wmake/rules/General/java @@ -2,7 +2,8 @@ javac = javac -include $(GENERAL_RULES)/java$(WM_JAVAC_OPTION) +## avoid recursive include if WM_JAVAC_OPTION isn't defined +## include $(GENERAL_RULES)/java$(WM_JAVAC_OPTION) javaFLAGS = -classpath $(CLASS_PATH):$(CLASSES_DIR):. $(EXE_INC) $(javaOPT) $(javaDBUG) -d $(CLASSES_DIR) -deprecation diff --git a/wmake/rules/General/standard b/wmake/rules/General/standard index 7752bef084..679070ca25 100644 --- a/wmake/rules/General/standard +++ b/wmake/rules/General/standard @@ -5,7 +5,7 @@ include $(GENERAL_RULES)/sourceToDep include $(GENERAL_RULES)/java include $(GENERAL_RULES)/flex include $(GENERAL_RULES)/flex++ -#include $(GENERAL_RULES)/byacc -#include $(GENERAL_RULES)/btyacc++ +## include $(GENERAL_RULES)/byacc +## include $(GENERAL_RULES)/btyacc++ include $(GENERAL_RULES)/bison include $(GENERAL_RULES)/moc diff --git a/wmake/rules/linuxmingw32/general b/wmake/rules/linuxmingw32/general index 27ccb3c9db..27938b3de0 100644 --- a/wmake/rules/linuxmingw32/general +++ b/wmake/rules/linuxmingw32/general @@ -20,6 +20,6 @@ include $(RULES)/c++ SO = dll EXE_EXT = .exe -# Ensure we know what OS we are compiling for +# Ensure we know what OS we are compiling for # during MakefileFiles and MakefileOptions GFLAGS += -DWIN32 -DLITTLE_ENDIAN From 5cca4df2f03129a84a4074db3c993c056625a32e Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 17 Jul 2009 17:20:54 +0200 Subject: [PATCH 03/14] finalize wmake/utilbin/ -> wmake/bin/ change - update foamPack* scripts accordingly --- bin/foamPack | 2 +- bin/foamPackBin | 2 +- bin/foamPackSource | 2 +- wmake/Makefile | 4 +++- wmake/makeWmake | 2 +- wmake/src/Makefile | 28 +++++++++++++++++----------- 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/bin/foamPack b/bin/foamPack index 3f35f5b57d..02258a4ee4 100755 --- a/bin/foamPack +++ b/bin/foamPack @@ -89,7 +89,7 @@ find -H $packDir \ -e "\@$packDir/lib/@d" \ -e '\@/\.git/@d' \ -e '\@applications/bin/@d' \ - -e '\@wmake/utilbin/@d' \ + -e '\@wmake/bin/@d' \ -e '\@/t/@d' \ -e '\@Make[.A-Za-z]*/[^/]*/@d' \ -e '\@doc/[Dd]oxygen/html@d' \ diff --git a/bin/foamPackBin b/bin/foamPackBin index 5a60b405a9..00d60ba5f0 100755 --- a/bin/foamPackBin +++ b/bin/foamPackBin @@ -76,7 +76,7 @@ dirList=$( $packDir/lib/$arch \ $packDir/applications/bin/$arch \ $packDir/wmake/rules \ - $packDir/wmake/utilbin/$baseArch \ + $packDir/wmake/bin/$baseArch \ ; do [ -d $dir ] && echo $dir diff --git a/bin/foamPackSource b/bin/foamPackSource index b5e34c8a04..dbb1860bca 100755 --- a/bin/foamPackSource +++ b/bin/foamPackSource @@ -82,7 +82,7 @@ find -H $packDir \ -e '\@/\.git/@d' \ -e '\@/\.tags/@d' \ -e '\@applications/bin/@d' \ - -e '\@wmake/utilbin/@d' \ + -e '\@wmake/bin/@d' \ -e '\@/t/@d' \ -e '\@/Make[.A-Za-z]*/[^/]*/@d'\ -e '\@/platforms/@d' \ diff --git a/wmake/Makefile b/wmake/Makefile index ae4fd43f13..28b7015b71 100644 --- a/wmake/Makefile +++ b/wmake/Makefile @@ -29,7 +29,9 @@ # Generic Makefile used by wmake # #------------------------------------------------------------------------------ -# Set shell the Makefile uses to the Bourne shell + +#------------------------------------------------------------------------------ +# The Makefile use a POSIX shell #------------------------------------------------------------------------------ SHELL = /bin/sh diff --git a/wmake/makeWmake b/wmake/makeWmake index 30a6565095..21386f41be 100755 --- a/wmake/makeWmake +++ b/wmake/makeWmake @@ -34,6 +34,6 @@ # run from this directory only cd ${0%/*} || exit 1 -( cd src && make ) +( cd src && make $@ ) #------------------------------------------------------------------------------ diff --git a/wmake/src/Makefile b/wmake/src/Makefile index d764aeba88..a74c250f88 100644 --- a/wmake/src/Makefile +++ b/wmake/src/Makefile @@ -43,7 +43,22 @@ SHELL = /bin/sh .SUFFIXES: .SUFFIXES: .o -BIN = $(WM_DIR)/bin/$(WM_ARCH)$(WM_COMPILER) + +#------------------------------------------------------------------------------ +# set compilation and dependency building rules +#------------------------------------------------------------------------------ + +GENERAL_RULES = $(WM_DIR)/rules/General +RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) +BIN = $(WM_DIR)/bin/$(WM_ARCH)$(WM_COMPILER) + +include $(RULES)/general +include $(RULES)/$(WM_LINK_LANGUAGE) + + +#------------------------------------------------------------------------------ +# targets +#------------------------------------------------------------------------------ all: $(BIN)/dirToString $(BIN)/wmkdep @@ -59,16 +74,7 @@ $(BIN)/wmkdep: wmkdep.l @mkdir -p $(BIN) flex wmkdep.l $(cc) $(cFLAGS) lex.yy.c -o $(BIN)/wmkdep + @rm -f lex.yy.c 2>/dev/null -#------------------------------------------------------------------------------ -# set compilation and dependency building rules -#------------------------------------------------------------------------------ - -GENERAL_RULES = $(WM_DIR)/rules/General -RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) - -include $(RULES)/general -include $(RULES)/$(WM_LINK_LANGUAGE) - #------------------------------------------------------------------------------ From f48b841973f7d72e1df755cb506b43fbb263ac59 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 20 Jul 2009 09:15:30 +0200 Subject: [PATCH 04/14] mkdep rule was still using utilbin/ directory --- wmake/rules/General/sourceToDep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wmake/rules/General/sourceToDep b/wmake/rules/General/sourceToDep index f98c8f8cf4..8434835a5a 100644 --- a/wmake/rules/General/sourceToDep +++ b/wmake/rules/General/sourceToDep @@ -1,6 +1,6 @@ .SUFFIXES: .c .cc .cxx .cpp .C .F .f .dep -MKDEP = $(UTILBIN)/wmkdep -I$(*D) $(LIB_HEADER_DIRS) +MKDEP = $(BIN)/wmkdep -I$(*D) $(LIB_HEADER_DIRS) .c.dep: $(MAKE_DEP) From 359f14ae919c7179a47a27af254138108ee349a4 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 20 Jul 2009 08:48:46 +0200 Subject: [PATCH 05/14] pass optional checkGzip through POSIX::exists() as well --- src/OSspecific/POSIX/POSIX.C | 24 +++++++++---------- src/OpenFOAM/include/OSspecific.H | 3 ++- .../fvMeshDistribute/fvMeshDistribute.C | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 09b3182b52..8496225b29 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -474,20 +474,20 @@ Foam::fileName::Type Foam::type(const fileName& name) // Does the name exist in the filing system? -bool Foam::exists(const fileName& name) +bool Foam::exists(const fileName& name, const bool checkGzip) { - return mode(name) || isFile(name); + return mode(name) || isFile(name, checkGzip); } -// Does the directory exist +// Does the directory exist? bool Foam::isDir(const fileName& name) { return S_ISDIR(mode(name)); } -// Does the file exist +// Does the file exist? bool Foam::isFile(const fileName& name, const bool checkGzip) { return S_ISREG(mode(name)) || (checkGzip && S_ISREG(mode(name + ".gz"))); @@ -757,31 +757,31 @@ bool Foam::ln(const fileName& src, const fileName& dst) // Rename srcFile dstFile -bool Foam::mv(const fileName& srcFile, const fileName& dstFile) +bool Foam::mv(const fileName& src, const fileName& dst) { if (POSIX::debug) { - Info<< "Move : " << srcFile << " to " << dstFile << endl; + Info<< "Move : " << src << " to " << dst << endl; } if ( - dstFile.type() == fileName::DIRECTORY - && srcFile.type() != fileName::DIRECTORY + dst.type() == fileName::DIRECTORY + && src.type() != fileName::DIRECTORY ) { - const fileName dstName(dstFile/srcFile.name()); + const fileName dstName(dst/src.name()); - return rename(srcFile.c_str(), dstName.c_str()) == 0; + return rename(src.c_str(), dstName.c_str()) == 0; } else { - return rename(srcFile.c_str(), dstFile.c_str()) == 0; + return rename(src.c_str(), dst.c_str()) == 0; } } -// Remove a file returning true if successful otherwise false +// Remove a file, returning true if successful otherwise false bool Foam::rm(const fileName& file) { if (POSIX::debug) diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H index d04243c23d..946cf0f86d 100644 --- a/src/OpenFOAM/include/OSspecific.H +++ b/src/OpenFOAM/include/OSspecific.H @@ -119,7 +119,8 @@ mode_t mode(const fileName&); fileName::Type type(const fileName&); //- Does the name exist (as DIRECTORY or FILE) in the file system? -bool exists(const fileName&); +// Optionally enable/disable check for gzip file. +bool exists(const fileName&, const bool checkGzip=true); //- Does the name exist as a DIRECTORY in the file system? bool isDir(const fileName&); diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index 74993262d4..633c39f478 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -928,7 +928,7 @@ Foam::labelList Foam::fvMeshDistribute::mapBoundaryData { label newFaceI = map.oldFaceMap()[oldBFaceI + map.nOldInternalFaces()]; - // Face still exists (is nessecary?) and still boundary face + // Face still exists (is necessary?) and still boundary face if (newFaceI >= 0 && newFaceI >= mesh.nInternalFaces()) { newBoundaryData[newFaceI - mesh.nInternalFaces()] = From 8ff026095d087286fbf9e63e7d5e52f145d95933 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 20 Jul 2009 11:04:48 +0200 Subject: [PATCH 06/14] added mvBak() to POSIX - Rename to a corresponding backup file If the backup file already exists, attempt with "01" .. "99" suffix. - git ignore indexed backup files too --- .gitignore | 13 ++--- applications/test/mvBak/Make/files | 3 ++ applications/test/mvBak/Make/options | 2 + applications/test/mvBak/mvBakTest.C | 81 ++++++++++++++++++++++++++++ src/OSspecific/POSIX/POSIX.C | 39 ++++++++++++++ src/OpenFOAM/include/OSspecific.H | 16 +++--- 6 files changed, 142 insertions(+), 12 deletions(-) create mode 100644 applications/test/mvBak/Make/files create mode 100644 applications/test/mvBak/Make/options create mode 100644 applications/test/mvBak/mvBakTest.C diff --git a/.gitignore b/.gitignore index 032fac43eb..bcbd35cfdf 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,13 @@ # editor and misc backup files - anywhere *~ .*~ -*.orig *.bak +*.bak[0-9][0-9] +*.orig +*.orig[0-9][0-9] \#*\# + +# file-browser settings - anywhere .directory # CVS recovered versions - anywhere @@ -18,7 +22,7 @@ *.so *.jar -# ignore derived files +# derived files lex.yy.c # Corefiles @@ -30,7 +34,7 @@ core # lnInclude (symlink) folders - anywhere lnInclude -# build folder(s) - anywhere +# build folders - anywhere linux*Gcc*/ linux*Icc*/ linuxming*/ @@ -38,9 +42,6 @@ SiCortex*Gcc*/ solaris*Gcc*/ SunOS*Gcc*/ -# all of the wmake wmkdep and dirToString binaries -wmake/bin - # doxygen generated documentation doc/[Dd]oxygen/html doc/[Dd]oxygen/latex diff --git a/applications/test/mvBak/Make/files b/applications/test/mvBak/Make/files new file mode 100644 index 0000000000..6cf0b98c5b --- /dev/null +++ b/applications/test/mvBak/Make/files @@ -0,0 +1,3 @@ +mvBakTest.C + +EXE = $(FOAM_USER_APPBIN)/mvBakTest diff --git a/applications/test/mvBak/Make/options b/applications/test/mvBak/Make/options new file mode 100644 index 0000000000..6a9e9810b3 --- /dev/null +++ b/applications/test/mvBak/Make/options @@ -0,0 +1,2 @@ +/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */ +/* EXE_LIBS = -lfiniteVolume */ diff --git a/applications/test/mvBak/mvBakTest.C b/applications/test/mvBak/mvBakTest.C new file mode 100644 index 0000000000..6580ed421c --- /dev/null +++ b/applications/test/mvBak/mvBakTest.C @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + +\*---------------------------------------------------------------------------*/ + +#include "OSspecific.H" +#include "argList.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + argList::noBanner(); + argList::noParallel(); + argList::validArgs.insert("file .. fileN"); + argList::validOptions.erase("case"); + argList::validOptions.insert("ext", "bak"); + + argList args(argc, argv, false, true); + + if (args.additionalArgs().empty()) + { + args.printUsage(); + } + + label ok = 0; + + forAll(args.additionalArgs(), argI) + { + const string& srcFile = args.additionalArgs()[argI]; + + if (args.optionFound("ext")) + { + if (mvBak(srcFile, args.option("ext"))) + { + ok++; + } + } + else + { + if (mvBak(srcFile)) + { + ok++; + } + } + } + + Info<< "mvBak called for " << args.additionalArgs().size() + << " files (moved " << ok << ")\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 8496225b29..3f64d413c3 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -781,6 +781,45 @@ bool Foam::mv(const fileName& src, const fileName& dst) } +//- Rename to a corresponding backup file +// If the backup file already exists, attempt with "01" .. "99" index +bool Foam::mvBak(const fileName& src, const std::string& ext) +{ + if (POSIX::debug) + { + Info<< "mvBak : " << src << " to extension " << ext << endl; + } + + if (exists(src, false)) + { + const int maxIndex = 99; + char index[3]; + + for (int n = 0; n <= maxIndex; n++) + { + fileName dstName(src + "." + ext); + if (n) + { + sprintf(index, "%02d", n); + dstName += index; + } + + // avoid overwriting existing files, except for the last + // possible index where we have no choice + if (!exists(dstName, false) || n == maxIndex) + { + return rename(src.c_str(), dstName.c_str()) == 0; + } + + } + } + + // fall-through: nothing to do + return false; +} + + + // Remove a file, returning true if successful otherwise false bool Foam::rm(const fileName& file) { diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H index 946cf0f86d..b34d374d72 100644 --- a/src/OpenFOAM/include/OSspecific.H +++ b/src/OpenFOAM/include/OSspecific.H @@ -144,15 +144,19 @@ fileNameList readDir ); //- Copy, recursively if necessary, the source to the destination -bool cp(const fileName& srcFile, const fileName& destFile); +bool cp(const fileName& src, const fileName& dst); -//- Create a softlink. destFile should not exist. Returns true if successful. -bool ln(const fileName& srcFile, const fileName& destFile); +//- Create a softlink. dst should not exist. Returns true if successful. +bool ln(const fileName& src, const fileName& dst); -//- Rename srcFile destFile -bool mv(const fileName& srcFile, const fileName& destFile); +//- Rename src to dst +bool mv(const fileName& src, const fileName& dst); -//- Remove a file returning true if successful otherwise false +//- Rename to a corresponding backup file +// If the backup file already exists, attempt with "01" .. "99" suffix +bool mvBak(const fileName&, const std::string& ext = "bak"); + +//- Remove a file, returning true if successful otherwise false bool rm(const fileName&); //- Remove a dirctory and its contents From dc3ebcfb16660f4a334553be088feb5a12a90a78 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 20 Jul 2009 11:10:59 +0200 Subject: [PATCH 07/14] Use new mvBak() in a few places to avoid hammering existing files --- applications/utilities/preProcessing/mapFields/UnMapped.H | 2 +- .../backwardsCompatibilityWallFunctionsTemplates.C | 2 +- .../backwardsCompatibilityWallFunctionsTemplates.C | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/utilities/preProcessing/mapFields/UnMapped.H b/applications/utilities/preProcessing/mapFields/UnMapped.H index 0a43f1ac5a..fe216498c5 100644 --- a/applications/utilities/preProcessing/mapFields/UnMapped.H +++ b/applications/utilities/preProcessing/mapFields/UnMapped.H @@ -47,7 +47,7 @@ void UnMapped(const IOobjectList& objects) ++fieldIter ) { - mv(fieldIter()->objectPath(), fieldIter()->objectPath() + ".unmapped"); + mvBak(fieldIter()->objectPath(), "unmapped"); } } diff --git a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctionsTemplates.C b/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctionsTemplates.C index 91f739abfb..24c0fe8fb1 100644 --- a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctionsTemplates.C +++ b/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctionsTemplates.C @@ -104,7 +104,7 @@ autoCreateWallFunctionField // rename file Info<< " Backup original " << fieldName << " to " << fieldName << ".old" << endl; - mv(ioObj.objectPath(), ioObj.objectPath() + ".old"); + mvBak(ioObj.objectPath(), "old"); PtrList > newPatchFields(mesh.boundary().size()); diff --git a/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctionsTemplates.C b/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctionsTemplates.C index 10247d493e..f5b057f8aa 100644 --- a/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctionsTemplates.C +++ b/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctionsTemplates.C @@ -104,7 +104,7 @@ autoCreateWallFunctionField // rename file Info<< " Backup original " << fieldName << " to " << fieldName << ".old" << endl; - mv(ioObj.objectPath(), ioObj.objectPath() + ".old"); + mvBak(ioObj.objectPath(), "old"); PtrList > newPatchFields(mesh.boundary().size()); From 4f6f570d6d9bb0073024c6745bc370e90a2d5e7a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 21 Jul 2009 08:44:25 +0200 Subject: [PATCH 08/14] versatility improvement: #includeIfPresent dictionary directive - similar to the #include directive, but does not generate an error if the file does not exist. Note: opted for an explicit naming #includeIfPresent rather than #cinclude --- ReleaseNotes-1.6 | 2 + applications/test/dictionary/testDict | 1 + src/OpenFOAM/Make/files | 1 + .../includeEntry/includeEntry.C | 3 +- .../includeEntry/includeEntry.H | 10 +- .../includeIfPresentEntry.C | 101 ++++++++++++++++++ .../includeIfPresentEntry.H | 101 ++++++++++++++++++ 7 files changed, 215 insertions(+), 4 deletions(-) create mode 100644 src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.C create mode 100644 src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H diff --git a/ReleaseNotes-1.6 b/ReleaseNotes-1.6 index 7227dac4fe..78a3f045a7 100644 --- a/ReleaseNotes-1.6 +++ b/ReleaseNotes-1.6 @@ -58,6 +58,8 @@ their keywords. When searching, an exact match has priority over a regular expression match. Multiple regular expressions are matched in reverse order. + + The *new* =#includeIfPresent= directive is similar to the =#include= + directive, but does not generate an error if the file does not exist. + The default =#inputMode= is now '=merge=', which corresponds to the most general usage. The =#inputMode warn= corresponds to the previous default behaviour. diff --git a/applications/test/dictionary/testDict b/applications/test/dictionary/testDict index 7709155fec..6a0863a454 100644 --- a/applications/test/dictionary/testDict +++ b/applications/test/dictionary/testDict @@ -78,6 +78,7 @@ boundaryField // NB: the inputMode has a global scope #inputMode merge #include "testDict2" +#includeIfPresent "SomeUnknownFile" foo { diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 9d1daeeeef..8e2f04c359 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -132,6 +132,7 @@ $(dictionaryEntry)/dictionaryEntryIO.C functionEntries = $(dictionary)/functionEntries $(functionEntries)/functionEntry/functionEntry.C $(functionEntries)/includeEntry/includeEntry.C +$(functionEntries)/includeIfPresentEntry/includeIfPresentEntry.C $(functionEntries)/inputModeEntry/inputModeEntry.C $(functionEntries)/removeEntry/removeEntry.C diff --git a/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.C b/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.C index 2d49418fae..66148e27f3 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.C @@ -62,7 +62,7 @@ namespace functionEntries } } -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // +// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // Foam::fileName Foam::functionEntries::includeEntry::includeFileName ( @@ -112,6 +112,7 @@ bool Foam::functionEntries::includeEntry::execute } } + bool Foam::functionEntries::includeEntry::execute ( const dictionary& parentDict, diff --git a/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.H b/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.H index 6fc94aa1ad..80dcaa75af 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.H +++ b/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.H @@ -67,15 +67,19 @@ class includeEntry { // Private Member Functions - //- Read the include fileName from Istream, expand and return - static fileName includeFileName(Istream&); - //- Disallow default bitwise copy construct includeEntry(const includeEntry&); //- Disallow default bitwise assignment void operator=(const includeEntry&); +protected: + + // Protected Member Functions + + //- Read the include fileName from Istream, expand and return + static fileName includeFileName(Istream&); + public: diff --git a/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.C b/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.C new file mode 100644 index 0000000000..9fc1ea1727 --- /dev/null +++ b/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.C @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "includeIfPresentEntry.H" +#include "dictionary.H" +#include "IFstream.H" +#include "addToMemberFunctionSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +const Foam::word Foam::functionEntries::includeIfPresentEntry::typeName +( + Foam::functionEntries::includeIfPresentEntry::typeName_() +); + +// Don't lookup the debug switch here as the debug switch dictionary +// might include includeIfPresentEntry +int Foam::functionEntries::includeIfPresentEntry::debug(0); + +namespace Foam +{ +namespace functionEntries +{ + addToMemberFunctionSelectionTable + ( + functionEntry, + includeIfPresentEntry, + execute, + dictionaryIstream + ); + + addToMemberFunctionSelectionTable + ( + functionEntry, + includeIfPresentEntry, + execute, + primitiveEntryIstream + ); +} +} + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::functionEntries::includeIfPresentEntry::execute +( + dictionary& parentDict, + Istream& is +) +{ + IFstream ifs(includeFileName(is)); + + if (ifs) + { + parentDict.read(ifs); + } + + return true; +} + + +bool Foam::functionEntries::includeIfPresentEntry::execute +( + const dictionary& parentDict, + primitiveEntry& entry, + Istream& is +) +{ + IFstream ifs(includeFileName(is)); + + if (ifs) + { + entry.read(parentDict, ifs); + } + + return true; +} + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H b/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H new file mode 100644 index 0000000000..751de7dba2 --- /dev/null +++ b/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::functionEntries::includeIfPresentEntry + +Description + Specify a file to include if it exists. Expects a single string to follow. + + The @c \#includeIfPresent directive is similar to the @c \#include + directive, but does not generate an error if the file does not exist. + +See Also + Foam::functionEntries::includeEntry + +SourceFiles + includeIfPresentEntry.C + +\*---------------------------------------------------------------------------*/ + +#ifndef includeIfPresentEntry_H +#define includeIfPresentEntry_H + +#include "includeEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionEntries +{ + +/*---------------------------------------------------------------------------*\ + Class includeIfPresentEntry Declaration +\*---------------------------------------------------------------------------*/ + +class includeIfPresentEntry +: + public includeEntry +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + includeIfPresentEntry(const includeIfPresentEntry&); + + //- Disallow default bitwise assignment + void operator=(const includeIfPresentEntry&); + +public: + + //- Runtime type information + ClassName("includeIfPresent"); + + + // Member Functions + + //- Execute the functionEntry in a sub-dict context + static bool execute(dictionary& parentDict, Istream&); + + //- Execute the functionEntry in a primitiveEntry context + static bool execute + ( + const dictionary& parentDict, + primitiveEntry&, + Istream& + ); + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace functionEntries +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 7215571eb7ab836f1ddfb750c9ab6391405cae38 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 21 Jul 2009 08:59:49 +0200 Subject: [PATCH 09/14] updated wmakeLnIncludeAll - search for 'lnInclude' rather than 'Make' by default This gives better general behaviour for rebuilding. --- wmake/wmakeLnIncludeAll | 64 ++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/wmake/wmakeLnIncludeAll b/wmake/wmakeLnIncludeAll index da803f288e..fe3adbdce3 100755 --- a/wmake/wmakeLnIncludeAll +++ b/wmake/wmakeLnIncludeAll @@ -27,38 +27,68 @@ # wmakeLnIncludeAll # # Description -# Find directories containing a Make/ directory and execute +# Find directories containing an lnInclude/ directory and execute # 'wmakeLnInclude -f' for each one # #------------------------------------------------------------------------------ -# default is pwd -if [ "$#" -eq 0 ] -then - set -- . -elif [ "$1" = "-h" -o "$1" = "-help" ] -then - echo "Usage: ${0##*/} [dir1] .. [dirN]" - echo - echo " Find directories containing a Make/ directory and" - echo " execute 'wmakeLnInclude -f' for each one" - echo - exit 1 -fi +usage() { + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat< Date: Tue, 21 Jul 2009 13:29:39 +0100 Subject: [PATCH 10/14] rewriting empty boundary conditions --- .../isoSurface/isoSurfaceTemplates.C | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C b/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C index d7903551c9..bddf6fedf2 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C @@ -96,11 +96,18 @@ Foam::isoSurface::adaptPatchFields sliceFld ) ); - sliceFld.boundaryField()[patchI] == - mesh.boundary()[patchI].patchInternalField - ( - sliceFld - ); + + // Note: cannot use patchInternalField since uses emptyFvPatch::size + // Do our own internalField instead. + const unallocLabelList& faceCells = + mesh.boundary()[patchI].patch().faceCells(); + + Field& pfld = sliceFld.boundaryField()[patchI]; + pfld.setSize(faceCells.size()); + forAll(faceCells, i) + { + pfld[i] = sliceFld[faceCells[i]]; + } } else if (isA(pp)) { From d069739d17db2d2a97c89302c779a2c73c6aecb9 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 21 Jul 2009 16:50:15 +0100 Subject: [PATCH 11/14] changed comment --- .../redistributeMeshPar/redistributeMeshPar.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C index c0859573e0..40db19f4b3 100644 --- a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C +++ b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C @@ -26,7 +26,14 @@ Application redistributeMeshPar Description - Parallel redecomposition of mesh. + Parallel redecomposition of mesh. Start with maximum number of processors. + Balances mesh and writes new mesh to new timedirectory. + + Can also work like decomposePar: + + mkdir processor0 + cp -r constant processor0 + mpirun -np ddd redistributeMeshPar -parallel \*---------------------------------------------------------------------------*/ From 4bf0ae136c6698c038b6c25e4d51a6a31bd963e0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 21 Jul 2009 16:51:21 +0100 Subject: [PATCH 12/14] empty handling --- .../isoSurface/isoSurfaceTemplates.C | 6 ++- .../sampledCuttingPlane/sampledCuttingPlane.C | 53 ++++++++++++++++--- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C b/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C index bddf6fedf2..1a7a68ad4c 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurfaceTemplates.C @@ -81,7 +81,11 @@ Foam::isoSurface::adaptPatchFields { const polyPatch& pp = patches[patchI]; - if (isA(pp)) + if + ( + isA(pp) + && pp.size() != sliceFld.boundaryField()[patchI].size() + ) { // Clear old value. Cannot resize it since is a slice. sliceFld.boundaryField().set(patchI, NULL); diff --git a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C index 85dbeca595..2bcf3784b6 100644 --- a/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C +++ b/src/sampling/sampledSurface/sampledCuttingPlane/sampledCuttingPlane.C @@ -37,7 +37,13 @@ License namespace Foam { defineTypeNameAndDebug(sampledCuttingPlane, 0); - addNamedToRunTimeSelectionTable(sampledSurface, sampledCuttingPlane, word, cuttingPlane); + addNamedToRunTimeSelectionTable + ( + sampledSurface, + sampledCuttingPlane, + word, + cuttingPlane + ); } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -118,7 +124,7 @@ void Foam::sampledCuttingPlane::createGeometry() // Internal field { - const pointField& cc = fvm.C(); + const pointField& cc = fvm.cellCentres(); scalarField& fld = cellDistance.internalField(); forAll(cc, i) @@ -130,14 +136,45 @@ void Foam::sampledCuttingPlane::createGeometry() // Patch fields { - forAll(fvm.C().boundaryField(), patchI) + forAll(cellDistance.boundaryField(), patchI) { - const pointField& cc = fvm.C().boundaryField()[patchI]; - fvPatchScalarField& fld = cellDistance.boundaryField()[patchI]; - - forAll(fld, i) + if + ( + isA + ( + cellDistance.boundaryField()[patchI] + ) + ) { - fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal(); + cellDistance.boundaryField().set + ( + patchI, + new calculatedFvPatchScalarField + ( + fvm.boundary()[patchI], + cellDistance + ) + ); + + const polyPatch& pp = fvm.boundary()[patchI].patch(); + pointField::subField cc = pp.patchSlice(fvm.faceCentres()); + + fvPatchScalarField& fld = cellDistance.boundaryField()[patchI]; + fld.setSize(pp.size()); + forAll(fld, i) + { + fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal(); + } + } + else + { + const pointField& cc = fvm.C().boundaryField()[patchI]; + fvPatchScalarField& fld = cellDistance.boundaryField()[patchI]; + + forAll(fld, i) + { + fld[i] = (cc[i] - plane_.refPoint()) & plane_.normal(); + } } } } From 18fef89f39c7cba33e57f4db3be2f5e62c1b87ea Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 21 Jul 2009 16:51:39 +0100 Subject: [PATCH 13/14] construct cloud from components --- .../basic/passiveParticle/passiveParticleCloud.C | 11 +++++++++++ .../basic/passiveParticle/passiveParticleCloud.H | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/lagrangian/basic/passiveParticle/passiveParticleCloud.C b/src/lagrangian/basic/passiveParticle/passiveParticleCloud.C index 18844ffcea..ebb67d26de 100644 --- a/src/lagrangian/basic/passiveParticle/passiveParticleCloud.C +++ b/src/lagrangian/basic/passiveParticle/passiveParticleCloud.C @@ -52,6 +52,17 @@ Foam::passiveParticleCloud::passiveParticleCloud } +Foam::passiveParticleCloud::passiveParticleCloud +( + const polyMesh& mesh, + const word& cloudName, + const IDLList& particles +) +: + Cloud(mesh, cloudName, particles) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::passiveParticleCloud::readFields() diff --git a/src/lagrangian/basic/passiveParticle/passiveParticleCloud.H b/src/lagrangian/basic/passiveParticle/passiveParticleCloud.H index b8faac8f43..e3c0266fa3 100644 --- a/src/lagrangian/basic/passiveParticle/passiveParticleCloud.H +++ b/src/lagrangian/basic/passiveParticle/passiveParticleCloud.H @@ -63,6 +63,9 @@ class passiveParticleCloud public: + //- Type of parcel the cloud was instantiated for + typedef passiveParticle parcelType; + // Constructors //- Construct given mesh @@ -72,6 +75,14 @@ public: const word& cloudName = "defaultCloud" ); + //- Construct from mesh, cloud name, and a list of particles + passiveParticleCloud + ( + const polyMesh& mesh, + const word& cloudName, + const IDLList& particles + ); + // Member Functions From dedabab18f28d63f2ea463d5ba23f4613554ad13 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 21 Jul 2009 17:28:27 +0100 Subject: [PATCH 14/14] expose name of functionObjects --- .../OutputFilterFunctionObject.C | 7 +++---- .../OutputFilterFunctionObject.H | 9 --------- .../functionObjects/functionObject/functionObject.C | 10 +++++++++- .../functionObjects/functionObject/functionObject.H | 13 +++++++++++-- .../functionObjectList/functionObjectList.H | 3 +++ 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C index 15a32c1e8e..4e3bf3fad6 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C @@ -50,8 +50,7 @@ Foam::OutputFilterFunctionObject::OutputFilterFunctionObject const dictionary& dict ) : - functionObject(), - name_(name), + functionObject(name), time_(t), dict_(dict), regionName_(polyMesh::defaultRegion), @@ -92,7 +91,7 @@ bool Foam::OutputFilterFunctionObject::start() ( new IOOutputFilter ( - name_, + name(), time_.lookupObject(regionName_), dictName_ ) @@ -104,7 +103,7 @@ bool Foam::OutputFilterFunctionObject::start() ( new OutputFilter ( - name_, + name(), time_.lookupObject(regionName_), dict_ ) diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H index 9ac00bd060..f6c183e803 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H @@ -63,9 +63,6 @@ class OutputFilterFunctionObject { // Private data - //- Output filter name - word name_; - //- Reference to the time database const Time& time_; @@ -121,12 +118,6 @@ public: // Access - //- Return name - virtual const word& name() const - { - return name_; - } - //- Return time database virtual const Time& time() const { diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C index a731621ff6..3157cea04b 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C @@ -36,7 +36,9 @@ int Foam::functionObject::debug(Foam::debug::debugSwitch("functionObject", 0)); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::functionObject::functionObject() +Foam::functionObject::functionObject(const word& name) +: + name_(name) {} @@ -103,6 +105,12 @@ Foam::functionObject::~functionObject() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const Foam::word& Foam::functionObject::name() const +{ + return name_; +} + + bool Foam::functionObject::end() { return execute(); diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H index 94a2f7aea4..8757c3adbc 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H @@ -57,6 +57,12 @@ class Time; class functionObject { + // Private data + + //- Name + const word name_; + + // Private Member Functions //- Disallow default bitwise copy construct @@ -88,8 +94,8 @@ public: // Constructors - //- Construct null - functionObject(); + //- Construct from components + functionObject(const word& name); //- Return clone autoPtr clone() const @@ -137,6 +143,9 @@ public: // Member Functions + //- Name + virtual const word& name() const; + //- Called at the start of the time-loop virtual bool start() = 0; diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H index ea2c43adf3..0b3a035464 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H @@ -133,6 +133,9 @@ public: //- Return true if the List is empty (ie, size() is zero). using PtrList::empty; + //- Access to the functionObjects + using PtrList::operator[]; + //- Clear the list of function objects virtual void clear();