walkPatch.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::walkPatch
28 
29 Description
30  Collection of static functions to do various simple patch related things.
31 
32 SourceFiles
33  walkPatch.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef walkPatch_H
38 #define walkPatch_H
39 
40 #include "labelList.H"
41 #include "primitivePatch.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class walkPatch Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class walkPatch
53 {
54  // Private data
55 
56  //- Reference to patch to walk on
57  const primitivePatch& pp_;
58 
59  //- Reference to zones
60  const labelList& faceZone_;
61 
62  //- How to walk through faces
63  const bool reverse_;
64 
65  //- Reference to list to mark off visited faces
66  boolList& visited_;
67 
68 
69  // Faces visited
70  DynamicList<label> visitOrder_;
71 
72  // Index in face of vertex it was visited through
73  DynamicList<label> indexInFace_;
74 
75 
76  // Private Member Functions
77 
78  //- Get other face using v0, v1. Returns -1 if none.
79  label getNeighbour
80  (
81  const label facei,
82  const label fp,
83  const label v0,
84  const label v1
85  ) const;
86 
87  //- Gets labels of changed faces and enterVertices on faces.
88  // Returns labels of faces changed and enterVertices on them.
89  void faceToFace
90  (
91  const labelList& changedFaces,
92  const labelList& enterVerts,
93 
94  labelList& nbrFaces,
95  labelList& nbrEnterVerts
96  );
97 
98 
99  //- No copy construct
100  walkPatch(const walkPatch&) = delete;
101 
102  //- No copy assignment
103  void operator=(const walkPatch&) = delete;
104 
105 public:
106 
107  ClassName("walkPatch");
108 
109 
110  // Constructors
111 
112  //- Construct from components
113  walkPatch
114  (
115  const primitivePatch& pp,
116  const labelList& faceZone, // Per face which zone it belongs to
117  const bool reverse, // Reverse walk
118  const label facei, // Current face
119  const label enterVertI, // Vertex across which this face
120  // is visited.
121  boolList& visited
122  );
123 
124 
125  // Member Functions
126 
127  const DynamicList<label>& visitOrder() const
128  {
129  return visitOrder_;
130  }
131 
132  const DynamicList<label>& indexInFace() const
133  {
134  return indexInFace_;
135  }
136 
137 };
138 
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 } // End namespace Foam
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 #endif
147 
148 // ************************************************************************* //
Foam::reverse
void reverse(UList< T > &list, const label n)
Definition: UListI.H:449
Foam::DynamicList< label >
Foam::walkPatch::visitOrder
const DynamicList< label > & visitOrder() const
Definition: walkPatch.H:126
Foam::walkPatch::ClassName
ClassName("walkPatch")
Foam::faceToFace
A topoSetFaceSource to select faces based on usage in another faceSet.
Definition: faceToFace.H:159
labelList.H
Foam::faceZone
A subset of mesh faces organised as a primitive patch.
Definition: faceZone.H:64
Foam::walkPatch::indexInFace
const DynamicList< label > & indexInFace() const
Definition: walkPatch.H:131
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List< label >
Foam::walkPatch
Collection of static functions to do various simple patch related things.
Definition: walkPatch.H:51
primitivePatch.H
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79