cuttingSurface.H
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-2021 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 Class
27  Foam::cuttingSurface
28 
29 Description
30  Constructs a cutting surface through a mesh.
31 
32  No attempt at resolving degenerate cases.
33  Since the cut faces can be quite ugly, they will often be triangulated.
34 
35 SourceFiles
36  cuttingSurface.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef cuttingSurface_H
41 #define cuttingSurface_H
42 
43 #include "searchableSurface.H"
44 #include "cuttingSurfaceBase.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class cuttingSurface Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class cuttingSurface
56 :
57  public cuttingSurfaceBase
58 {
59  // Private Data
60 
61  //- The surface
62  const autoPtr<searchableSurface> surfPtr_;
63 
64 
65  // Private Member Functions
66 
67  //- Determine the cut cells, possibly restricted to a list of cells
68  //
69  // \param pointDist [out] For each mesh point, the (signed) distance
70  // to the surface.
71  // \param cellCuts [in,out] On input an empty set (ie, no restriction)
72  // or subsetted cells. On output, the cells cut according to the
73  // planeSides detection.
74  void calcCellCuts
75  (
76  const fvMesh& fvm,
77  scalarField& pointDist,
79  );
80 
81 
82 protected:
83 
84  // Protected Member Functions
85 
86  //- Cut mesh, restricted to a list of cells
88 
89  //- Cut mesh, restricted to a list of cells
90  // Reclaim memory for cellSelectionMask
91  virtual void performCut
92  (
93  const primitiveMesh& mesh,
94  const bool triangulate,
95  bitSet&& cellIdLabels
96  );
97 
98 
99 public:
100 
101  // Constructors
102 
103  //- Construct from components
105  (
106  const polyMesh& mesh,
107  const word& surfaceType,
108  const word& surfaceName
109  );
110 
111  //- Construct from dictionary
113  (
114  const word& defaultSurfaceName,
115  const polyMesh& mesh,
116  const dictionary& dict
117  );
118 
119 
120  //- Destructor
121  virtual ~cuttingSurface() = default;
122 
123 
124  // Member Functions
125 
126  //- The name of the underlying searchableSurface
127  const word& surfaceName() const
128  {
129  return surfPtr_->name();
130  }
131 
132 
133  // Output
134 
135  //- Print information
136  void print(Ostream& os, int level=0) const;
137 };
138 
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace Foam
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 #endif
147 
148 // ************************************************************************* //
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
searchableSurface.H
Foam::MeshedSurface::triangulate
virtual label triangulate()
Triangulate in-place, returning the number of triangles added.
Definition: MeshedSurface.C:1015
Foam::cuttingSurface::cuttingSurface
cuttingSurface(const polyMesh &mesh, const word &surfaceType, const word &surfaceName)
Construct from components.
Definition: cuttingSurface.C:35
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::cuttingSurface::print
void print(Ostream &os, int level=0) const
Print information.
Definition: cuttingSurface.C:170
Foam::cuttingSurface::performCut
virtual void performCut(const primitiveMesh &mesh, const bool triangulate, bitSet &&cellIdLabels)
Cut mesh, restricted to a list of cells.
Definition: cuttingSurface.C:93
cuttingSurfaceBase.H
Foam::cuttingSurface::~cuttingSurface
virtual ~cuttingSurface()=default
Destructor.
Foam::Field< scalar >
Foam::cuttingSurface::surfaceName
const word & surfaceName() const
The name of the underlying searchableSurface.
Definition: cuttingSurface.H:126
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::cuttingSurfaceBase
Base for creating a MeshedSurface by performing some type of cell cutting/intersection.
Definition: cuttingSurfaceBase.H:60
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::cuttingSurface
Constructs a cutting surface through a mesh.
Definition: cuttingSurface.H:54
Foam::cuttingSurfaceBase::performCut
virtual void performCut(const primitiveMesh &mesh, const bool triangulate, const labelUList &cellIdLabels)
Cut mesh, restricted to a list of cells.
Definition: cuttingSurfaceBase.C:54
Foam::cellCuts
Description of cuts across cells.
Definition: cellCuts.H:110
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78