channelIndex.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-2019 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::channelIndex
26 
27 Description
28  Does averaging of fields over layers of cells. Assumes layered mesh.
29 
30 SourceFiles
31  channelIndex.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef channelIndex_H
36 #define channelIndex_H
37 
38 #include "regionSplit.H"
39 #include "direction.H"
40 #include "scalarField.H"
41 #include "polyMesh.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class channelIndex Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class channelIndex
53 {
54 
55  // Private Data
56 
57  static const NamedEnum<vector::components, 3> vectorComponentsNames_;
58 
59  //- Is mesh symmetric
60  const bool symmetric_;
61 
62  //- Direction to sort
63  const direction dir_;
64 
65  //- Per cell the global region
66  autoPtr<regionSplit> cellRegion_;
67 
68  //- Per global region the number of cells (scalarField so we can use
69  // field algebra)
70  scalarField regionCount_;
71 
72  //- From sorted region back to unsorted global region
73  labelList sortMap_;
74 
75  //- Sorted component of cell centres
76  scalarField y_;
77 
78 
79 
80  // Private Member Functions
81 
82  void walkOppositeFaces
83  (
84  const polyMesh& mesh,
85  const labelList& startFaces,
86  boolList& blockedFace
87  );
88 
89  void calcLayeredRegions
90  (
91  const polyMesh& mesh,
92  const labelList& startFaces
93  );
94 
95 
96 public:
97 
98  // Constructors
99 
100  //- Construct from dictionary
101  channelIndex(const polyMesh&, const dictionary&);
102 
103  //- Construct from supplied starting faces
105  (
106  const polyMesh& mesh,
107  const labelList& startFaces,
108  const bool symmetric,
109  const direction dir
110  );
111 
112  //- Disallow default bitwise copy construction
113  channelIndex(const channelIndex&) = delete;
114 
115 
116  // Member Functions
117 
118  // Access
119 
120  //- Sum field per region
121  template<class T>
122  Field<T> regionSum(const Field<T>& cellField) const;
123 
124  //- Collapse a field to a line
125  template<class T>
127  (
128  const Field<T>& vsf,
129  const bool asymmetric=false
130  ) const;
131 
132  //- Return the field of Y locations from the cell centres
133  const scalarField& y() const
134  {
135  return y_;
136  }
137 
138 
139  // Member Operators
140 
141  //- Disallow default bitwise assignment
142  void operator=(const channelIndex&);
143 };
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #ifdef NoRepository
153  #include "channelIndexTemplates.C"
154 #endif
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
uint8_t direction
Definition: direction.H:45
void operator=(const channelIndex &)
Disallow default bitwise assignment.
Does averaging of fields over layers of cells. Assumes layered mesh.
Definition: channelIndex.H:51
Field< T > regionSum(const Field< T > &cellField) const
Sum field per region.
dynamicFvMesh & mesh
channelIndex(const polyMesh &, const dictionary &)
Construct from dictionary.
const scalarField & y() const
Return the field of Y locations from the cell centres.
Definition: channelIndex.H:132
Field< T > collapse(const Field< T > &vsf, const bool asymmetric=false) const
Collapse a field to a line.
Direction is an 8-bit unsigned integer type used to represent the Cartesian directions etc...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.