Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
f0be8679
Commit
f0be8679
authored
Jan 16, 2020
by
Mark OLESEN
Browse files
ENH: provide defaultName() static method for patches, zones
- consistent way of writing "patch" + Foam::name(id) etc.
parent
2a98c4e6
Changes
24
Hide whitespace changes
Inline
Side-by-side
applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
View file @
f0be8679
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019
-2020
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -521,7 +521,7 @@ int main(int argc, char *argv[])
}
boundary[patchi] = patchFaces;
patchNames[patchi] =
"patch" + Foam::n
ame(patchi + 1);
patchNames[patchi] =
polyPatch::defaultN
ame(patchi + 1);
}
...
...
applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
View file @
f0be8679
...
...
@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -1465,7 +1466,7 @@ int main(int argc, char *argv[])
physicalNames
.
lookup
(
patchToPhys
[
patchi
],
"patch"
+
Foam
::
name
(
patchi
)
// default name
polyPatch
::
defaultName
(
patchi
)
);
Info
<<
"Patch "
<<
patchi
<<
" gets name "
...
...
applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
View file @
f0be8679
...
...
@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -263,7 +264,7 @@ int main(int argc, char *argv[])
forAll
(
patchNames
,
patchi
)
{
patchNames
[
patchi
]
=
word
(
"patch"
)
+
n
ame
(
patchi
);
patchNames
[
patchi
]
=
polyPatch
::
defaultN
ame
(
patchi
);
}
wordList
patchTypes
(
nPatches
,
polyPatch
::
typeName
);
...
...
applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
View file @
f0be8679
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-20
19
OpenCFD Ltd.
Copyright (C) 2015-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -483,8 +483,8 @@ int main(int argc, char *argv[])
forAllConstIters
(
regionToPatch
,
iter
)
{
Info
<<
" region:"
<<
iter
.
key
()
<<
'\t'
<<
"patch:"
<<
iter
()
<<
end
l
;
Info
<<
" region:"
<<
iter
.
key
()
<<
'\t'
<<
"patch:"
<<
iter
.
val
()
<<
n
l
;
}
Info
<<
endl
;
...
...
@@ -495,7 +495,7 @@ int main(int argc, char *argv[])
forAll
(
patchNames
,
patchi
)
{
patchNames
[
patchi
]
=
"patch"
+
Foam
::
n
ame
(
patchi
);
patchNames
[
patchi
]
=
polyPatch
::
defaultN
ame
(
patchi
);
}
wordList
patchTypes
(
nPatches
,
polyPatch
::
typeName
);
...
...
applications/utilities/preProcessing/createBoxTurb/createBlockMesh.H
View file @
f0be8679
...
...
@@ -58,7 +58,7 @@ Info<< "Creating patch dictionaries" << endl;
wordList
patchNames
(
boundary
.
size
());
forAll
(
patchNames
,
patchi
)
{
patchNames
[
patchi
]
=
"patch"
+
Foam
::
n
ame
(
patchi
);
patchNames
[
patchi
]
=
polyPatch
::
defaultN
ame
(
patchi
);
}
PtrList
<
dictionary
>
boundaryDicts
(
boundary
.
size
());
...
...
@@ -69,11 +69,11 @@ forAll(boundaryDicts, patchi)
word
nbrPatchName
;
if
(
patchi
%
2
==
0
)
{
nbrPatchName
=
"patch"
+
Foam
::
n
ame
(
patchi
+
1
);
nbrPatchName
=
polyPatch
::
defaultN
ame
(
patchi
+
1
);
}
else
{
nbrPatchName
=
"patch"
+
Foam
::
n
ame
(
patchi
-
1
);
nbrPatchName
=
polyPatch
::
defaultN
ame
(
patchi
-
1
);
}
patchDict
.
add
(
"type"
,
cyclicPolyPatch
::
typeName
);
...
...
applications/utilities/surface/surfacePatch/searchableSurfaceModifier/cut.C
View file @
f0be8679
...
...
@@ -78,7 +78,7 @@ void Foam::searchableSurfaceModifiers::cut::triangulate
{
patches
[
patchi
]
=
geometricSurfacePatch
(
"patch"
+
Foam
::
n
ame
(
patchi
),
geometricSurfacePatch
::
defaultN
ame
(
patchi
),
patchi
);
}
...
...
applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C
View file @
f0be8679
...
...
@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -72,11 +73,11 @@ int main(int argc, char *argv[])
{
const
geometricSurfacePatch
&
pp
=
patches
[
patchi
];
word
patchName
=
pp
.
name
();
word
patchName
(
pp
.
name
()
)
;
if
(
patchName
.
empty
())
{
patchName
=
"patch"
+
Foam
::
n
ame
(
patchi
);
patchName
=
geometricSurfacePatch
::
defaultN
ame
(
patchi
);
}
fileName
outFile
(
surfBase
+
'_'
+
patchName
+
'.'
+
extension
);
...
...
src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.H
View file @
f0be8679
...
...
@@ -70,6 +70,20 @@ class patchIdentifier
public:
// Static Member Functions
//- Default patch name: "patch" or "patchN"
static
word
defaultName
(
const
label
n
=
-
1
)
{
return
(
n
<
0
?
word
(
"patch"
,
false
)
:
word
(
"patch"
+
std
::
to_string
(
n
),
false
)
);
}
// Generated Methods
//- Copy construct
...
...
src/OpenFOAM/meshes/Identifiers/surface/geometricSurfacePatch.H
View file @
f0be8679
...
...
@@ -71,6 +71,20 @@ public:
static
constexpr
const
char
*
const
emptyType
=
"empty"
;
// Static Member Functions
//- Default patch name: "patch" or "patchN"
static
word
defaultName
(
const
label
n
=
-
1
)
{
return
(
n
<
0
?
word
(
"patch"
,
false
)
:
word
(
"patch"
+
std
::
to_string
(
n
),
false
)
);
}
// Public Classes
//- Helper to convert identifier types as an operation
...
...
src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.H
View file @
f0be8679
...
...
@@ -78,6 +78,20 @@ public:
static
constexpr
const
char
*
const
emptyType
=
"empty"
;
// Static Member Functions
//- Default zone name: "zone" or "zoneN"
static
word
defaultName
(
const
label
n
=
-
1
)
{
return
(
n
<
0
?
word
(
"zone"
,
false
)
:
word
(
"zone"
+
std
::
to_string
(
n
),
false
)
);
}
// Generated Methods
//- Copy construct
...
...
src/conversion/ccm/reader/ccmReaderMesh.C
View file @
f0be8679
...
...
@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-20
19
OpenCFD Ltd.
Copyright (C) 2016-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -2419,7 +2419,7 @@ void Foam::ccm::reader::addPatches
// provide some fallback values
forAll
(
newPatches
,
patchI
)
{
const
word
fallbackName
(
"patch"
+
Foam
::
n
ame
(
patchI
));
const
word
fallbackName
(
polyPatch
::
defaultN
ame
(
patchI
));
word
patchName
;
word
patchType
;
...
...
src/dynamicMesh/boundaryMesh/boundaryMesh.C
View file @
f0be8679
...
...
@@ -680,11 +680,11 @@ void Foam::boundaryMesh::readTriSurface(const fileName& fName)
patchi
,
new
boundaryPatch
(
"patch"
+
n
ame
(
patchi
),
geometricSurfacePatch
::
defaultN
ame
(
patchi
),
patchi
,
0
,
0
,
"
empty
"
geometricSurfacePatch
::
empty
Type
)
);
}
...
...
src/fileFormats/stl/STLReader.C
View file @
f0be8679
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-20
17
OpenCFD Ltd.
Copyright (C) 2016-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -128,15 +128,14 @@ bool Foam::fileFormats::STLReader::readBINARY
// interpret STL attribute as a zone
const
label
origId
=
stlTri
.
attrib
();
Map
<
label
>::
const_iter
ato
r
fnd
=
lookup
.
find
(
origId
);
if
(
fnd
!=
lookup
.
e
nd
())
a
u
to
fnd
=
lookup
.
c
find
(
origId
);
if
(
fnd
.
fou
nd
())
{
if
(
zoneI
!=
fnd
()
)
if
(
zoneI
!=
*
fnd
)
{
// group appeared out of order
sorted_
=
false
;
sorted_
=
false
;
// Group appeared out of order
}
zoneI
=
fnd
()
;
zoneI
=
*
fnd
;
}
else
{
...
...
src/overset/cellCellStencil/trackingInverseDistance/voxelMeshSearch.C
View file @
f0be8679
...
...
@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-20
19
OpenCFD Ltd.
Copyright (C) 2017-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -542,7 +542,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::voxelMeshSearch::makeMesh
wordList
patchNames
(
boundary
.
size
());
forAll
(
patchNames
,
patchi
)
{
patchNames
[
patchi
]
=
"patch"
+
Foam
::
n
ame
(
patchi
);
patchNames
[
patchi
]
=
polyPatch
::
defaultN
ame
(
patchi
);
}
PtrList
<
dictionary
>
boundaryDicts
(
boundary
.
size
());
...
...
src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C
View file @
f0be8679
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-20
18
OpenCFD Ltd.
Copyright (C) 2016-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -313,7 +313,7 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
patchi
,
(
patches
[
patchi
].
name
().
empty
()
?
word
::
printf
(
"patch%d"
,
patchi
)
?
geometricSurfacePatch
::
defaultName
(
patchi
)
:
patches
[
patchi
].
name
()
)
);
...
...
@@ -343,7 +343,11 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
{
// This shouldn't happen
zoneSizes
.
insert
(
regionid
,
1
);
zoneNames
.
set
(
regionid
,
word
::
printf
(
"patch%d"
,
regionid
));
zoneNames
.
set
(
regionid
,
geometricSurfacePatch
::
defaultName
(
regionid
)
);
}
// Store new faces compact
...
...
@@ -388,7 +392,7 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
}
if
(
name
.
empty
())
{
name
=
word
::
printf
(
"patch%d"
,
regionid
);
name
=
geometricSurfacePatch
::
defaultName
(
regionid
);
}
zoneLst
[
zoneI
]
=
surfZone
...
...
src/sampling/surface/triSurfaceMesh/discreteSurface.C
View file @
f0be8679
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-20
19
OpenCFD Ltd.
Copyright (C) 2016-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -307,7 +307,7 @@ bool Foam::discreteSurface::update(const meshSearch& meshSearcher)
patchi
,
(
patches
[
patchi
].
name
().
empty
()
?
word
::
printf
(
"patch%d"
,
patchi
)
?
geometricSurfacePatch
::
defaultName
(
patchi
)
:
patches
[
patchi
].
name
()
)
);
...
...
@@ -328,10 +328,10 @@ bool Foam::discreteSurface::update(const meshSearch& meshSearcher)
const
triSurface
::
FaceType
&
f
=
s
[
facei
];
const
label
regionid
=
f
.
region
();
Map
<
label
>::
iter
ato
r
fnd
=
zoneSizes
.
find
(
regionid
);
if
(
fnd
!=
zoneSizes
.
e
nd
())
a
u
to
fnd
=
zoneSizes
.
find
(
regionid
);
if
(
fnd
.
fou
nd
())
{
fnd
()
++
;
++
(
*
fnd
)
;
}
else
{
...
...
@@ -340,7 +340,7 @@ bool Foam::discreteSurface::update(const meshSearch& meshSearcher)
zoneNames
.
set
(
regionid
,
word
::
printf
(
"patch%d"
,
regionid
)
geometricSurfacePatch
::
defaultName
(
regionid
)
);
}
...
...
@@ -380,15 +380,10 @@ bool Foam::discreteSurface::update(const meshSearch& meshSearcher)
// No negative regionids, so Map<label> sorts properly
const
label
regionid
=
iter
.
key
();
word
name
;
Map
<
word
>::
const_iterator
fnd
=
zoneNames
.
find
(
regionid
);
if
(
fnd
!=
zoneNames
.
end
())
{
name
=
fnd
();
}
word
name
(
zoneNames
.
lookup
(
regionid
,
word
::
null
));
if
(
name
.
empty
())
{
name
=
word
::
printf
(
"patch%d"
,
regionid
);
name
=
geometricSurfacePatch
::
defaultName
(
regionid
);
}
zoneLst
[
zoneI
]
=
surfZone
...
...
src/surfMesh/MeshedSurface/MeshedSurfaceZones.C
View file @
f0be8679
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-20
19
OpenCFD Ltd.
Copyright (C) 2016-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -175,7 +175,7 @@ void Foam::MeshedSurface<Face>::addZones
{
zones
[
nZone
]
=
surfZone
(
word
(
"zone"
)
+
::
Foam
::
n
ame
(
nZone
),
surfZone
::
defaultN
ame
(
nZone
),
sizes
[
zoneI
],
start
,
nZone
...
...
src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
View file @
f0be8679
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-20
19
OpenCFD Ltd.
Copyright (C) 2016-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -368,7 +368,7 @@ void Foam::UnsortedMeshedSurface<Face>::setZones
{
zoneToc_
[
zonei
]
=
surfZoneIdentifier
(
"zone"
+
::
Foam
::
n
ame
(
zonei
),
surfZoneIdentifier
::
defaultN
ame
(
zonei
),
zonei
);
...
...
@@ -496,7 +496,7 @@ Foam::surfZoneList Foam::UnsortedMeshedSurface<Face>::sortedZones
zoneNames
.
lookup
(
origId
,
"zone"
+
::
Foam
::
name
(
zonei
)
// default name
surfZoneIdentifier
::
defaultName
(
zonei
)
);
zoneLst
[
zonei
]
=
surfZone
...
...
src/surfMesh/surfaceFormats/ac3d/AC3DsurfaceFormat.C
View file @
f0be8679
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-20
17
OpenCFD Ltd.
Copyright (C) 2016-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -102,7 +102,7 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
for
(
label
zoneI
=
0
;
zoneI
<
nZones
;
++
zoneI
)
{
names
[
zoneI
]
=
word
(
"zone"
)
+
Foam
::
n
ame
(
zoneI
);
names
[
zoneI
]
=
surfZone
::
defaultN
ame
(
zoneI
);
args
=
cueToOrDie
(
is
,
"OBJECT"
,
"while reading "
+
names
[
zoneI
]);
...
...
src/surfMesh/surfaceFormats/gts/GTSsurfaceFormat.C
View file @
f0be8679
...
...
@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-20
17
OpenCFD Ltd.
Copyright (C) 2016-20
20
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -228,12 +228,12 @@ bool Foam::fileFormats::GTSsurfaceFormat<Face>::read
List
<
surfZoneIdentifier
>
newZones
(
maxZone
+
1
);
forAll
(
newZones
,
zone
I
)
forAll
(
newZones
,
zone
i
)
{
newZones
[
zone
I
]
=
surfZoneIdentifier
newZones
[
zone
i
]
=
surfZoneIdentifier
(
"zone"
+
::
Foam
::
n
ame
(
zone
I
),
zone
I
surfZoneIdentifier
::
defaultN
ame
(
zone
i
),
zone
i
);
}
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment