FreeFOAM The Cross-Platform CFD Toolkit
extendedCellToFaceStencil.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::extendedCellToFaceStencil
26 
27 Description
28  Calculates/constains the extended cell-to-face stencil.
29 
30  The stencil is a list of indices into either cells or boundary faces
31  in a compact way. (element 0 is owner, 1 is neighbour). The index numbering
32  is
33  - cells first
34  - then all (non-empty patch) boundary faces
35 
36  When used in evaluation is a two stage process:
37  - collect the data (cell data and non-empty boundaries) into a
38  single field
39  - (parallel) distribute the field
40  - sum the weights*field.
41 
42 SourceFiles
43  extendedCellToFaceStencil.C
44  extendedCellToFaceStencilTemplates.C
45 
46 \*---------------------------------------------------------------------------*/
47 
48 #ifndef extendedCellToFaceStencil_H
49 #define extendedCellToFaceStencil_H
50 
51 #include <OpenFOAM/mapDistribute.H>
52 #include <finiteVolume/volFields.H>
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 class globalIndex;
61 
62 /*---------------------------------------------------------------------------*\
63  Class extendedCellToFaceStencil Declaration
64 \*---------------------------------------------------------------------------*/
65 
67 {
68 protected:
69 
70  // Protected data
71 
72  const polyMesh& mesh_;
73 
74 
75  // Protected Member Functions
76 
77 
78 
79 private:
80 
81  // Private Member Functions
82 
83  //- Disallow default bitwise copy construct
85 
86  //- Disallow default bitwise assignment
87  void operator=(const extendedCellToFaceStencil&);
88 
89 
90 protected:
91 
92  //- Write some statistics about stencil
93  static void writeStencilStats
94  (
95  Ostream& os,
96  const labelListList& stencil,
97  const mapDistribute& map
98  );
99 
100 public:
101 
102  // Declare name of the class and its debug switch
103  ClassName("extendedCellToFaceStencil");
104 
105 
106  // Constructors
107 
108  //- Construct from mesh
109  explicit extendedCellToFaceStencil(const polyMesh&);
110 
111 
112  // Member Functions
113 
114  //- Calculate distribute map
116  (
117  const polyMesh& mesh,
118  const globalIndex& globalNumbering,
119  labelListList& faceStencil
120  );
121 
122  //- Use map to get the data into stencil order
123  template<class T>
124  static void collectData
125  (
126  const mapDistribute& map,
127  const labelListList& stencil,
129  List<List<T> >& stencilFld
130  );
131 
132  //- Sum vol field contributions to create face values
133  template<class Type>
136  (
137  const mapDistribute& map,
138  const labelListList& stencil,
140  const List<List<scalar> >& stencilWeights
141  );
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #ifdef NoRepository
153 #endif
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************ vim: set sw=4 sts=4 et: ************************ //