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