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 | Copyright (C) 2011-2016 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 private:
108 
109  // Private Member Functions
110 
111  //- Disallow default bitwise copy construct
112  cellLooper(const cellLooper&);
113 
114  //- Disallow default bitwise assignment
115  void operator=(const cellLooper&);
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("cellLooper");
122 
123 
124  // Declare run-time constructor selection table
125 
126  // For the direct constructor
128  (
129  autoPtr,
130  cellLooper,
131  word,
132  (
133  const polyMesh& mesh
134  ),
135  (mesh)
136  );
137 
138 
139  // Constructors
140 
141  //- Construct from components
142  cellLooper(const polyMesh& mesh);
143 
144  //- Clone
145  autoPtr<cellLooper> clone() const
146  {
148  return autoPtr<cellLooper>(nullptr);
149  }
150 
151 
152  // Selectors
153 
154  //- Return a reference to the selected cellLooper
155  static autoPtr<cellLooper> New
156  (
157  const word& type,
158  const polyMesh& mesh
159  );
160 
161 
162  //- Destructor
163  virtual ~cellLooper();
164 
165 
166  // Member Functions
167 
168  //- Create cut along circumference of celli. Gets current mesh cuts
169  // vertIsCut, edgeIsCut, edgeWeight).
170  // Cut along circumference is expressed as cellVertCut,
171  // cellEdgeToWeight. Returns true if succesfull. Still might not
172  // be compatible with existing cuts but this should be handled by
173  // caller).
174  virtual bool cut
175  (
176  const vector& refDir,
177  const label celli,
178  const boolList& vertIsCut,
179  const boolList& edgeIsCut,
180  const scalarField& edgeWeight,
181 
182  labelList& loop,
183  scalarField& loopWeights
184  ) const = 0;
185 
186  //- Same but now also base point of cut provided (instead of always
187  // cell centre)
188  virtual bool cut
189  (
190  const plane& cutPlane,
191  const label celli,
192  const boolList& vertIsCut,
193  const boolList& edgeIsCut,
194  const scalarField& edgeWeight,
195 
196  labelList& loop,
197  scalarField& loopWeights
198  ) const = 0;
199 
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
declareRunTimeSelectionTable(autoPtr, cellLooper, word,(const polyMesh &mesh),(mesh))
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
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:144
label getMisAlignedEdge(const vector &refDir, const label celli) const
Return edge from cellEdges that is most perpendicular.
Definition: cellLooper.C:167
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
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:98
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:485
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.
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:74
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:366
TypeName("cellLooper")
Runtime type information.
Namespace for OpenFOAM.