All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2020 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  // Declare run-time constructor selection table
114 
115  // For the direct constructor
117  (
118  autoPtr,
119  cellLooper,
120  word,
121  (
122  const polyMesh& mesh
123  ),
124  (mesh)
125  );
126 
127 
128  // Constructors
129 
130  //- Construct from components
131  cellLooper(const polyMesh& mesh);
132 
133  //- Disallow default bitwise copy construction
134  cellLooper(const cellLooper&) = delete;
135 
136  //- Clone
137  autoPtr<cellLooper> clone() const
138  {
140  return autoPtr<cellLooper>(nullptr);
141  }
142 
143 
144  // Selectors
145 
146  //- Return a reference to the selected cellLooper
147  static autoPtr<cellLooper> New
148  (
149  const word& type,
150  const polyMesh& mesh
151  );
152 
153 
154  //- Destructor
155  virtual ~cellLooper();
156 
157 
158  // Member Functions
159 
160  //- Create cut along circumference of celli. Gets current mesh cuts
161  // vertIsCut, edgeIsCut, edgeWeight).
162  // Cut along circumference is expressed as cellVertCut,
163  // cellEdgeToWeight. Returns true if successful. Still might not
164  // be compatible with existing cuts but this should be handled by
165  // caller).
166  virtual bool cut
167  (
168  const vector& refDir,
169  const label celli,
170  const boolList& vertIsCut,
171  const boolList& edgeIsCut,
172  const scalarField& edgeWeight,
173 
174  labelList& loop,
175  scalarField& loopWeights
176  ) const = 0;
177 
178  //- Same but now also base point of cut provided (instead of always
179  // cell centre)
180  virtual bool cut
181  (
182  const plane& cutPlane,
183  const label celli,
184  const boolList& vertIsCut,
185  const boolList& edgeIsCut,
186  const scalarField& edgeWeight,
187 
188  labelList& loop,
189  scalarField& loopWeights
190  ) const = 0;
191 
192 
193  // Member Operators
194 
195  //- Disallow default bitwise assignment
196  void operator=(const cellLooper&) = delete;
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
declareRunTimeSelectionTable(autoPtr, cellLooper, word,(const polyMesh &mesh),(mesh))
label getFirstVertEdge(const label facei, const label vertI) const
Get first edge connected to vertI and on facei.
Definition: cellLooper.C:104
Abstract base class. Concrete implementations know how to cut a cell (i.e. determine a loop around th...
Definition: cellLooper.H:69
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:60
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:68
autoPtr< cellLooper > clone() const
Clone.
Definition: cellLooper.H:136
label getMisAlignedEdge(const vector &refDir, const label celli) const
Return edge from cellEdges that is most perpendicular.
Definition: cellLooper.C:167
cellLooper(const polyMesh &mesh)
Construct from components.
Definition: cellLooper.C:197
A class for handling words, derived from string.
Definition: word.H:59
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
Definition: edgeVertex.H:52
void operator=(const cellLooper &)=delete
Disallow default bitwise assignment.
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:133
const polyMesh & mesh() const
Definition: edgeVertex.H:93
virtual ~cellLooper()
Destructor.
Definition: cellLooper.C:205
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.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
static autoPtr< cellLooper > New(const word &type, const polyMesh &mesh)
Return a reference to the selected cellLooper.
Definition: cellLooper.C:43
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
TypeName("cellLooper")
Runtime type information.
Namespace for OpenFOAM.