diff --git a/src/sampling/sampledSurface/distanceSurface/distanceSurface.C b/src/sampling/sampledSurface/distanceSurface/distanceSurface.C index a3fe57cb4a9d4ee7e32708b6e6426a446aacdc36..b777edbdb3c1a0d99713ed601ba0f664e9e313d3 100644 --- a/src/sampling/sampledSurface/distanceSurface/distanceSurface.C +++ b/src/sampling/sampledSurface/distanceSurface/distanceSurface.C @@ -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; // } } diff --git a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H index a5b7fe8bda5959ad63e1c9c72304a657adf1d66c..5f777cbacfd01fc091a09189b13d8fd64190e45f 100644 --- a/src/sampling/sampledSurface/distanceSurface/distanceSurface.H +++ b/src/sampling/sampledSurface/distanceSurface/distanceSurface.H @@ -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_; diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C index e77d6f74c799f28d7224398f7459414bb5bace68..155e12bbd225213dc706d71acaa1d423b8da2d60 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.C @@ -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; // } } diff --git a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H index b779b65e0358f52016652c32e500aff1204ac950..837b3bab76d6569655e752112f2d2ecf3f1b4ef1 100644 --- a/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H +++ b/src/sampling/sampledSurface/isoSurface/sampledIsoSurfaceCell.H @@ -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_; diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C index 3fb02e57c4b6ef62c0be02420c368106b0ce32b3..9277fc44c3826355dfb75fdf10924b8102d987fd 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C @@ -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) diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H index ec530c0a2c355f3f73c1d02367331d29cd633652..f63c6d0bb1794fb62f123657cbf5f9496334441a 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H @@ -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 diff --git a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C index 20da502550bf6cc44734e8b4cf651198cfb0ebb1..3c2d6b1b1c91d8d7d3ea469d0bac96b788d44a5a 100644 --- a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C +++ b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C @@ -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; // } } diff --git a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H index def4f084f7064e874d1ef7e9a87d95bef7dbbfea..47204a856de1b81d368e7b11a02c465d58f36eab 100644 --- a/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H +++ b/src/sampling/sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.H @@ -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_;