From 12d965ead980c1fd6510cd82a0ef36936e58e1c1 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 11 Mar 2011 09:08:45 +0100 Subject: [PATCH] STYLE: more constness on const char* values --- .../dynamicCode/fixedValueFvPatchScalarFieldTemplate.C | 3 ++- .../dynamicCode/fixedValueFvPatchScalarFieldTemplate.H | 2 +- src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C | 4 ++-- src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H | 4 ++-- src/OpenFOAM/global/constants/atomic/atomicConstants.C | 7 ++----- src/OpenFOAM/global/constants/atomic/atomicConstants.H | 7 ++----- .../constants/electromagnetic/electromagneticConstants.C | 6 ++---- .../constants/electromagnetic/electromagneticConstants.H | 6 ++---- .../global/constants/mathematical/mathematicalConstants.H | 4 ++-- .../constants/physicoChemical/physicoChemicalConstants.C | 4 ++-- .../constants/physicoChemical/physicoChemicalConstants.H | 8 ++------ .../global/constants/universal/universalConstants.C | 5 ++--- .../global/constants/universal/universalConstants.H | 5 ++--- src/conversion/meshReader/starcd/STARCDMeshReader.C | 6 +++--- src/conversion/meshReader/starcd/STARCDMeshReader.H | 6 +++--- 15 files changed, 31 insertions(+), 46 deletions(-) diff --git a/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C b/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C index 280ee4810d..d41c4162e6 100644 --- a/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C +++ b/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C @@ -76,7 +76,8 @@ makeRemovablePatchTypeField ); -const char* ${typeName}FixedValueFvPatchScalarField::SHA1sum = "${SHA1sum}"; +const char* const ${typeName}FixedValueFvPatchScalarField::SHA1sum = + "${SHA1sum}"; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.H b/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.H index 742a9ca01b..9fe2d88f70 100644 --- a/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.H +++ b/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.H @@ -56,7 +56,7 @@ class ${typeName}FixedValueFvPatchScalarField public: //- Information about the SHA1 of the code itself - static const char* SHA1sum; + static const char* const SHA1sum; //- Runtime type information TypeName("${typeName}"); diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C index 00b94cb426..f09ddd297f 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C @@ -48,10 +48,10 @@ const Foam::word Foam::dynamicCode::codeTemplateEnvName const Foam::fileName Foam::dynamicCode::codeTemplateDirName = "codeTemplates/dynamicCode"; -const char* Foam::dynamicCode::libTargetRoot = +const char* const Foam::dynamicCode::libTargetRoot = "LIB = $(PWD)/../platforms/$(WM_OPTIONS)/lib/lib"; -const char* Foam::dynamicCode::topDirName = "dynamicCode"; +const char* const Foam::dynamicCode::topDirName = "dynamicCode"; // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H index 75764aca3a..0d7a3fb969 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H @@ -106,10 +106,10 @@ protected: // Static data members //- Root of the LIB target for Make/files - static const char* libTargetRoot; + static const char* const libTargetRoot; //- Top-level directory name for copy/compiling - static const char* topDirName; + static const char* const topDirName; // Protected Member Functions diff --git a/src/OpenFOAM/global/constants/atomic/atomicConstants.C b/src/OpenFOAM/global/constants/atomic/atomicConstants.C index 027ebc7367..95cb4bfdcd 100644 --- a/src/OpenFOAM/global/constants/atomic/atomicConstants.C +++ b/src/OpenFOAM/global/constants/atomic/atomicConstants.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,7 +32,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -const char* Foam::constant::atomic::group = "atomic"; +const char* const Foam::constant::atomic::group = "atomic"; const Foam::dimensionedScalar Foam::constant::atomic::alpha @@ -129,6 +129,3 @@ const Foam::dimensionedScalar Foam::constant::atomic::Eh // ************************************************************************* // - - - diff --git a/src/OpenFOAM/global/constants/atomic/atomicConstants.H b/src/OpenFOAM/global/constants/atomic/atomicConstants.H index b49c57822c..2758a7d8b5 100644 --- a/src/OpenFOAM/global/constants/atomic/atomicConstants.H +++ b/src/OpenFOAM/global/constants/atomic/atomicConstants.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,7 @@ namespace atomic // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //- Group name for atomic constants - extern const char* group; + extern const char* const group; //- Fine-structure constant: default SI units: [] extern const dimensionedScalar alpha; @@ -75,6 +75,3 @@ namespace atomic #endif // ************************************************************************* // - - - diff --git a/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C index 69040f77ee..db1e4e6264 100644 --- a/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C +++ b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,7 +32,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -const char* Foam::constant::electromagnetic::group = "electromagnetic"; +const char* const Foam::constant::electromagnetic::group = "electromagnetic"; const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0 @@ -164,5 +164,3 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::RK // ************************************************************************* // - - diff --git a/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H index 2dee7e423f..4646cb86a5 100644 --- a/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H +++ b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,7 @@ namespace electromagnetic // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //- Group name for electromagnetic constants - extern const char* group; + extern const char* const group; //- Magnetic constant/permeability of free space: default SI units: [H/m] extern const dimensionedScalar mu0; @@ -84,5 +84,3 @@ namespace electromagnetic #endif // ************************************************************************* // - - diff --git a/src/OpenFOAM/global/constants/mathematical/mathematicalConstants.H b/src/OpenFOAM/global/constants/mathematical/mathematicalConstants.H index 3f29fd34d7..68ba1248ee 100644 --- a/src/OpenFOAM/global/constants/mathematical/mathematicalConstants.H +++ b/src/OpenFOAM/global/constants/mathematical/mathematicalConstants.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,7 +45,7 @@ namespace mathematical // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - static word group = "mathematical"; + static const char* const group = "mathematical"; const scalar e(M_E); const scalar pi(M_PI); diff --git a/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C index 8269c1d9a8..9376e9bccf 100644 --- a/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C +++ b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,7 +32,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -const char* Foam::constant::physicoChemical::group = "physicoChemical"; +const char* const Foam::constant::physicoChemical::group = "physicoChemical"; const Foam::dimensionedScalar Foam::constant::physicoChemical::R diff --git a/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H index 13f61d7352..22dada66a9 100644 --- a/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H +++ b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,7 @@ namespace physicoChemical // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //- Group name for physico-chemical constants - extern const char* group; + extern const char* const group; //- Universal gas constant: default SI units: [J/mol/K] extern const dimensionedScalar R; @@ -78,7 +78,3 @@ namespace physicoChemical #endif // ************************************************************************* // - - - - diff --git a/src/OpenFOAM/global/constants/universal/universalConstants.C b/src/OpenFOAM/global/constants/universal/universalConstants.C index e2139daae6..c7886cbefd 100644 --- a/src/OpenFOAM/global/constants/universal/universalConstants.C +++ b/src/OpenFOAM/global/constants/universal/universalConstants.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,7 +30,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -const char* Foam::constant::universal::group = "universal"; +const char* const Foam::constant::universal::group = "universal"; const Foam::dimensionedScalar Foam::constant::universal::hr @@ -49,4 +49,3 @@ const Foam::dimensionedScalar Foam::constant::universal::hr // ************************************************************************* // - diff --git a/src/OpenFOAM/global/constants/universal/universalConstants.H b/src/OpenFOAM/global/constants/universal/universalConstants.H index acf374bad4..014c5f7f02 100644 --- a/src/OpenFOAM/global/constants/universal/universalConstants.H +++ b/src/OpenFOAM/global/constants/universal/universalConstants.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,7 @@ namespace universal // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //- Group name for universal constants - extern const char* group; + extern const char* const group; //- Reduced Planck constant: default SI units: [J/s] extern const dimensionedScalar hr; @@ -62,4 +62,3 @@ namespace universal #endif // ************************************************************************* // - diff --git a/src/conversion/meshReader/starcd/STARCDMeshReader.C b/src/conversion/meshReader/starcd/STARCDMeshReader.C index 39073a7b7e..789a87efd9 100644 --- a/src/conversion/meshReader/starcd/STARCDMeshReader.C +++ b/src/conversion/meshReader/starcd/STARCDMeshReader.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,10 +35,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const char* Foam::meshReaders::STARCD::defaultBoundaryName = +const char* const Foam::meshReaders::STARCD::defaultBoundaryName = "Default_Boundary_Region"; -const char* Foam::meshReaders::STARCD::defaultSolidBoundaryName = +const char* const Foam::meshReaders::STARCD::defaultSolidBoundaryName = "Default_Boundary_Solid"; bool Foam::meshReaders::STARCD::keepSolids = false; diff --git a/src/conversion/meshReader/starcd/STARCDMeshReader.H b/src/conversion/meshReader/starcd/STARCDMeshReader.H index 3d33dba557..b18647fc12 100644 --- a/src/conversion/meshReader/starcd/STARCDMeshReader.H +++ b/src/conversion/meshReader/starcd/STARCDMeshReader.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,8 +68,8 @@ protected: // Protected Data - static const char* defaultBoundaryName; - static const char* defaultSolidBoundaryName; + static const char* const defaultBoundaryName; + static const char* const defaultSolidBoundaryName; //- Face addressing from pro-STAR faces -> OpenFOAM faces static const int starToFoamFaceAddr[4][6];