Loading...
Searching...
No Matches
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{
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
72
73 //- Global numbering for cells and boundary faces
76
77 // Protected Member Functions
78
79 //- Return patch of all coupled faces.
81
82 //- Return patch of all coupled faces.
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
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
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&);
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
148 (
149 const boolList& zone
150 )
151 {
152 calculateStencil(zone,*this);
153 }
154
156 {
157 return needComm_;
158 }
159
160 const polyMesh& mesh() const noexcept
161 {
162 return meshRef_;
163 }
165 //- Global numbering for cells and boundary faces
167 {
168 return globalNumbering_;
170};
171
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175} // End namespace Foam
176
177// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178
179#endif
180
181// ************************************************************************* //
labelList faceLabels(nFaceLabels)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Definition globalIndex.H:77
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
globalIndex globalNumbering_
Global numbering for cells and boundary faces.
const globalIndex & globalNumbering() const noexcept
Global numbering for cells and boundary faces.
labelHashSet needComm_
cells requiring processor communciation
autoPtr< indirectPrimitivePatch > allCoupledFacesPatch() const
Return patch of all coupled faces.
autoPtr< indirectPrimitivePatch > nonEmptyFacesPatch() const
Return patch of all coupled faces.
const labelHashSet & needsComm() noexcept
TypeName("zoneCellStencils")
void updateStencil(const boolList &zone)
virtual void calculateStencil(const boolList &zone, labelListList &globalCellCells)=0
void operator=(const zoneCellStencils &)=delete
No copy assignment.
zoneCellStencils(const zoneCellStencils &)=delete
No copy construct.
static void merge(const label globalI, const labelList &pGlobals, labelList &cCells)
Merge two lists and guarantee globalI is first.
void validBoundaryFaces(boolList &isValidBFace) const
Valid boundary faces (not empty and not coupled).
virtual ~zoneCellStencils()=default
Calculates per cell the neighbour data.
void insertFaceCells(const label exclude0, const label exclude1, const boolList &nonEmptyFace, const labelList &faceLabels, labelHashSet &globals) const
Collect cell neighbours of faces in global numbering.
const polyMesh & mesh() const noexcept
const fvMesh & meshRef_
const reference to fvMesh
labelList calcFaceCells(const boolList &nonEmptyFace, const labelList &faceLabels, labelHashSet &globals) const
Collect cell neighbours of faces in global numbering.
Base class for mesh zones.
Definition zone.H:63
Namespace for OpenFOAM.
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
List< label > labelList
A List of labels.
Definition List.H:62
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition HashSet.H:85
List< bool > boolList
A List of bools.
Definition List.H:60
const direction noexcept
Definition scalarImpl.H:265
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68