hexCellLooper.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 public:
101 
102  //- Runtime type information
103  TypeName("hexCellLooper");
104 
105 
106  // Constructors
107 
108  //- Construct from components
109  hexCellLooper(const polyMesh& mesh);
110 
111  //- Disallow default bitwise copy construction
112  hexCellLooper(const hexCellLooper&) = delete;
113 
114 
115  //- Destructor
116  virtual ~hexCellLooper();
117 
118 
119  // Member Functions
120 
121  //- Create cut along circumference of celli. Gets current mesh cuts.
122  // Cut along circumference is expressed as loop of cuts plus weights
123  // for cuts along edges (only valid for edge cuts).
124  // Return true if successful cut.
125  virtual bool cut
126  (
127  const vector& refDir,
128  const label celli,
129  const boolList& vertIsCut,
130  const boolList& edgeIsCut,
131  const scalarField& edgeWeight,
132 
133  labelList& loop,
134  scalarField& loopWeights
135  ) const;
136 
137 
138  //- Same but now also base point of cut provided (instead of always
139  // cell centre)
140  virtual bool cut
141  (
142  const plane& cutPlane,
143  const label celli,
144  const boolList& vertIsCut,
145  const boolList& edgeIsCut,
146  const scalarField& edgeWeight,
147 
148  labelList& loop,
149  scalarField& loopWeights
150  ) const;
151 
152 
153  // Member Operators
154 
155  //- Disallow default bitwise assignment
156  void operator=(const hexCellLooper&) = delete;
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
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
void operator=(const hexCellLooper &)=delete
Disallow default bitwise assignment.
const cellModel & hex_
Reference to hex cell shape.
Definition: hexCellLooper.H:70
hexCellLooper(const polyMesh &mesh)
Construct from components.
const polyMesh & mesh() const
Definition: edgeVertex.H:93
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.