FreeFOAM The Cross-Platform CFD Toolkit
cellToFaceStencil.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::cellToFaceStencil
26 
27 Description
28  baseclass for extended cell-to-facel stencils (face values from
29  neighbouring cells)
30 
31 SourceFiles
32  faceStencil.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef cellToFaceStencil_H
37 #define cellToFaceStencil_H
38 
39 #include <OpenFOAM/globalIndex.H>
40 #include <OpenFOAM/boolList.H>
41 #include <OpenFOAM/HashSet.H>
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class polyMesh;
50 
51 /*---------------------------------------------------------------------------*\
52  Class cellToFaceStencil Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public labelListList
58 {
59  // Private data
60 
61  const polyMesh& mesh_;
62 
63  //- Global numbering for cells and boundary faces
64  const globalIndex globalNumbering_;
65 
66 
67  // Private Member Functions
68 
69  //- Disallow default bitwise copy construct
71 
72  //- Disallow default bitwise assignment
73  void operator=(const cellToFaceStencil&);
74 
75 
76 protected:
77 
78  //- Merge two lists.
79  static void merge
80  (
81  const label,
82  const label,
83  const labelList&,
84  labelList&
85  );
86 
87  //- Merge two lists.
88  static void merge(const label, const labelList&, labelList&);
89 
90  //- Valid boundary faces (not empty and not coupled)
91  void validBoundaryFaces(boolList& isValidBFace) const;
92 
93  //- Return patch of all coupled faces.
95 
96  //- Combine operator for labelLists
97  class unionEqOp
98  {
99  public:
100  void operator()( labelList& x, const labelList& y ) const;
101  };
102 
103  //- Collect cell neighbours of faces in global numbering
104  void insertFaceCells
105  (
106  const label exclude0,
107  const label exclude1,
108  const boolList& nonEmptyFace,
109  const labelList& faceLabels,
110  labelHashSet& globals
111  ) const;
112 
113  //- Collect cell neighbours of faces in global numbering
115  (
116  const boolList& nonEmptyFace,
117  const labelList& faceLabels,
118  labelHashSet& globals
119  ) const;
120 
121 
122  //- Collect cell neighbours into extended stencil
123  void calcFaceStencil
124  (
125  const labelListList& globalCellCells,
126  labelListList& faceStencil
127  ) const;
128 
129 
130 public:
131 
132  // Constructors
133 
134  //- Construct from mesh
135  explicit cellToFaceStencil(const polyMesh&);
136 
137 
138  // Member Functions
139 
140  const polyMesh& mesh() const
141  {
142  return mesh_;
143  }
144 
145  //- Global numbering for cells and boundary faces
147  {
148  return globalNumbering_;
149  }
150 
151  //- Work-around for C++ Standard Core Language Defect 391
152  const cellToFaceStencil& by_ref() const
153  {
154  return *this;
155  }
156 
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************ vim: set sw=4 sts=4 et: ************************ //