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 -------------------------------------------------------------------------------
10 License
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 =
78  cuttingSurfaceBase::cellSelection
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 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:63
cuttingPlane.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::plane
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
Definition: plane.H:89
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::boundBox::intersects
bool intersects(const plane &pln) const
Does plane intersect this bounding box.
Definition: boundBox.C:200
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::boundBox
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
Foam::boundBox::valid
bool valid() const
Bounding box is non-inverted.
Definition: boundBoxI.H:76
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:328
Foam::cuttingPlane::cellSelection
bitSet cellSelection(const polyMesh &mesh, const boundBox &userBounds, const wordRes &zoneNames, const word callerName, const bool warn) const
Define cell selection from bounding-box and zones.
Definition: cuttingPlaneSelection.C:67
Foam::cuttingPlane::checkOverlap
void checkOverlap(const word callerName, const boundBox &meshBounds, const boundBox &userBounds) const
Definition: cuttingPlaneSelection.C:34