mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support for patch subsets on a sampled mesh (#1600)
This commit is contained in:
@ -529,7 +529,65 @@ Foam::sampledMeshedSurface::sampledMeshedSurface
|
||||
zoneIds_(),
|
||||
sampleElements_(),
|
||||
samplePoints_()
|
||||
{}
|
||||
{
|
||||
wordRes includePatches;
|
||||
dict.readIfPresent("patches", includePatches);
|
||||
includePatches.uniq();
|
||||
|
||||
// Could also shift this to the reader itself,
|
||||
// but not yet necessary.
|
||||
|
||||
if (!includePatches.empty())
|
||||
{
|
||||
Info<< "Subsetting surface " << surfaceName_
|
||||
<< " to patches: " << flatOutput(includePatches) << nl;
|
||||
|
||||
const surfZoneList& zones = surface_.surfZones();
|
||||
|
||||
const labelList zoneIndices
|
||||
(
|
||||
stringListOps::findMatching
|
||||
(
|
||||
zones,
|
||||
includePatches,
|
||||
wordRes(),
|
||||
nameOp<surfZone>()
|
||||
)
|
||||
);
|
||||
|
||||
// Faces to subset
|
||||
bitSet includeMap(surface_.size());
|
||||
|
||||
for (const label zonei : zoneIndices)
|
||||
{
|
||||
const surfZone& zn = zones[zonei];
|
||||
includeMap.set(zn.range());
|
||||
}
|
||||
|
||||
if (includeMap.none())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Patch selection results in an empty surface"
|
||||
<< " - ignoring" << nl;
|
||||
}
|
||||
else if (!includeMap.all())
|
||||
{
|
||||
meshedSurface subSurf(surface_.subsetMesh(includeMap));
|
||||
|
||||
if (subSurf.empty())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Bad surface subset (empty)"
|
||||
<< " - skip and hope for the best" << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Replace
|
||||
surface_.transfer(subSurf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -84,6 +84,7 @@ Usage
|
||||
Property | Description | Required | Default
|
||||
type | meshedSurface | yes |
|
||||
surface | surface name in triSurface/ | yes |
|
||||
patches | Limit to named surface regions (wordRes) | no |
|
||||
source | cells/insideCells/boundaryFaces | yes |
|
||||
keepIds | pass through id numbering | no | false
|
||||
\endtable
|
||||
@ -141,7 +142,7 @@ private:
|
||||
word surfaceName_;
|
||||
|
||||
//- Surface to sample on
|
||||
const meshedSurface surface_;
|
||||
meshedSurface surface_;
|
||||
|
||||
//- Whether to sample internal cell values or boundary values
|
||||
const samplingSource sampleSource_;
|
||||
|
||||
@ -54,6 +54,7 @@ Usage
|
||||
Property | Description | Required | Default
|
||||
type | meshedSurfaceNormal | yes |
|
||||
surface | surface name in triSurface/ | yes |
|
||||
patches | Limit to named surface regions (wordRes) | no |
|
||||
source | cells/insideCells/boundaryFaces | yes |
|
||||
keepIds | pass through id numbering | no | false
|
||||
\endtable
|
||||
|
||||
Reference in New Issue
Block a user