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) 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::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 "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 
61 class hexCellLooper
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  virtual ~hexCellLooper();
121 
122 
123  // Member Functions
124 
125  //- Create cut along circumference of celli. Gets current mesh cuts.
126  // Cut along circumference is expressed as loop of cuts plus weights
127  // for cuts along edges (only valid for edge cuts).
128  // Return true if successful cut.
129  virtual bool cut
130  (
131  const vector& refDir,
132  const label celli,
133  const boolList& vertIsCut,
134  const boolList& edgeIsCut,
135  const scalarField& edgeWeight,
136 
137  labelList& loop,
138  scalarField& loopWeights
139  ) const;
140 
141 
142  //- Same but now also base point of cut provided (instead of always
143  // cell centre)
144  virtual bool cut
145  (
146  const plane& cutPlane,
147  const label celli,
148  const boolList& vertIsCut,
149  const boolList& edgeIsCut,
150  const scalarField& edgeWeight,
151 
152  labelList& loop,
153  scalarField& loopWeights
154  ) const;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************************************************************* //
virtual ~hexCellLooper()
Destructor.
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
TypeName("hexCellLooper")
Runtime type information.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:60
const cellModel & hex_
Reference to hex cell shape.
Definition: hexCellLooper.H:70
const polyMesh & mesh() const
Definition: edgeVertex.H:98
Implementation of cellLooper.
Definition: hexCellLooper.H:60
Maps a geometry to a set of cell primitives, which enables geometric cell data to be calculated witho...
Definition: cellModel.H:64
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual bool cut(const vector &refDir, const label celli, const boolList &vertIsCut, const boolList &edgeIsCut, const scalarField &edgeWeight, labelList &loop, scalarField &loopWeights) const
Create cut along circumference of celli. Gets current mesh cuts.
Namespace for OpenFOAM.
Implementation of cellLooper. Does pure geometric cut through cell.