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 Declarations
57 class cellModel;
58 
59 /*---------------------------------------------------------------------------*\
60  Class hexCellLooper Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class hexCellLooper
64 :
65  public geomCellLooper
66 {
67 protected:
68 
69  // Protected Data
70 
71  //- Reference to hex cell shape.
72  const cellModel& hex_;
73 
74 private:
75 
76  // Private Member Functions
77 
78  //- Walk across faces of hex. Update loop/loopWeights with edges cut.
79  // Return true if successful walk. (should be always!)
80  bool walkHex
81  (
82  const label celli,
83  const label startFacei,
84  const label startEdgeI,
85 
86  labelList& loop,
87  scalarField& loopWeights
88  ) const;
89 
90  //- Convert loop into face and points
91  void makeFace
92  (
93  const labelList& loop,
94  const scalarField& loopWeights,
95 
96  labelList& faceVerts,
97  pointField& facePoints
98  ) const;
99 
100 
101  //- No copy construct
102  hexCellLooper(const hexCellLooper&) = delete;
103 
104  //- No copy assignment
105  void operator=(const hexCellLooper&) = delete;
106 
107 
108 public:
109 
110  //- Runtime type information
111  TypeName("hexCellLooper");
112 
113 
114  // Constructors
115 
116  //- Construct from mesh
117  explicit hexCellLooper(const polyMesh& mesh);
118 
119 
120  //- Destructor
121  virtual ~hexCellLooper() = default;
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 // ************************************************************************* //
typeInfo.H
geomCellLooper.H
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::Field< scalar >
Foam::hexCellLooper::TypeName
TypeName("hexCellLooper")
Runtime type information.
Foam::geomCellLooper
Implementation of cellLooper. Does pure geometric cut through cell.
Definition: geomCellLooper.H:66
Foam::hexCellLooper::hex_
const cellModel & hex_
Reference to hex cell shape.
Definition: hexCellLooper.H:71
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:162
Foam::hexCellLooper
Implementation of cellLooper.
Definition: hexCellLooper.H:62
Foam::hexCellLooper::~hexCellLooper
virtual ~hexCellLooper()=default
Destructor.
Foam::edgeVertex::mesh
const polyMesh & mesh() const
Definition: edgeVertex.H:101