FreeFOAM The Cross-Platform CFD Toolkit
hexCellLooper.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::hexCellLooper
26 
27 Description
28  Implementation of cellLooper.
29 
30  This one walks hexes in a topological way:
31  - cross edge to other face
32  - cross face by walking edge-point-edge across to reach the other side.
33  (edges are always cut through the middle)
34 
35  For anything else (tet, prism, .. poly) it will use geomCellLooper
36  (which does a purely geometric cut using a plane through cell centre)
37 
38 SourceFiles
39  hexCellLooper.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef hexCellLooper_H
44 #define hexCellLooper_H
45 
46 #include "geomCellLooper.H"
47 #include <OpenFOAM/typeInfo.H>
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward declaration of classes
55 class cellModel;
56 
57 /*---------------------------------------------------------------------------*\
58  Class hexCellLooper Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 :
63  public geomCellLooper
64 {
65 
66 protected:
67 
68  // Protected data
69 
70  //- Reference to hex cell shape.
71  const cellModel& hex_;
72 
73 private:
74 
75  // Private Member Functions
76 
77  //- walk across faces of hex. Update loop/loopWeights with edges cut.
78  // Return true if successful walk. (should be always!)
79  bool walkHex
80  (
81  const label cellI,
82  const label startFaceI,
83  const label startEdgeI,
84 
85  labelList& loop,
86  scalarField& loopWeights
87  ) const;
88 
89  //- Convert loop into face and points
90  void makeFace
91  (
92  const labelList& loop,
93  const scalarField& loopWeights,
94 
95  labelList& faceVerts,
96  pointField& facePoints
97  ) const;
98 
99 
100  //- Disallow default bitwise copy construct
102 
103  //- Disallow default bitwise assignment
104  void operator=(const hexCellLooper&);
105 
106 
107 public:
108 
109  //- Runtime type information
110  TypeName("hexCellLooper");
111 
112 
113  // Constructors
114 
115  //- Construct from components
116  hexCellLooper(const polyMesh& mesh);
117 
118 
119  // Destructor
120 
121  virtual ~hexCellLooper();
122 
123 
124  // Member Functions
125 
126  //- Create cut along circumference of cellI. Gets current mesh cuts.
127  // Cut along circumference is expressed as loop of cuts plus weights
128  // for cuts along edges (only valid for edge cuts).
129  // Return true if successful cut.
130  virtual bool cut
131  (
132  const vector& refDir,
133  const label cellI,
134  const boolList& vertIsCut,
135  const boolList& edgeIsCut,
136  const scalarField& edgeWeight,
137 
138  labelList& loop,
139  scalarField& loopWeights
140  ) const;
141 
142 
143  //- Same but now also base point of cut provided (instead of always
144  // cell centre)
145  virtual bool cut
146  (
147  const plane& cutPlane,
148  const label cellI,
149  const boolList& vertIsCut,
150  const boolList& edgeIsCut,
151  const scalarField& edgeWeight,
152 
153  labelList& loop,
154  scalarField& loopWeights
155  ) const;
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************ vim: set sw=4 sts=4 et: ************************ //