cellLooper.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::cellLooper
29 
30 Description
31  Abstract base class. Concrete implementations know how to cut a cell
32  (i.e. determine a loop around the circumference).
33 
34  Loop around the cell is given as the vertices to be cut and edges to
35  be cut (and a weight between 0 and 1 giving where the cut is to be
36  made). Main routine is 'cut' which gets called for every cell and
37  gets the current cut situation and expects to return a loop on the
38  cell circumference.
39 
40  Calling function needs to determine whether cellLooper is compatible with
41  existing set of cuts.
42 
43  Also contains various utility functions which implementations might want to
44  use.
45 
46 SourceFiles
47  cellLooper.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef cellLooper_H
52 #define cellLooper_H
53 
54 #include "edgeVertex.H"
55 #include "vector.H"
56 #include "boolList.H"
57 #include "scalarField.H"
58 #include "DynamicList.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 
65 // Forward Declarations
66 class polyMesh;
67 class plane;
68 
69 /*---------------------------------------------------------------------------*\
70  Class cellLooper Declaration
71 \*---------------------------------------------------------------------------*/
72 
73 class cellLooper
74 :
75  public edgeVertex
76 {
77 protected:
78 
79  // Protected Member Functions
80 
81  //- Get faces (on cell) connected to vertI which are not using edgeI
83  (
84  const label celli,
85  const label edgeI,
86  const label vertI
87  ) const;
88 
89  //- Get first edge connected to vertI and on facei
90  label getFirstVertEdge
91  (
92  const label facei,
93  const label vertI
94  ) const;
95 
96  //- Get edges (on cell) connected to vertI which are not on facei
98  (
99  const label celli,
100  const label facei,
101  const label vertI
102  ) const;
103 
104  //- Return edge from cellEdges that is most perpendicular
105  // to refinement direction.
106  label getMisAlignedEdge(const vector& refDir, const label celli) const;
107 
108 
109  //- No copy construct
110  cellLooper(const cellLooper&) = delete;
111 
112  //- No copy assignment
113  void operator=(const cellLooper&) = delete;
114 
115 
116 public:
117 
118  //- Runtime type information
119  TypeName("cellLooper");
120 
121 
122  // Declare run-time constructor selection table
123 
124  // For the direct constructor
126  (
127  autoPtr,
128  cellLooper,
129  word,
130  (
131  const polyMesh& mesh
132  ),
133  (mesh)
134  );
135 
136 
137  // Constructors
138 
139  //- Construct from mesh
140  explicit cellLooper(const polyMesh& mesh);
141 
142  //- Clone
143  autoPtr<cellLooper> clone() const
144  {
146  return nullptr;
147  }
148 
149 
150  // Selectors
151 
152  //- Return a reference to the selected cellLooper
153  static autoPtr<cellLooper> New
154  (
155  const word& type,
156  const polyMesh& mesh
157  );
158 
159 
160  //- Destructor
161  virtual ~cellLooper() = default;
162 
163 
164  // Member Functions
165 
166  //- Create cut along circumference of celli. Gets current mesh cuts
167  // vertIsCut, edgeIsCut, edgeWeight).
168  // Cut along circumference is expressed as cellVertCut,
169  // cellEdgeToWeight. Returns true if successful. Still might not
170  // be compatible with existing cuts but this should be handled by
171  // caller).
172  virtual bool cut
173  (
174  const vector& refDir,
175  const label celli,
176  const boolList& vertIsCut,
177  const boolList& edgeIsCut,
178  const scalarField& edgeWeight,
179 
180  labelList& loop,
181  scalarField& loopWeights
182  ) const = 0;
183 
184  //- Same but now also base point of cut provided (instead of always
185  // cell centre)
186  virtual bool cut
187  (
188  const plane& cutPlane,
189  const label celli,
190  const boolList& vertIsCut,
191  const boolList& edgeIsCut,
192  const scalarField& edgeWeight,
193 
194  labelList& loop,
195  scalarField& loopWeights
196  ) const = 0;
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
boolList.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
scalarField.H
Foam::cellLooper::getVertEdgesNonFace
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:135
Foam::edgeVertex
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
Definition: edgeVertex.H:55
Foam::cellLooper::getFirstVertEdge
label getFirstVertEdge(const label facei, const label vertI) const
Get first edge connected to vertI and on facei.
Definition: cellLooper.C:106
Foam::cellLooper::cellLooper
cellLooper(const cellLooper &)=delete
No copy construct.
Foam::cellLooper::cut
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.
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
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::Field< scalar >
Foam::cellLooper::TypeName
TypeName("cellLooper")
Runtime type information.
Foam::cellLooper::operator=
void operator=(const cellLooper &)=delete
No copy assignment.
Foam::cellLooper
Abstract base class. Concrete implementations know how to cut a cell (i.e. determine a loop around th...
Definition: cellLooper.H:72
Foam::cellLooper::~cellLooper
virtual ~cellLooper()=default
Destructor.
Foam::cellLooper::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, cellLooper, word,(const polyMesh &mesh),(mesh))
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::Vector< scalar >
Foam::List< label >
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::cellLooper::getVertFacesNonEdge
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:70
Foam::cellLooper::New
static autoPtr< cellLooper > New(const word &type, const polyMesh &mesh)
Return a reference to the selected cellLooper.
Definition: cellLooper.C:46
Foam::cellLooper::clone
autoPtr< cellLooper > clone() const
Clone.
Definition: cellLooper.H:142
vector.H
DynamicList.H
Foam::cellLooper::getMisAlignedEdge
label getMisAlignedEdge(const vector &refDir, const label celli) const
Return edge from cellEdges that is most perpendicular.
Definition: cellLooper.C:169
edgeVertex.H
Foam::edgeVertex::mesh
const polyMesh & mesh() const
Definition: edgeVertex.H:101