STYLE: use constexpr for static const char strings

This commit is contained in:
Mark Olesen
2020-01-17 10:15:57 +01:00
parent f0be8679f6
commit 5d33586864
9 changed files with 8 additions and 15 deletions

View File

@ -38,9 +38,6 @@ namespace Foam
namespace constant
{
const char* const atomic::group = "atomic";
// Note: cannot use dimless etc. since not guaranteed to be constructed
defineDimensionedConstantWithDefault
(

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,7 +49,7 @@ namespace atomic
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for atomic constants
extern const char* const group;
constexpr const char* const group = "atomic";
//- Fine-structure constant: default SI units: []
extern const dimensionedScalar alpha;

View File

@ -38,9 +38,6 @@ namespace Foam
namespace constant
{
const char* const electromagnetic::group = "electromagnetic";
defineDimensionedConstantWithDefault
(
electromagnetic::group,

View File

@ -48,7 +48,7 @@ namespace electromagnetic
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for electromagnetic constants
extern const char* const group;
constexpr const char* const group = "electromagnetic";
//- Magnetic constant/permeability of free space: default SI units: [H/m]
extern const dimensionedScalar mu0;

View File

@ -48,6 +48,7 @@ namespace mathematical
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for mathematical constants
constexpr const char* const group = "mathematical";
constexpr scalar e(M_E);

View File

@ -39,8 +39,6 @@ namespace Foam
namespace constant
{
const char* const physicoChemical::group = "physicoChemical";
defineDimensionedConstantWithDefault
(
physicoChemical::group,

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,7 +49,7 @@ namespace physicoChemical
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for physico-chemical constants
extern const char* const group;
constexpr const char* const group = "physicoChemical";
//- Universal gas constant: default SI units: [J/mol/K]
extern const dimensionedScalar R;

View File

@ -36,9 +36,6 @@ namespace Foam
namespace constant
{
const char* const universal::group = "universal";
// Note: cannot use dimless etc. since not guaranteed to be constructed
defineDimensionedConstantWithDefault
(

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,7 +49,7 @@ namespace universal
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for universal constants
extern const char* const group;
constexpr const char* const group = "universal";
//- Reduced Planck constant: default SI units: [J/s]
extern const dimensionedScalar hr;