Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Community
integration-cfmesh
Commits
db3f8105
Commit
db3f8105
authored
Aug 30, 2014
by
Franjo
Browse files
Merge branch 'feature-regExpPatches' into development
parents
1323bcfe
fa45982c
Changes
7
Hide whitespace changes
Inline
Side-by-side
meshLibrary/utilities/boundaryLayers/refineBoundaryLayers.C
View file @
db3f8105
...
...
@@ -156,7 +156,12 @@ void refineBoundaryLayers::setNumberOfLayersForPatch
return
;
}
numLayersForPatch_
[
patchName
]
=
nLayers
;
labelList
matchedIDs
=
mesh_
.
findPatches
(
patchName
);
forAll
(
matchedIDs
,
matchI
)
{
numLayersForPatch_
[
mesh_
.
getPatchName
(
matchedIDs
[
matchI
])]
=
nLayers
;
}
}
void
refineBoundaryLayers
::
setThicknessRatioForPatch
...
...
@@ -177,7 +182,12 @@ void refineBoundaryLayers::setThicknessRatioForPatch
return
;
}
thicknessRatioForPatch_
[
patchName
]
=
thicknessRatio
;
labelList
matchedIDs
=
mesh_
.
findPatches
(
patchName
);
forAll
(
matchedIDs
,
matchI
)
{
thicknessRatioForPatch_
[
mesh_
.
getPatchName
(
matchedIDs
[
matchI
])]
=
thicknessRatio
;
}
}
void
refineBoundaryLayers
::
setMaxThicknessOfFirstLayerForPatch
...
...
@@ -198,12 +208,22 @@ void refineBoundaryLayers::setMaxThicknessOfFirstLayerForPatch
return
;
}
maxThicknessForPatch_
[
patchName
]
=
maxThickness
;
labelList
matchedIDs
=
mesh_
.
findPatches
(
patchName
);
forAll
(
matchedIDs
,
matchI
)
{
maxThicknessForPatch_
[
mesh_
.
getPatchName
(
matchedIDs
[
matchI
])]
=
maxThickness
;
}
}
void
refineBoundaryLayers
::
setInteruptForPatch
(
const
word
&
patchName
)
{
discontinuousLayersForPatch_
.
insert
(
patchName
);
labelList
matchedIDs
=
mesh_
.
findPatches
(
patchName
);
forAll
(
matchedIDs
,
matchI
)
{
discontinuousLayersForPatch_
.
insert
(
mesh_
.
getPatchName
(
matchedIDs
[
matchI
]));
}
}
void
refineBoundaryLayers
::
refineLayers
()
...
...
meshLibrary/utilities/meshes/polyMeshGen/polyMeshGenFaces.C
View file @
db3f8105
...
...
@@ -31,6 +31,7 @@ Description
#include "IOobjectList.H"
#include "faceSet.H"
#include "demandDrivenData.H"
#include "stringListOps.H"
namespace
Foam
{
...
...
@@ -201,6 +202,65 @@ label polyMeshGenFaces::faceIsInPatch(const label faceLabel) const
return
-
1
;
}
wordList
polyMeshGenFaces
::
patchNames
()
const
{
wordList
t
(
boundaries_
.
size
());
forAll
(
boundaries_
,
patchI
)
{
t
[
patchI
]
=
boundaries_
[
patchI
].
patchName
();
}
return
t
;
}
label
polyMeshGenFaces
::
getPatchID
(
const
word
&
patchName
)
const
{
forAll
(
boundaries_
,
patchI
)
{
if
(
boundaries_
.
set
(
patchI
))
{
if
(
boundaries_
[
patchI
].
patchName
()
==
patchName
)
{
return
patchI
;
}
}
}
// If the code gets here, it implies that the patch was not found.
// return a -1 in this case
return
-
1
;
}
word
polyMeshGenFaces
::
getPatchName
(
const
label
patchID
)
const
{
if
((
patchID
<
0
)
||
(
patchID
>=
boundaries_
.
size
()))
{
FatalErrorIn
(
"polyMeshGenFaces::getPatchName(const label patchID) const"
)
<<
"invalid patch ID supplied"
<<
abort
(
FatalError
);
}
return
boundaries_
[
patchID
].
patchName
();
}
labelList
polyMeshGenFaces
::
findPatches
(
const
word
&
patchName
)
const
{
wordList
allPatches
=
patchNames
();
labelList
patchIDs
=
findStrings
(
patchName
,
allPatches
);
if
(
patchIDs
.
empty
())
{
WarningIn
(
"polyMeshGenFaces::findPatches(const word&)"
)
<<
"Cannot find any patch names matching "
<<
patchName
<<
endl
;
}
return
patchIDs
;
}
label
polyMeshGenFaces
::
addFaceSubset
(
const
word
&
setName
)
{
label
id
=
faceSubsetIndex
(
setName
);
...
...
meshLibrary/utilities/meshes/polyMeshGen/polyMeshGenFaces.H
View file @
db3f8105
...
...
@@ -142,7 +142,20 @@ public:
//- return patch label for the given face label
label
faceIsInPatch
(
const
label
faceLabel
)
const
;
//- return list of patches in the boundary
wordList
patchNames
()
const
;
//- return the index of a patch given its name
label
getPatchID
(
const
word
&
patchName
)
const
;
//- return the name of a patch given its ID
word
getPatchName
(
const
label
patchID
)
const
;
//- return a list of patch indices corresponding to the given
// name, expanding regular expressions
labelList
findPatches
(
const
word
&
patchName
)
const
;
// Subsets
label
addFaceSubset
(
const
word
&
);
...
...
meshLibrary/utilities/meshes/triSurf/triSurfFacets.C
View file @
db3f8105
...
...
@@ -29,6 +29,7 @@ Description
#include "pointIOField.H"
#include "IOobjectList.H"
#include "pointSet.H"
#include "stringListOps.H"
namespace
Foam
{
...
...
@@ -72,6 +73,33 @@ triSurfFacets::~triSurfFacets()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
wordList
triSurfFacets
::
patchNames
()
const
{
wordList
t
(
patches_
.
size
());
forAll
(
patches_
,
patchI
)
{
t
[
patchI
]
=
patches_
[
patchI
].
name
();
}
return
t
;
}
labelList
triSurfFacets
::
findPatches
(
const
word
&
patchName
)
const
{
wordList
allPatches
=
patchNames
();
labelList
patchIDs
=
findStrings
(
patchName
,
allPatches
);
if
(
patchIDs
.
empty
())
{
WarningIn
(
"triSurfFacets::findPatches(const word&)"
)
<<
"Cannot find any patch names matching "
<<
patchName
<<
endl
;
}
return
patchIDs
;
}
label
triSurfFacets
::
addFacetSubset
(
const
word
&
subsetName
)
{
label
id
=
facetSubsetIndex
(
subsetName
);
...
...
meshLibrary/utilities/meshes/triSurf/triSurfFacets.H
View file @
db3f8105
...
...
@@ -98,6 +98,13 @@ public:
//- access to patches
inline
const
geometricSurfacePatchList
&
patches
()
const
;
//- return list of patches in the boundary
wordList
patchNames
()
const
;
//- return a list of patch indices corresponding to the given
// name, expanding regular expressions
labelList
findPatches
(
const
word
&
patchName
)
const
;
//- append a triangle to the end of the list
inline
void
appendTriangle
(
const
labelledTri
&
tria
);
...
...
meshLibrary/utilities/octrees/meshOctree/meshOctreeCreator/meshOctreeCreatorCreateOctreeBoxes.C
View file @
db3f8105
...
...
@@ -168,8 +168,9 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
const
dictionary
&
dict
=
meshDictPtr_
->
subDict
(
"patchCellSize"
);
const
wordList
patchNames
=
dict
.
toc
();
const
wordList
allPatches
=
surface
.
patchNames
();
refPatches
.
setSize
(
p
atch
Nam
es
.
size
());
refPatches
.
setSize
(
allP
atches
.
size
());
label
counter
(
0
);
forAll
(
patchNames
,
patchI
)
...
...
@@ -180,8 +181,12 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
const
dictionary
&
patchDict
=
dict
.
subDict
(
patchNames
[
patchI
]);
const
scalar
cs
=
readScalar
(
patchDict
.
lookup
(
"cellSize"
));
refPatches
[
counter
]
=
patchRefinement
(
patchNames
[
patchI
],
cs
);
++
counter
;
labelList
matchedIDs
=
surface
.
findPatches
(
patchNames
[
patchI
]);
forAll
(
matchedIDs
,
matchI
)
{
refPatches
[
counter
]
=
patchRefinement
(
allPatches
[
matchedIDs
[
matchI
]],
cs
);
++
counter
;
}
}
refPatches
.
setSize
(
counter
);
...
...
@@ -317,11 +322,6 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
const
dictionary
&
dict
=
meshDictPtr_
->
subDict
(
"localRefinement"
);
const
wordList
entries
=
dict
.
toc
();
//- map patch name to its index
std
::
map
<
word
,
label
>
patchToIndex
;
forAll
(
surface
.
patches
(),
patchI
)
patchToIndex
[
surface
.
patches
()[
patchI
].
name
()]
=
patchI
;
//- map a facet subset name to its index
std
::
map
<
word
,
label
>
setToIndex
;
DynList
<
label
>
setIDs
;
...
...
@@ -369,10 +369,12 @@ void meshOctreeCreator::setRootCubeSizeAndRefParameters()
const
direction
level
=
globalRefLevel_
+
nLevel
;
if
(
patchToIndex
.
find
(
pName
)
!=
patchToIndex
.
end
()
)
labelList
matchedPatches
=
surface
.
findPatches
(
pName
);
forAll
(
matchedPatches
,
matchI
)
{
//- patch-based refinement
const
label
patchI
=
p
atch
ToIndex
[
pName
];
const
label
patchI
=
m
atch
edPatches
[
matchI
];
forAll
(
surface
,
triI
)
{
...
...
meshLibrary/utilities/surfaceTools/renameBoundaryPatches/renameBoundaryPatches.C
View file @
db3f8105
...
...
@@ -46,19 +46,6 @@ void renameBoundaryPatches::calculateNewBoundary()
const
dictionary
&
dict
=
meshDict_
.
subDict
(
"renameBoundary"
);
std
::
map
<
word
,
label
>
patchToLabel
;
forAll
(
mesh_
.
boundaries
(),
patchI
)
{
patchToLabel
.
insert
(
std
::
pair
<
word
,
label
>
(
mesh_
.
boundaries
()[
patchI
].
patchName
(),
patchI
)
);
}
labelList
patchToNew
(
mesh_
.
boundaries
().
size
(),
-
1
);
wordList
newPatchNames
(
patchToNew
.
size
());
...
...
@@ -100,9 +87,11 @@ void renameBoundaryPatches::calculateNewBoundary()
{
const
word
patchName
=
patchesToRename
[
patchI
].
keyword
();
if
(
patchToLabel
.
find
(
patchName
)
==
patchToLabel
.
end
()
)
labelList
matchedPatches
=
mesh_
.
findPatches
(
patchName
);
if
(
matchedPatches
.
empty
())
{
Info
<<
"Patch
"
<<
patchName
<<
"
does not exist
!!"
<<
endl
;
Warning
<<
"No matches for
"
<<
patchName
<<
"
found
!!"
<<
endl
;
continue
;
}
...
...
@@ -116,32 +105,36 @@ void renameBoundaryPatches::calculateNewBoundary()
const
dictionary
pDict
=
patchesToRename
[
patchI
].
dict
();
word
newName
(
patchName
);
if
(
pDict
.
found
(
"newName"
)
)
newName
=
word
(
pDict
.
lookup
(
"newName"
));
if
(
newNameToPos
.
find
(
newName
)
!=
newNameToPos
.
end
()
)
forAll
(
matchedPatches
,
matchI
)
{
//- patch with the same name already exists
patchToNew
[
patchToLabel
[
patchName
]]
=
newNameToPos
[
newName
];
continue
;
word
newName
(
mesh_
.
getPatchName
(
matchedPatches
[
matchI
]));
if
(
pDict
.
found
(
"newName"
)
)
newName
=
word
(
pDict
.
lookup
(
"newName"
));
if
(
newNameToPos
.
find
(
newName
)
!=
newNameToPos
.
end
()
)
{
//- patch with the same name already exists
patchToNew
[
matchedPatches
[
matchI
]]
=
newNameToPos
[
newName
];
continue
;
}
//- add a new patch
newNameToPos
.
insert
(
std
::
pair
<
word
,
label
>
(
newName
,
newPatchI
));
newPatchNames
[
newPatchI
]
=
newName
;
if
(
pDict
.
found
(
"type"
)
)
{
const
word
newType
(
pDict
.
lookup
(
"type"
));
newPatchTypes
[
newPatchI
]
=
newType
;
}
else
{
newPatchTypes
[
newPatchI
]
=
"wall"
;
}
patchToNew
[
matchedPatches
[
matchI
]]
=
newPatchI
;
++
newPatchI
;
}
//- add a new patch
newNameToPos
.
insert
(
std
::
pair
<
word
,
label
>
(
newName
,
newPatchI
));
newPatchNames
[
newPatchI
]
=
newName
;
if
(
pDict
.
found
(
"type"
)
)
{
const
word
newType
(
pDict
.
lookup
(
"type"
));
newPatchTypes
[
newPatchI
]
=
newType
;
}
else
{
newPatchTypes
[
newPatchI
]
=
"wall"
;
}
patchToNew
[
patchToLabel
[
patchName
]]
=
newPatchI
;
++
newPatchI
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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