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
4b623e59
Commit
4b623e59
authored
Feb 20, 2009
by
mattijs
Browse files
wildcards in dictionary
parent
a1525f01
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C
View file @
4b623e59
...
...
@@ -29,6 +29,7 @@ License
#include
"mathematicalConstants.H"
#include
"refinementSurfaces.H"
#include
"searchableSurfaces.H"
#include
"regExp.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
...
...
@@ -300,10 +301,44 @@ Foam::layerParameters::layerParameters
// readScalar(layerDict.lookup("minThickness"));
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Check whether layer specification matches any patches
const
List
<
keyType
>
wildCards
=
layersDict
.
keys
(
true
);
forAll
(
wildCards
,
i
)
{
regExp
re
(
wildCards
[
i
]);
bool
hasMatch
=
false
;
forAll
(
boundaryMesh
,
patchI
)
{
if
(
re
.
match
(
boundaryMesh
[
patchI
].
name
()))
{
hasMatch
=
true
;
break
;
}
}
if
(
!
hasMatch
)
{
IOWarningIn
(
"layerParameters::layerParameters(..)"
,
layersDict
)
<<
"Wildcard layer specification for "
<<
wildCards
[
i
]
<<
" does not match any patch."
<<
endl
;
}
}
const
List
<
keyType
>
nonWildCards
=
layersDict
.
keys
(
false
);
forAll
(
nonWildCards
,
i
)
{
if
(
boundaryMesh
.
findPatchID
(
nonWildCards
[
i
])
==
-
1
)
{
IOWarningIn
(
"layerParameters::layerParameters(..)"
,
layersDict
)
<<
"Layer specification for "
<<
nonWildCards
[
i
]
<<
" does not match any patch."
<<
endl
;
}
}
}
// ************************************************************************* //
src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C
View file @
4b623e59
...
...
@@ -265,101 +265,112 @@ Foam::refinementSurfaces::refinementSurfaces
zoneInside_
(
surfacesDict
.
size
()),
regionOffset_
(
surfacesDict
.
size
())
{
labelList
globalMinLevel
(
surfacesDict
.
size
(),
0
);
labelList
globalMaxLevel
(
surfacesDict
.
size
(),
0
);
scalarField
globalAngle
(
surfacesDict
.
size
(),
-
GREAT
);
List
<
Map
<
label
>
>
regionMinLevel
(
surfacesDict
.
size
());
List
<
Map
<
label
>
>
regionMaxLevel
(
surfacesDict
.
size
());
List
<
Map
<
scalar
>
>
regionAngle
(
surfacesDict
.
size
());
// Wilcard specification : loop over all surface, all regions
// and try to find a match.
// Count number of surfaces.
label
surfI
=
0
;
forAll
ConstIter
(
dictionary
,
surfacesDict
,
iter
)
forAll
(
allGeometry
.
names
(),
geomI
)
{
names_
[
surfI
]
=
iter
().
keyword
()
;
const
word
&
geomName
=
allGeometry_
.
names
()[
geomI
]
;
surfaces_
[
surfI
]
=
allGeometry_
.
findSurfaceID
(
names_
[
surfI
]);
if
(
surfaces_
[
surfI
]
==
-
1
)
if
(
surfacesDict
.
found
(
geomName
))
{
FatalErrorIn
(
"refinementSurfaces::refinementSurfaces"
"(const searchableSurfaces&, const dictionary>&"
)
<<
"No surface called "
<<
iter
().
keyword
()
<<
endl
<<
"Valid surfaces are "
<<
allGeometry_
.
names
()
<<
exit
(
FatalError
);
surfI
++
;
}
const
dictionary
&
dict
=
surfacesDict
.
subDict
(
iter
().
keyword
());
}
const
labelPair
refLevel
(
dict
.
lookup
(
"level"
));
globalMinLevel
[
surfI
]
=
refLevel
[
0
];
globalMaxLevel
[
surfI
]
=
refLevel
[
1
];
// Size lists
surfaces_
.
setSize
(
surfI
);
names_
.
setSize
(
surfI
);
faceZoneNames_
.
setSize
(
surfI
);
cellZoneNames_
.
setSize
(
surfI
);
zoneInside_
.
setSize
(
surfI
);
regionOffset_
.
setSize
(
surfI
);
labelList
globalMinLevel
(
surfI
,
0
);
labelList
globalMaxLevel
(
surfI
,
0
);
scalarField
globalAngle
(
surfI
,
-
GREAT
);
List
<
Map
<
label
>
>
regionMinLevel
(
surfI
);
List
<
Map
<
label
>
>
regionMaxLevel
(
surfI
);
List
<
Map
<
scalar
>
>
regionAngle
(
surfI
);
surfI
=
0
;
forAll
(
allGeometry
.
names
(),
geomI
)
{
const
word
&
geomName
=
allGeometry_
.
names
()[
geomI
];
// Global zone names per surface
if
(
dict
.
found
(
"faceZone"
))
if
(
surfacesDict
.
found
(
geomName
))
{
dict
.
lookup
(
"faceZone"
)
>>
faceZoneNames_
[
surfI
];
dict
.
lookup
(
"cellZone"
)
>>
cellZoneNames_
[
surfI
];
dict
.
lookup
(
"zoneInside"
)
>>
zoneInside_
[
surfI
];
}
const
dictionary
&
dict
=
surfacesDict
.
subDict
(
geomName
);
// Global perpendicular angle
if
(
dict
.
found
(
"perpendicularAngle"
))
{
globalAngle
[
surfI
]
=
readScalar
(
dict
.
lookup
(
"perpendicularAngle"
));
}
names_
[
surfI
]
=
geomName
;
surfaces_
[
surfI
]
=
geomI
;
if
(
dict
.
found
(
"regions"
))
{
const
dictionary
&
regionsDict
=
dict
.
subDict
(
"regions"
);
const
wordList
&
regionNames
=
allGeometry_
[
surfaces_
[
surfI
]].
regions
();
const
labelPair
refLevel
(
dict
.
lookup
(
"level"
));
globalMinLevel
[
surfI
]
=
refLevel
[
0
];
globalMaxLevel
[
surfI
]
=
refLevel
[
1
];
forAllConstIter
(
dictionary
,
regionsDict
,
iter
)
// Global zone names per surface
if
(
dict
.
found
(
"faceZone"
))
{
const
word
&
key
=
iter
().
keyword
();
if
(
regionsDict
.
isDict
(
key
))
{
// Get the dictionary for region iter.keyword()
const
dictionary
&
regionDict
=
regionsDict
.
subDict
(
key
);
label
regionI
=
findIndex
(
regionNames
,
key
);
if
(
regionI
==
-
1
)
{
FatalErrorIn
(
"refinementSurfaces::refinementSurfaces"
"(const searchableSurfaces&, const dictionary>&"
)
<<
"No region called "
<<
key
<<
" on surface "
<<
allGeometry_
[
surfaces_
[
surfI
]].
name
()
<<
endl
<<
"Valid regions are "
<<
regionNames
<<
exit
(
FatalError
);
}
dict
.
lookup
(
"faceZone"
)
>>
faceZoneNames_
[
surfI
];
dict
.
lookup
(
"cellZone"
)
>>
cellZoneNames_
[
surfI
];
dict
.
lookup
(
"zoneInside"
)
>>
zoneInside_
[
surfI
];
}
const
labelPair
refLevel
(
regionDict
.
lookup
(
"level"
));
// Global perpendicular angle
if
(
dict
.
found
(
"perpendicularAngle"
))
{
globalAngle
[
surfI
]
=
readScalar
(
dict
.
lookup
(
"perpendicularAngle"
)
);
}
regionMinLevel
[
surfI
].
insert
(
regionI
,
refLevel
[
0
]);
regionMaxLevel
[
surfI
].
insert
(
regionI
,
refLevel
[
1
]);
if
(
dict
.
found
(
"regions"
))
{
const
dictionary
&
regionsDict
=
dict
.
subDict
(
"regions"
);
const
wordList
&
regionNames
=
allGeometry_
[
surfaces_
[
surfI
]].
regions
();
if
(
regionDict
.
found
(
"perpendicularAngle"
))
forAll
(
regionNames
,
regionI
)
{
if
(
regionsDict
.
found
(
regionNames
[
regionI
]))
{
regionAngle
[
surfI
].
insert
// Get the dictionary for region
const
dictionary
&
regionDict
=
regionsDict
.
subDict
(
regionI
,
readScalar
(
regionDict
.
lookup
(
"perpendicularAngle"
))
regionNames
[
regionI
]
);
const
labelPair
refLevel
(
regionDict
.
lookup
(
"level"
));
regionMinLevel
[
surfI
].
insert
(
regionI
,
refLevel
[
0
]);
regionMaxLevel
[
surfI
].
insert
(
regionI
,
refLevel
[
1
]);
if
(
regionDict
.
found
(
"perpendicularAngle"
))
{
regionAngle
[
surfI
].
insert
(
regionI
,
readScalar
(
regionDict
.
lookup
(
"perpendicularAngle"
)
)
);
}
}
}
}
surfI
++
;
}
surfI
++
;
}
// Calculate local to global region offset
label
nRegions
=
0
;
forAll
(
surfaces
Dict
,
surfI
)
forAll
(
surfaces
_
,
surfI
)
{
regionOffset_
[
surfI
]
=
nRegions
;
nRegions
+=
allGeometry_
[
surfaces_
[
surfI
]].
regions
().
size
();
...
...
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