cellLooper.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::cellLooper
26 
27 Description
28  Abstract base class. Concrete implementations know how to cut a cell
29  (i.e. determine a loop around the circumference).
30 
31  Loop around the cell is given as the vertices to be cut and edges to
32  be cut (and a weight between 0 and 1 giving where the cut is to be
33  made). Main routine is 'cut' which gets called for every cell and
34  gets the current cut situation and expects to return a loop on the
35  cell circumference.
36 
37  Calling function needs to determine whether cellLooper is compatible with
38  existing set of cuts.
39 
40  Also contains various utility functions which implementations might want to
41  use.
42 
43 SourceFiles
44  cellLooper.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef cellLooper_H
49 #define cellLooper_H
50 
51 #include "edgeVertex.H"
52 #include "vector.H"
53 #include "boolList.H"
54 #include "scalarField.H"
55 #include "DynamicList.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 
62 // Forward declaration of classes
63 class polyMesh;
64 class plane;
65 
66 /*---------------------------------------------------------------------------*\
67  Class cellLooper Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 class cellLooper
71 :
72  public edgeVertex
73 {
74 
75 protected:
76 
77  // Protected Member Functions
78 
79  //- Get faces (on cell) connected to vertI which are not using edgeI
81  (
82  const label celli,
83  const label edgeI,
84  const label vertI
85  ) const;
86 
87  //- Get first edge connected to vertI and on facei
89  (
90  const label facei,
91  const label vertI
92  ) const;
93 
94  //- Get edges (on cell) connected to vertI which are not on facei
96  (
97  const label celli,
98  const label facei,
99  const label vertI
100  ) const;
101 
102  //- Return edge from cellEdges that is most perpendicular
103  // to refinement direction.
104  label getMisAlignedEdge(const vector& refDir, const label celli) const;
105 
106 
107 public:
108 
109  //- Runtime type information
110  TypeName("cellLooper");
111 
112 
113  // Constructors
114 
115  //- Construct from components
116  cellLooper(const polyMesh& mesh);
117 
118  //- Disallow default bitwise copy construction
119  cellLooper(const cellLooper&) = delete;
120 
121 
122  //- Destructor
123  virtual ~cellLooper();
124 
125 
126  // Member Functions
127 
128  //- Create cut along circumference of celli. Gets current mesh cuts
129  // vertIsCut, edgeIsCut, edgeWeight).
130  // Cut along circumference is expressed as cellVertCut,
131  // cellEdgeToWeight. Returns true if successful. Still might not
132  // be compatible with existing cuts but this should be handled by
133  // caller).
134  virtual bool cut
135  (
136  const vector& refDir,
137  const label celli,
138  const boolList& vertIsCut,
139  const boolList& edgeIsCut,
140  const scalarField& edgeWeight,
141 
142  labelList& loop,
143  scalarField& loopWeights
144  ) const = 0;
145 
146  //- Same but now also base point of cut provided (instead of always
147  // cell centre)
148  virtual bool cut
149  (
150  const plane& cutPlane,
151  const label celli,
152  const boolList& vertIsCut,
153  const boolList& edgeIsCut,
154  const scalarField& edgeWeight,
155 
156  labelList& loop,
157  scalarField& loopWeights
158  ) const = 0;
159 
160 
161  // Member Operators
162 
163  //- Disallow default bitwise assignment
164  void operator=(const cellLooper&) = delete;
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
Abstract base class. Concrete implementations know how to cut a cell (i.e. determine a loop around th...
Definition: cellLooper.H:72
cellLooper(const polyMesh &mesh)
Construct from components.
Definition: cellLooper.C:171
virtual bool cut(const vector &refDir, const label celli, const boolList &vertIsCut, const boolList &edgeIsCut, const scalarField &edgeWeight, labelList &loop, scalarField &loopWeights) const =0
Create cut along circumference of celli. Gets current mesh cuts.
labelList getVertEdgesNonFace(const label celli, const label facei, const label vertI) const
Get edges (on cell) connected to vertI which are not on facei.
Definition: cellLooper.C:107
label getMisAlignedEdge(const vector &refDir, const label celli) const
Return edge from cellEdges that is most perpendicular.
Definition: cellLooper.C:141
void operator=(const cellLooper &)=delete
Disallow default bitwise assignment.
label getFirstVertEdge(const label facei, const label vertI) const
Get first edge connected to vertI and on facei.
Definition: cellLooper.C:78
labelList getVertFacesNonEdge(const label celli, const label edgeI, const label vertI) const
Get faces (on cell) connected to vertI which are not using edgeI.
Definition: cellLooper.C:42
TypeName("cellLooper")
Runtime type information.
virtual ~cellLooper()
Destructor.
Definition: cellLooper.C:179
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
Definition: edgeVertex.H:53
const polyMesh & mesh() const
Definition: edgeVertex.H:93
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:61
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59