Skip to content

Commit 8b8cf69

Browse files
author
Henry Weller
committed
word, dictionary: Moved construction of static members to global.Cver
1 parent ace868a commit 8b8cf69

File tree

10 files changed

+93
-30
lines changed

10 files changed

+93
-30
lines changed

src/OpenFOAM/db/dictionary/dictionary.C

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,6 @@ License
3030
#include "unitConversion.H"
3131
#include "stringOps.H"
3232

33-
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
34-
35-
namespace Foam
36-
{
37-
defineTypeNameAndDebug(dictionary, 0);
38-
}
39-
40-
const Foam::dictionary Foam::dictionary::null;
41-
42-
int Foam::dictionary::writeOptionalEntries
43-
(
44-
Foam::debug::infoSwitch("writeOptionalEntries", 0)
45-
);
46-
47-
4833
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
4934

5035
const Foam::entry* Foam::dictionary::lookupScopedSubEntryPtr

src/OpenFOAM/db/dictionary/dictionary.H

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Description
4040
objectRegistry itself to work.
4141
4242
SourceFiles
43+
dictionaryStatics.C
4344
dictionary.C
4445
dictionaryIO.C
4546
dictionaryTemplates.C
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*---------------------------------------------------------------------------*\
2+
========= |
3+
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4+
\\ / O peration | Website: https://openfoam.org
5+
\\ / A nd | Copyright (C) 2011-2025 OpenFOAM Foundation
6+
\\/ M anipulation |
7+
-------------------------------------------------------------------------------
8+
License
9+
This file is part of OpenFOAM.
10+
11+
OpenFOAM is free software: you can redistribute it and/or modify it
12+
under the terms of the GNU General Public License as published by
13+
the Free Software Foundation, either version 3 of the License, or
14+
(at your option) any later version.
15+
16+
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19+
for more details.
20+
21+
You should have received a copy of the GNU General Public License
22+
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23+
24+
\*---------------------------------------------------------------------------*/
25+
26+
#include "dictionary.H"
27+
28+
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
29+
30+
namespace Foam
31+
{
32+
defineTypeNameAndDebug(dictionary, 0);
33+
}
34+
35+
const Foam::dictionary Foam::dictionary::null;
36+
37+
int Foam::dictionary::writeOptionalEntries
38+
(
39+
Foam::debug::infoSwitch("writeOptionalEntries", 0)
40+
);
41+
42+
// ************************************************************************* //

src/OpenFOAM/global/constants/dimensionedConstants.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Foam::dimensionedScalar Foam::dimensionedConstant
122122

123123
if (!dict.found(group))
124124
{
125-
dict.add(group, dictionary());
125+
dict.add(group, dictionary::null);
126126
}
127127

128128
dict.subDict(group).add(entryName, dimensionedValue);
@@ -163,7 +163,7 @@ Foam::dimensionedScalar Foam::dimensionedConstant
163163

164164
if (!dict.found(group))
165165
{
166-
dict.add(group, dictionary());
166+
dict.add(group, dictionary::null);
167167
}
168168

169169
dict.subDict(group).add(entryName, dimensionedValue);

src/OpenFOAM/global/global.Cver

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
========= |
33
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
44
\\ / O peration | Website: https://openfoam.org
5-
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2011-2025 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -70,6 +70,12 @@ bool Foam::jobInfo::constructed(false);
7070

7171
#include "debug.C"
7272

73+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74+
// Initialise static members
75+
76+
#include "wordStatics.C"
77+
#include "dictionaryStatics.C"
78+
7379
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
7480
// Read file modification checking switches
7581

src/OpenFOAM/primitives/functions/Function1/Coded/CodedFunction1.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const Foam::wordList Foam::Function1s::Coded<Type>::codeKeys
3838
template<class Type>
3939
const Foam::wordList Foam::Function1s::Coded<Type>::codeDictVars
4040
(
41-
{word(), word()}
41+
{word::null, word::null}
4242
);
4343

4444

src/OpenFOAM/primitives/functions/Function2/Coded/CodedFunction2.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const Foam::wordList Foam::Function2s::Coded<Type>::codeKeys
3838
template<class Type>
3939
const Foam::wordList Foam::Function2s::Coded<Type>::codeDictVars
4040
(
41-
{word(), word()}
41+
{word::null, word::null}
4242
);
4343

4444

src/OpenFOAM/primitives/strings/word/word.C

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
========= |
33
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
44
\\ / O peration | Website: https://openfoam.org
5-
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2011-2025 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -24,14 +24,6 @@ License
2424
\*---------------------------------------------------------------------------*/
2525

2626
#include "word.H"
27-
#include "debug.H"
28-
29-
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30-
31-
const char* const Foam::word::typeName = "word";
32-
int Foam::word::debug(Foam::debug::debugSwitch(word::typeName, 0));
33-
const Foam::word Foam::word::null;
34-
3527

3628
// * * * * * * * * * * * * * * * IOstream Functions * * * * * * * * * * * * //
3729

src/OpenFOAM/primitives/strings/word/word.H

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
========= |
33
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
44
\\ / O peration | Website: https://openfoam.org
5-
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2011-2025 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -31,6 +31,7 @@ Description
3131
semicolons or brace brackets. Words are delimited by whitespace.
3232
3333
SourceFiles
34+
wordStatics.C
3435
word.C
3536
wordIO.C
3637
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*---------------------------------------------------------------------------*\
2+
========= |
3+
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4+
\\ / O peration | Website: https://openfoam.org
5+
\\ / A nd | Copyright (C) 2011-2025 OpenFOAM Foundation
6+
\\/ M anipulation |
7+
-------------------------------------------------------------------------------
8+
License
9+
This file is part of OpenFOAM.
10+
11+
OpenFOAM is free software: you can redistribute it and/or modify it
12+
under the terms of the GNU General Public License as published by
13+
the Free Software Foundation, either version 3 of the License, or
14+
(at your option) any later version.
15+
16+
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19+
for more details.
20+
21+
You should have received a copy of the GNU General Public License
22+
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23+
24+
\*---------------------------------------------------------------------------*/
25+
26+
#include "word.H"
27+
#include "debug.H"
28+
29+
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30+
31+
const char* const Foam::word::typeName = "word";
32+
int Foam::word::debug(Foam::debug::debugSwitch(word::typeName, 0));
33+
const Foam::word Foam::word::null;
34+
35+
36+
// ************************************************************************* //

0 commit comments

Comments
 (0)