From 644c0f4a8695b8e666fa22abf8174c097f73d662 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 6 Nov 2018 13:25:56 +0100 Subject: [PATCH] ENH: make dictionary of topoSet box sources consistent with searchableBox --- src/meshTools/sets/cellSources/boxToCell/boxToCell.C | 8 ++++++-- src/meshTools/sets/cellSources/boxToCell/boxToCell.H | 10 ++++++---- src/meshTools/sets/faceSources/boxToFace/boxToFace.C | 8 ++++++-- src/meshTools/sets/faceSources/boxToFace/boxToFace.H | 10 ++++++---- .../sets/pointSources/boxToPoint/boxToPoint.C | 8 ++++++-- .../sets/pointSources/boxToPoint/boxToPoint.H | 10 ++++++---- 6 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/meshTools/sets/cellSources/boxToCell/boxToCell.C b/src/meshTools/sets/cellSources/boxToCell/boxToCell.C index 9cb921f3dd..d3efca3501 100644 --- a/src/meshTools/sets/cellSources/boxToCell/boxToCell.C +++ b/src/meshTools/sets/cellSources/boxToCell/boxToCell.C @@ -114,11 +114,15 @@ Foam::boxToCell::boxToCell topoSetCellSource(mesh), bbs_() { - // Look for 'boxes' or 'box' + // Accept 'boxes', 'box' or 'min/max' if (!dict.readIfPresent("boxes", bbs_)) { bbs_.resize(1); - dict.readEntry("box", bbs_.first()); + if (!dict.readIfPresent("box", bbs_.first())) + { + dict.readEntry("min", bbs_.first().min()); + dict.readEntry("max", bbs_.first().max()); + } } } diff --git a/src/meshTools/sets/cellSources/boxToCell/boxToCell.H b/src/meshTools/sets/cellSources/boxToCell/boxToCell.H index 09a7920f11..6e0520cb18 100644 --- a/src/meshTools/sets/cellSources/boxToCell/boxToCell.H +++ b/src/meshTools/sets/cellSources/boxToCell/boxToCell.H @@ -30,13 +30,15 @@ Description \heading Dictionary parameters \table Property | Description | Required | Default - box | A single bounding box | partly | boxes | Multiple bounding boxes | partly | + box | A single bounding box | partly | + min | Minimum point for a single box | partly | + max | Maximum point for a single box | partly | \endtable Note - Must specify either "box" or "boxes". - The selection of multiple boxes has precedence. + In the order of highest to lowest precedence, must specify "boxes", + "box" or a "min/max" pair (compatibility with searchable box). SourceFiles boxToCell.C @@ -92,7 +94,7 @@ public: //- Construct from dictionary boxToCell(const polyMesh& mesh, const dictionary& dict); - //- Construct from Istream + //- Construct from stream - a single box. boxToCell(const polyMesh& mesh, Istream& is); diff --git a/src/meshTools/sets/faceSources/boxToFace/boxToFace.C b/src/meshTools/sets/faceSources/boxToFace/boxToFace.C index 3eef661de9..ee6490c6c7 100644 --- a/src/meshTools/sets/faceSources/boxToFace/boxToFace.C +++ b/src/meshTools/sets/faceSources/boxToFace/boxToFace.C @@ -114,11 +114,15 @@ Foam::boxToFace::boxToFace topoSetFaceSource(mesh), bbs_() { - // Look for 'boxes' or 'box' + // Accept 'boxes', 'box' or 'min/max' if (!dict.readIfPresent("boxes", bbs_)) { bbs_.resize(1); - dict.readEntry("box", bbs_.first()); + if (!dict.readIfPresent("box", bbs_.first())) + { + dict.readEntry("min", bbs_.first().min()); + dict.readEntry("max", bbs_.first().max()); + } } } diff --git a/src/meshTools/sets/faceSources/boxToFace/boxToFace.H b/src/meshTools/sets/faceSources/boxToFace/boxToFace.H index 9de0f3ca63..49aef29b08 100644 --- a/src/meshTools/sets/faceSources/boxToFace/boxToFace.H +++ b/src/meshTools/sets/faceSources/boxToFace/boxToFace.H @@ -30,13 +30,15 @@ Description \heading Dictionary parameters \table Property | Description | Required | Default - box | A single bounding box | partly | boxes | Multiple bounding boxes | partly | + box | A single bounding box | partly | + min | Minimum point for a single box | partly | + max | Maximum point for a single box | partly | \endtable Note - Must specify either "box" or "boxes". - The selection of multiple boxes has precedence. + In the order of highest to lowest precedence, must specify "boxes", + "box" or a "min/max" pair (compatibility with searchable box). SourceFiles boxToFace.C @@ -92,7 +94,7 @@ public: //- Construct from dictionary boxToFace(const polyMesh& mesh, const dictionary& dict); - //- Construct from Istream + //- Construct from stream - a single box. boxToFace(const polyMesh& mesh, Istream& is); diff --git a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C index a76ea3aed6..d88292294d 100644 --- a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C +++ b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C @@ -114,11 +114,15 @@ Foam::boxToPoint::boxToPoint topoSetPointSource(mesh), bbs_() { - // Look for 'boxes' or 'box' + // Accept 'boxes', 'box' or 'min/max' if (!dict.readIfPresent("boxes", bbs_)) { bbs_.resize(1); - dict.readEntry("box", bbs_.first()); + if (!dict.readIfPresent("box", bbs_.first())) + { + dict.readEntry("min", bbs_.first().min()); + dict.readEntry("max", bbs_.first().max()); + } } } diff --git a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H index 36fe9544b9..d4d0073627 100644 --- a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H +++ b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H @@ -30,13 +30,15 @@ Description \heading Dictionary parameters \table Property | Description | Required | Default - box | A single bounding box | partly | boxes | Multiple bounding boxes | partly | + box | A single bounding box | partly | + min | Minimum point for a single box | partly | + max | Maximum point for a single box | partly | \endtable Note - Must specify either "box" or "boxes". - The selection of multiple boxes has precedence. + In the order of highest to lowest precedence, must specify "boxes", + "box" or a "min/max" pair (compatibility with searchable box). SourceFiles boxToPoint.C @@ -93,7 +95,7 @@ public: //- Construct from dictionary boxToPoint(const polyMesh& mesh, const dictionary& dict); - //- Construct from Istream + //- Construct from stream - a single box. boxToPoint(const polyMesh& mesh, Istream& is);