Commit 692aa4ab authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: adjust sampling to handle keyType zone specification

parent 991d8560
......@@ -290,20 +290,17 @@ Foam::distanceSurface::distanceSurface
signed_(readBool(dict.lookup("signed"))),
regularise_(dict.lookupOrDefault("regularise", true)),
average_(dict.lookupOrDefault("average", false)),
zoneName_(word::null),
zoneKey_(keyType::null),
needsUpdate_(true),
isoSurfPtr_(NULL),
facesPtr_(NULL)
{
// dict.readIfPresent("zone", zoneName_);
// dict.readIfPresent("zone", zoneKey_);
//
// if (debug && zoneName_.size())
// if (debug && zoneKey_.size() && mesh.cellZones().findZoneID(zoneKey_) < 0)
// {
// if (mesh.cellZones().findZoneID(zoneName_) < 0)
// {
// Info<< "cellZone \"" << zoneName_
// << "\" not found - using entire mesh" << endl;
// }
// Info<< "cellZone " << zoneKey_
// << " not found - using entire mesh" << endl;
// }
}
......
......@@ -70,8 +70,8 @@ class distanceSurface
//- Whether to recalculate cell values as average of point values
const Switch average_;
//- zone name (if restricted to zones)
word zoneName_;
//- If restricted to zones, name of this zone or a regular expression
keyType zoneKey_;
//- Track if the surface needs an update
mutable bool needsUpdate_;
......
......@@ -205,20 +205,17 @@ Foam::sampledIsoSurfaceCell::sampledIsoSurfaceCell
isoVal_(readScalar(dict.lookup("isoValue"))),
regularise_(dict.lookupOrDefault("regularise", true)),
average_(dict.lookupOrDefault("average", true)),
zoneName_(word::null),
zoneKey_(keyType::null),
facesPtr_(NULL),
prevTimeIndex_(-1),
meshCells_(0)
{
// dict.readIfPresent("zone", zoneName_);
// dict.readIfPresent("zone", zoneKey_);
//
// if (debug && zoneName_.size())
// if (debug && zoneKey_.size() && mesh.cellZones().findZoneID(zoneKey_) < 0)
// {
// if (mesh.cellZones().findZoneID(zoneName_) < 0)
// {
// Info<< "cellZone \"" << zoneName_
// << "\" not found - using entire mesh" << endl;
// }
// Info<< "cellZone " << zoneKey_
// << " not found - using entire mesh" << endl;
// }
}
......
......@@ -68,8 +68,8 @@ class sampledIsoSurfaceCell
//- Whether to recalculate cell values as average of point values
const Switch average_;
//- zone name (if restricted to zones)
word zoneName_;
//- If restricted to zones, name of this zone or a regular expression
keyType zoneKey_;
//- triangles converted to faceList
mutable autoPtr<faceList> facesPtr_;
......
......@@ -45,21 +45,18 @@ Foam::sampledPlane::sampledPlane
const word& name,
const polyMesh& mesh,
const plane& planeDesc,
const word& zoneName
const keyType& zoneKey
)
:
sampledSurface(name, mesh),
cuttingPlane(planeDesc),
zoneName_(zoneName),
zoneKey_(zoneKey),
needsUpdate_(true)
{
if (debug && zoneName_.size())
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) < 0)
{
if (mesh.cellZones().findZoneID(zoneName_) < 0)
{
Info<< "cellZone \"" << zoneName_
<< "\" not found - using entire mesh" << endl;
}
Info<< "cellZone " << zoneKey_
<< " not found - using entire mesh" << endl;
}
}
......@@ -73,7 +70,7 @@ Foam::sampledPlane::sampledPlane
:
sampledSurface(name, mesh, dict),
cuttingPlane(plane(dict.lookup("basePoint"), dict.lookup("normalVector"))),
zoneName_(word::null),
zoneKey_(keyType::null),
needsUpdate_(true)
{
// make plane relative to the coordinateSystem (Cartesian)
......@@ -89,17 +86,13 @@ Foam::sampledPlane::sampledPlane
static_cast<plane&>(*this) = plane(base, norm);
}
dict.readIfPresent("zone", zoneName_);
dict.readIfPresent("zone", zoneKey_);
if (debug && zoneName_.size())
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) < 0)
{
if (mesh.cellZones().findZoneID(zoneName_) < 0)
{
Info<< "cellZone \"" << zoneName_
<< "\" not found - using entire mesh" << endl;
}
Info<< "cellZone " << zoneKey_
<< " not found - using entire mesh" << endl;
}
}
......@@ -141,19 +134,19 @@ bool Foam::sampledPlane::update()
sampledSurface::clearGeom();
label zoneId = -1;
if (zoneName_.size())
PackedBoolList cellsInZone;
if (zoneKey_.size())
{
zoneId = mesh().cellZones().findZoneID(zoneName_);
cellsInZone = mesh().cellZones().inZone(zoneKey_);
}
if (zoneId < 0)
if (cellsInZone.empty())
{
reCut(mesh(), true); // always triangulate. Note:Make option?
}
else
{
reCut(mesh(), true, mesh().cellZones()[zoneId]);
reCut(mesh(), true, cellsInZone.used()());
}
if (debug)
......
......@@ -47,7 +47,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class sampledPlane Declaration
Class sampledPlane Declaration
\*---------------------------------------------------------------------------*/
class sampledPlane
......@@ -57,8 +57,8 @@ class sampledPlane
{
// Private data
//- zone name (if restricted to zones)
word zoneName_;
//- If restricted to zones, name of this zone or a regular expression
keyType zoneKey_;
//- Track if the surface needs an update
mutable bool needsUpdate_;
......@@ -92,7 +92,7 @@ public:
const word& name,
const polyMesh& mesh,
const plane& planeDesc,
const word& zoneName = word::null
const keyType& zoneKey = word::null
);
//- Construct from dictionary
......
......@@ -154,7 +154,7 @@ Foam::sampledThresholdCellFaces::sampledThresholdCellFaces
fieldName_(dict.lookup("field")),
lowerThreshold_(dict.lookupOrDefault<scalar>("lowerLimit", -VGREAT)),
upperThreshold_(dict.lookupOrDefault<scalar>("upperLimit", VGREAT)),
zoneName_(word::null),
zoneKey_(keyType::null),
triangulate_(dict.lookupOrDefault("triangulate", false)),
prevTimeIndex_(-1),
meshCells_(0)
......@@ -169,16 +169,12 @@ Foam::sampledThresholdCellFaces::sampledThresholdCellFaces
<< abort(FatalError);
}
// dict.readIfPresent("zone", zoneName_);
// dict.readIfPresent("zone", zoneKey_);
//
// if (debug && zoneName_.size())
// if (debug && zoneKey_.size() && mesh.cellZones().findZoneID(zoneKey_) < 0)
// {
// if (mesh.cellZones().findZoneID(zoneName_) < 0)
// {
// Info<< "cellZone \"" << zoneName_
// << "\" not found - using entire mesh" << endl;
// }
// Info<< "cellZone " << zoneKey_
// << " not found - using entire mesh" << endl;
// }
}
......
......@@ -67,8 +67,8 @@ class sampledThresholdCellFaces
//- Threshold value
const scalar upperThreshold_;
//- zone name (if restricted to zones)
word zoneName_;
//- If restricted to zones, name of this zone or a regular expression
keyType zoneKey_;
//- Triangulated faces or keep faces as is
bool triangulate_;
......
Markdown is supported
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