Skip to content

Commit 4186409

Browse files
author
Henry Weller
committed
polyTopoChange::modifyCell: Replaced by direct specification of the cell zone
1 parent d9cb938 commit 4186409

File tree

19 files changed

+151
-126
lines changed

19 files changed

+151
-126
lines changed

applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,23 +1257,6 @@ int main(int argc, char *argv[])
12571257
);
12581258
}
12591259

1260-
// Modify cells to be in zones as required
1261-
forAll(cellZoneIDs, cellZonei)
1262-
{
1263-
label cgi = cellZoneIDs[cellZonei];
1264-
1265-
for
1266-
(
1267-
label celli = cellGroupStartIndex[cgi];
1268-
celli <= cellGroupEndIndex[cgi];
1269-
celli++
1270-
)
1271-
{
1272-
meshMod.modifyCell(celli, cellZonei);
1273-
}
1274-
}
1275-
1276-
12771260
bool doneWarning = false;
12781261

12791262
// Add faceZone faces
@@ -1462,6 +1445,21 @@ int main(int argc, char *argv[])
14621445
polyMeshUnMergeCyclics(mesh);
14631446
}
14641447

1448+
// Add the cell zones as required
1449+
forAll(cellZoneIDs, cellZonei)
1450+
{
1451+
const label cgi = cellZoneIDs[cellZonei];
1452+
1453+
mesh.cellZones()[cellZonei].insert
1454+
(
1455+
identityMap
1456+
(
1457+
cellGroupStartIndex[cgi],
1458+
cellGroupEndIndex[cgi] + 1 - cellGroupStartIndex[cgi]
1459+
)
1460+
);
1461+
}
1462+
14651463
mesh.setInstance(runTime.constant());
14661464

14671465
// Set the precision of the points data to 10

applications/utilities/mesh/manipulation/createPatch/createPatch.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ int main(int argc, char *argv[])
500500
forAll(patchSources, addedI)
501501
{
502502
const dictionary& dict = patchSources[addedI];
503-
addedPatchNames.insert(dict.lookup("name"));
503+
addedPatchNames.insert(dict.lookup<word>("name"));
504504
}
505505

506506

applications/utilities/postProcessing/foamPostProcess/foamPostProcess.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ int main(int argc, char *argv[])
305305
}
306306
if (args.optionFound("field"))
307307
{
308-
requiredFields.insert(args.optionLookup("field")());
308+
requiredFields.insert(word(args.optionLookup("field")()));
309309
}
310310
}
311311

src/OpenFOAM/containers/HashTables/HashSet/HashSet.C

Lines changed: 21 additions & 5 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-2020 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -67,12 +67,12 @@ Foam::HashSet<Key, Hash>::HashSet
6767
for
6868
(
6969
typename HashTable<AnyType, Key, AnyHash>::const_iterator
70-
cit = h.cbegin();
71-
cit != h.cend();
72-
++cit
70+
iter = h.cbegin();
71+
iter != h.cend();
72+
++iter
7373
)
7474
{
75-
this->insert(cit.key());
75+
this->insert(iter.key());
7676
}
7777
}
7878

@@ -110,6 +110,22 @@ Foam::label Foam::HashSet<Key, Hash>::insert(const UList<Key>& lst)
110110
}
111111

112112

113+
template<class Key, class Hash>
114+
Foam::label Foam::HashSet<Key, Hash>::insert(const HashSet<Key>& set)
115+
{
116+
label count = 0;
117+
for (const_iterator iter = set.cbegin(); iter != set.cend(); ++iter)
118+
{
119+
if (this->insert(iter.key()))
120+
{
121+
++count;
122+
}
123+
}
124+
125+
return count;
126+
}
127+
128+
113129
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
114130

115131
template<class Key, class Hash>

src/OpenFOAM/containers/HashTables/HashSet/HashSet.H

Lines changed: 5 additions & 3 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-2021 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -106,8 +106,6 @@ public:
106106

107107
// Member Functions
108108

109-
// Edit
110-
111109
//- Insert a new entry
112110
bool insert(const Key& key)
113111
{
@@ -118,6 +116,10 @@ public:
118116
// Return the number of new elements inserted
119117
label insert(const UList<Key>&);
120118

119+
//- Insert keys from a HashSet of Key
120+
// Return the number of new elements inserted
121+
label insert(const HashSet<Key>&);
122+
121123
//- Same as insert (cannot overwrite nil content)
122124
bool set(const Key& key)
123125
{

src/OpenFOAM/containers/HashTables/HashTable/HashTable.C

Lines changed: 21 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-2021 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -305,6 +305,26 @@ bool Foam::HashTable<T, Key, Hash>::set
305305
}
306306

307307

308+
template<class T, class Key, class Hash>
309+
void Foam::HashTable<T, Key, Hash>::insert(const HashTable<T, Key, Hash>& ht)
310+
{
311+
for (const_iterator iter = ht.cbegin(); iter != ht.cend(); ++iter)
312+
{
313+
insert(iter.key(), *iter);
314+
}
315+
}
316+
317+
318+
template<class T, class Key, class Hash>
319+
void Foam::HashTable<T, Key, Hash>::set(const HashTable<T, Key, Hash>& ht)
320+
{
321+
for (const_iterator iter = ht.cbegin(); iter != ht.cend(); ++iter)
322+
{
323+
set(iter.key(), *iter);
324+
}
325+
}
326+
327+
308328
template<class T, class Key, class Hash>
309329
bool Foam::HashTable<T, Key, Hash>::iteratorBase::erase()
310330
{

src/OpenFOAM/containers/HashTables/HashTable/HashTable.H

Lines changed: 9 additions & 2 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-2022 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -259,9 +259,16 @@ public:
259259
//- Insert a new hashedEntry
260260
inline bool insert(const Key&, const T& newElmt);
261261

262-
//- Assign a new hashedEntry, overwriting existing entries
262+
//- Insert all the entries from the given HashTable
263+
void insert(const HashTable<T, Key, Hash>&);
264+
265+
//- Set a new hashedEntry, overwriting existing entries
263266
inline bool set(const Key&, const T& newElmt);
264267

268+
//- Insert all the entries from the given HashTable,
269+
// overwriting existing entries
270+
void set(const HashTable<T, Key, Hash>&);
271+
265272
//- Erase a hashedEntry specified by given iterator
266273
// This invalidates the iterator until the next operator++
267274
bool erase(const iterator&);

src/OpenFOAM/containers/Lists/ListOps/ListOps.C

Lines changed: 13 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-2023 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -113,4 +113,16 @@ Foam::labelList Foam::identityMap(const label len)
113113
}
114114

115115

116+
Foam::labelList Foam::identityMap(const label start, const label len)
117+
{
118+
labelList map(len);
119+
120+
forAll(map, i)
121+
{
122+
map[i] = start + i;
123+
}
124+
return map;
125+
}
126+
127+
116128
// ************************************************************************* //

src/OpenFOAM/containers/Lists/ListOps/ListOps.H

Lines changed: 4 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-2023 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -169,6 +169,9 @@ List<OutList> invertManyToMany(const label len, const UList<InList>& in)
169169
//- Create identity map (map[i] == i) of given length
170170
labelList identityMap(const label len);
171171

172+
//- Create identity map (map[i] == start + i) of given length
173+
labelList identityMap(const label start, const label len);
174+
172175
//- Count the number of occurrences of a value in a list
173176
template<class ListType>
174177
label count(const ListType& l, typename ListType::const_reference x);

src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ SourceFiles
4949
namespace Foam
5050
{
5151

52-
// Forward declaration of friend functions and operators
53-
54-
class cellZone;
55-
Ostream& operator<<(Ostream&, const cellZone&);
56-
57-
5852
/*---------------------------------------------------------------------------*\
5953
Class cellZone Declaration
6054
\*---------------------------------------------------------------------------*/
@@ -77,7 +71,7 @@ public:
7771
// Static Data Members
7872

7973
//- The name associated with the zone-labels dictionary entry
80-
static const char * const labelsName;
74+
static const char* const labelsName;
8175

8276

8377
//- Runtime type information
@@ -219,12 +213,6 @@ public:
219213

220214
//- Move assignment to zone, clearing demand-driven data
221215
void operator=(cellZone&&);
222-
223-
224-
// I-O
225-
226-
//- Ostream Operator
227-
friend Ostream& operator<<(Ostream&, const cellZone&);
228216
};
229217

230218

src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public:
117117
// Static Data Members
118118

119119
//- The name associated with the zone-labels dictionary entry
120-
static const char * const labelsName;
120+
static const char* const labelsName;
121121

122122

123123
//- Runtime type information

src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,4 @@ void Foam::pointZone::operator=(pointZone&& zn)
207207
}
208208

209209

210-
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
211-
212-
Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& zn)
213-
{
214-
zn.write(os);
215-
os.check("Ostream& operator<<(Ostream&, const pointZone&");
216-
return os;
217-
}
218-
219-
220210
// ************************************************************************* //

src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ SourceFiles
5050
namespace Foam
5151
{
5252

53-
// Forward declaration of friend functions and operators
54-
55-
class pointZone;
56-
Ostream& operator<<(Ostream&, const pointZone&);
57-
58-
5953
/*---------------------------------------------------------------------------*\
6054
Class pointZone Declaration
6155
\*---------------------------------------------------------------------------*/
@@ -78,7 +72,7 @@ public:
7872
// Static Data Members
7973

8074
//- The name associated with the zone-labels dictionary entry
81-
static const char * const labelsName;
75+
static const char* const labelsName;
8276

8377

8478
//- Runtime type information
@@ -217,12 +211,6 @@ public:
217211

218212
//- Move assignment to zone, clearing demand-driven data
219213
void operator=(pointZone&&);
220-
221-
222-
// I-O
223-
224-
//- Ostream Operator
225-
friend Ostream& operator<<(Ostream&, const pointZone&);
226214
};
227215

228216

0 commit comments

Comments
 (0)