FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <dynamicMesh/edgeVertex.H>
52 #include <OpenFOAM/vector.H>
53 #include <OpenFOAM/boolList.H>
54 #include <OpenFOAM/scalarField.H>
55 #include <OpenFOAM/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 
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
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 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
147  {
148  notImplemented("autoPtr<tcellLooper> clone() const");
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 
165  virtual ~cellLooper();
166 
167 
168  // Member Functions
169 
170  //- Create cut along circumference of cellI. Gets current mesh cuts
171  // vertIsCut, edgeIsCut, edgeWeight).
172  // Cut along circumference is expressed as cellVertCut,
173  // cellEdgeToWeight. Returns true if succesfull. Still might not
174  // be compatible with existing cuts but this should be handled by
175  // caller).
176  virtual bool cut
177  (
178  const vector& refDir,
179  const label cellI,
180  const boolList& vertIsCut,
181  const boolList& edgeIsCut,
182  const scalarField& edgeWeight,
183 
184  labelList& loop,
185  scalarField& loopWeights
186  ) const = 0;
187 
188  //- Same but now also base point of cut provided (instead of always
189  // cell centre)
190  virtual bool cut
191  (
192  const plane& cutPlane,
193  const label cellI,
194  const boolList& vertIsCut,
195  const boolList& edgeIsCut,
196  const scalarField& edgeWeight,
197 
198  labelList& loop,
199  scalarField& loopWeights
200  ) const = 0;
201 
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************ vim: set sw=4 sts=4 et: ************************ //