cuttingPlaneSelection.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2018-2019 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "cuttingPlane.H"
29#include "polyMesh.H"
30
31// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
32
34(
35 const word callerName,
36 const boundBox& meshBounds,
37 const boundBox& userBounds
38) const
39{
40 cuttingSurfaceBase::checkOverlap(callerName, meshBounds, userBounds);
41
42 const plane& pln = *this;
43
44 // Plane does not intersect the user bounding box
45 if (userBounds.valid() && !userBounds.intersects(pln))
46 {
48 << nl << callerName
49 << " : Plane "<< pln << " does not intersect the bounds "
50 << userBounds
51 << nl << endl;
52 }
53
54 // Plane does not intersect the (global) mesh!
55 if (!meshBounds.intersects(pln))
56 {
58 << nl << callerName
59 << " : Plane "<< pln << " does not intersect the mesh bounds "
60 << meshBounds
61 << nl << endl;
62 }
63}
64
65
67(
68 const polyMesh& mesh,
69 const boundBox& userBounds,
70 const wordRes& zoneNames,
71 const word callerName,
72 const bool warn
73) const
74{
75 boundBox meshBounds;
76
77 bitSet cellsToSelect =
79 (
80 mesh, userBounds, zoneNames, meshBounds
81 );
82
83 if (warn)
84 {
85 checkOverlap(callerName, meshBounds, userBounds);
86 }
87
88 return cellsToSelect;
89}
90
91
92// ************************************************************************* //
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:66
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:64
bool valid() const
Bounding box is non-inverted.
Definition: boundBoxI.H:76
bool intersects(const plane &pln) const
Does plane intersect this bounding box.
Definition: boundBox.C:200
void checkOverlap(const word callerName, const boundBox &meshBounds, const boundBox &userBounds) const
static void checkOverlap(const word callerName, const boundBox &meshBounds, const boundBox &userBounds)
Check and warn if bounding boxes do not intersect.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
Definition: plane.H:95
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:54
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
#define WarningInFunction
Report a warning using Foam::Warning.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53