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