Skip to content
Snippets Groups Projects
Commit d1b91082 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

WIP: provisional support for patch subsets on a sampled mesh (#1600)

parent cedbf2cc
No related merge requests found
......@@ -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 newSurf(surface_.subsetMesh(includeMap));
if (newSurf.empty())
{
WarningInFunction
<< "Bad surface subset (empty)"
<< " - skip and hope for the best" << nl;
}
else
{
// Replace
surface_.transfer(newSurf);
}
}
}
}
// * * * * * * * * * * * * * * * 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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment