zoneCellStencils.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) 2020 DLR
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::zoneCellStencils
28
29Description
30 base class for cell stencil in a narrow band
31
32 Original code supplied by Henning Scheufler, DLR (2019)
33
34SourceFiles
35 zoneCellStencils.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef zoneCellStencils_H
40#define zoneCellStencils_H
41
42#include "boolList.H"
43#include "HashSet.H"
44#include "Map.H"
46#include "MeshObject.H"
47#include "fvMesh.H"
48#include "globalIndex.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class zoneCellStencils Declaration
57\*---------------------------------------------------------------------------*/
58
60:
61 public labelListList
62{
63protected:
64
65 // Protected Data
66
67 //- const reference to fvMesh
68 const fvMesh& meshRef_;
69
70 //- cells requiring processor communciation
71 labelHashSet needComm_;
72
73 //- Global numbering for cells and boundary faces
74 globalIndex globalNumbering_;
75
76
77 // Protected Member Functions
78
79 //- Return patch of all coupled faces.
80 autoPtr<indirectPrimitivePatch> nonEmptyFacesPatch() const;
81
82 //- Return patch of all coupled faces.
83 autoPtr<indirectPrimitivePatch> allCoupledFacesPatch() const;
84
85 //- Valid boundary faces (not empty and not coupled)
86 void validBoundaryFaces(boolList& isValidBFace) const;
87
88 //- Merge two lists and guarantee globalI is first.
89 static void merge
90 (
91 const label globalI,
92 const labelList& pGlobals,
93 labelList& cCells
94 );
95
96 //- Collect cell neighbours of faces in global numbering
97 void insertFaceCells
98 (
99 const label exclude0,
100 const label exclude1,
101 const boolList& nonEmptyFace,
102 const labelList& faceLabels,
103 labelHashSet& globals
104 ) const;
105
106 //- Collect cell neighbours of faces in global numbering
107 labelList calcFaceCells
108 (
109 const boolList& nonEmptyFace,
110 const labelList& faceLabels,
111 labelHashSet& globals
112 ) const;
113
114 virtual void calculateStencil
115 (
116 const boolList& zone,
117 labelListList& globalCellCells
118 ) = 0;
119
120
121 //- No copy construct
122 zoneCellStencils(const zoneCellStencils&) = delete;
123
124 //- No copy assignment
125 void operator=(const zoneCellStencils&) = delete;
126
127public:
128
129 // Declare name of the class and its debug switch
130 TypeName("zoneCellStencils");
131
132
133 // Constructors
134
135 //- Construct from all cells and boundary faces
136 explicit zoneCellStencils(const fvMesh&);
137
138 //- Calculates per cell the neighbour data
139 // (= cell or boundary in global numbering).
140 // First element is always cell itself!
141 //- Destructor
142 virtual ~zoneCellStencils() = default;
143
144
145 // Member Functions
146
147 void updateStencil
148 (
149 const boolList& zone
150 )
151 {
152 calculateStencil(zone,*this);
153 }
154
155 const labelHashSet& needsComm() noexcept
156 {
157 return needComm_;
158 }
159
160 const polyMesh& mesh() const noexcept
161 {
162 return meshRef_;
163 }
164
165 //- Global numbering for cells and boundary faces
166 const globalIndex& globalNumbering() const noexcept
167 {
168 return globalNumbering_;
169 }
170};
171
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175} // End namespace Foam
176
177// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178
179#endif
180
181// ************************************************************************* //
base class for cell stencil in a narrow band
dynamicFvMesh & mesh
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: List.H:66
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:56
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition: HashSet.H:85
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73