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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::hexCellLooper
28 
29 Description
30  Implementation of cellLooper.
31 
32  This one walks hexes in a topological way:
33  - cross edge to other face
34  - cross face by walking edge-point-edge across to reach the other side.
35  (edges are always cut through the middle)
36 
37  For anything else (tet, prism, .. poly) it will use geomCellLooper
38  (which does a purely geometric cut using a plane through cell centre)
39 
40 SourceFiles
41  hexCellLooper.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef hexCellLooper_H
46 #define hexCellLooper_H
47 
48 #include "geomCellLooper.H"
49 #include "typeInfo.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // Forward declaration of classes
57 class cellModel;
58 
59 /*---------------------------------------------------------------------------*\
60  Class hexCellLooper Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class hexCellLooper
64 :
65  public geomCellLooper
66 {
67 
68 protected:
69 
70  // Protected data
71 
72  //- Reference to hex cell shape.
73  const cellModel& hex_;
74 
75 private:
76 
77  // Private Member Functions
78 
79  //- Walk across faces of hex. Update loop/loopWeights with edges cut.
80  // Return true if successful walk. (should be always!)
81  bool walkHex
82  (
83  const label celli,
84  const label startFacei,
85  const label startEdgeI,
86 
87  labelList& loop,
88  scalarField& loopWeights
89  ) const;
90 
91  //- Convert loop into face and points
92  void makeFace
93  (
94  const labelList& loop,
95  const scalarField& loopWeights,
96 
97  labelList& faceVerts,
98  pointField& facePoints
99  ) const;
100 
101 
102  //- No copy construct
103  hexCellLooper(const hexCellLooper&) = delete;
104 
105  //- No copy assignment
106  void operator=(const hexCellLooper&) = delete;
107 
108 
109 public:
110 
111  //- Runtime type information
112  TypeName("hexCellLooper");
113 
114 
115  // Constructors
116 
117  //- Construct from components
118  hexCellLooper(const polyMesh& mesh);
119 
120 
121  //- Destructor
122  virtual ~hexCellLooper();
123 
124 
125  // Member Functions
126 
127  //- Create cut along circumference of celli. Gets current mesh cuts.
128  // Cut along circumference is expressed as loop of cuts plus weights
129  // for cuts along edges (only valid for edge cuts).
130  // Return true if successful cut.
131  virtual bool cut
132  (
133  const vector& refDir,
134  const label celli,
135  const boolList& vertIsCut,
136  const boolList& edgeIsCut,
137  const scalarField& edgeWeight,
138 
139  labelList& loop,
140  scalarField& loopWeights
141  ) const;
142 
143 
144  //- Same but now also base point of cut provided (instead of always
145  // cell centre)
146  virtual bool cut
147  (
148  const plane& cutPlane,
149  const label celli,
150  const boolList& vertIsCut,
151  const boolList& edgeIsCut,
152  const scalarField& edgeWeight,
153 
154  labelList& loop,
155  scalarField& loopWeights
156  ) const;
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
typeInfo.H
geomCellLooper.H
Foam::hexCellLooper::~hexCellLooper
virtual ~hexCellLooper()
Destructor.
Definition: hexCellLooper.C:163
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::plane
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
Definition: plane.H:89
Foam::label
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:62
Foam::Field< scalar >
Foam::hexCellLooper::TypeName
TypeName("hexCellLooper")
Runtime type information.
Foam::geomCellLooper
Implementation of cellLooper. Does pure geometric cut through cell.
Definition: geomCellLooper.H:65
Foam::hexCellLooper::hex_
const cellModel & hex_
Reference to hex cell shape.
Definition: hexCellLooper.H:72
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Vector< scalar >
Foam::List< label >
Foam::cellModel
Maps a geometry to a set of cell primitives.
Definition: cellModel.H:72
Foam::hexCellLooper::cut
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.
Definition: hexCellLooper.C:170
Foam::hexCellLooper
Implementation of cellLooper.
Definition: hexCellLooper.H:62
Foam::edgeVertex::mesh
const polyMesh & mesh() const
Definition: edgeVertex.H:100