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-2018 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 /*---------------------------------------------------------------------------*\
50  Class channelIndex Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class channelIndex
54 {
55 
56  // Private data
57 
58  static const NamedEnum<vector::components, 3> vectorComponentsNames_;
59 
60  //- Is mesh symmetric
61  const bool symmetric_;
62 
63  //- Direction to sort
64  const direction dir_;
65 
66  //- Per cell the global region
67  autoPtr<regionSplit> cellRegion_;
68 
69  //- Per global region the number of cells (scalarField so we can use
70  // field algebra)
71  scalarField regionCount_;
72 
73  //- From sorted region back to unsorted global region
74  labelList sortMap_;
75 
76  //- Sorted component of cell centres
77  scalarField y_;
78 
79 
80 
81  // Private Member Functions
82 
83  void walkOppositeFaces
84  (
85  const polyMesh& mesh,
86  const labelList& startFaces,
87  boolList& blockedFace
88  );
89 
90  void calcLayeredRegions
91  (
92  const polyMesh& mesh,
93  const labelList& startFaces
94  );
95 
96  //- Disallow default bitwise copy construct and assignment
97  channelIndex(const channelIndex&);
98  void operator=(const channelIndex&);
99 
100 
101 public:
102 
103  // Constructors
104 
105  //- Construct from dictionary
106  channelIndex(const polyMesh&, const dictionary&);
107 
108  //- Construct from supplied starting faces
110  (
111  const polyMesh& mesh,
112  const labelList& startFaces,
113  const bool symmetric,
114  const direction dir
115  );
116 
117 
118  // Member Functions
119 
120  // Access
121 
122  //- Sum field per region
123  template<class T>
124  Field<T> regionSum(const Field<T>& cellField) const;
125 
126  //- Collapse a field to a line
127  template<class T>
129  (
130  const Field<T>& vsf,
131  const bool asymmetric=false
132  ) const;
133 
134  //- Return the field of Y locations from the cell centres
135  const scalarField& y() const
136  {
137  return y_;
138  }
139 
140 };
141 
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #ifdef NoRepository
150  #include "channelIndexTemplates.C"
151 #endif
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
uint8_t direction
Definition: direction.H:45
Does averaging of fields over layers of cells. Assumes layered mesh.
Definition: channelIndex.H:52
Field< T > regionSum(const Field< T > &cellField) const
Sum field per region.
dynamicFvMesh & mesh
const scalarField & y() const
Return the field of Y locations from the cell centres.
Definition: channelIndex.H:134
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.