extendedCellToFaceStencil.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
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/contains 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 "distributionMap.H"
52 #include "volFields.H"
53 #include "surfaceFields.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  //- Write some statistics about stencil
78  static void writeStencilStats
79  (
80  Ostream& os,
81  const labelListList& stencil,
82  const distributionMap& map
83  );
84 
85 
86 public:
87 
88  // Declare name of the class and its debug switch
89  ClassName("extendedCellToFaceStencil");
90 
91 
92  // Constructors
93 
94  //- Construct from mesh
95  explicit extendedCellToFaceStencil(const polyMesh&);
96 
97 
98  // Member Functions
99 
100  //- Use map to get the data into stencil order
101  template<class Type>
102  static void collectData
103  (
104  const distributionMap& map,
105  const labelListList& stencil,
106  const VolField<Type>& fld,
107  List<List<Type>>& stencilFld
108  );
109 
110  //- Sum vol field contributions to create face values
111  template<class Type>
114  (
115  const distributionMap& map,
116  const labelListList& stencil,
117  const VolField<Type>& fld,
118  const List<List<scalar>>& stencilWeights
119  );
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #ifdef NoRepository
131 #endif
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 #endif
136 
137 // ************************************************************************* //
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Class containing processor-to-processor mapping information.
Calculates/contains the extended cell-to-face stencil.
extendedCellToFaceStencil(const polyMesh &)
Construct from mesh.
static void writeStencilStats(Ostream &os, const labelListList &stencil, const distributionMap &map)
Write some statistics about stencil.
ClassName("extendedCellToFaceStencil")
static void collectData(const distributionMap &map, const labelListList &stencil, const VolField< Type > &fld, List< List< Type >> &stencilFld)
Use map to get the data into stencil order.
static tmp< SurfaceField< Type > > weightedSum(const distributionMap &map, const labelListList &stencil, const VolField< Type > &fld, const List< List< scalar >> &stencilWeights)
Sum vol field contributions to create face values.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A class for managing temporary objects.
Definition: tmp.H:55
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.
Foam::surfaceFields.