channelIndex.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::channelIndex
28 
29 Description
30  Does averaging of fields over layers of cells. Assumes layered mesh.
31 
32 SourceFiles
33  channelIndex.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef channelIndex_H
38 #define channelIndex_H
39 
40 #include "regionSplit.H"
41 #include "direction.H"
42 #include "scalarField.H"
43 #include "polyMesh.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 
51 /*---------------------------------------------------------------------------*\
52  Class channelIndex Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class channelIndex
56 {
57 
58  // Private data
59 
60  static const Enum<vector::components> vectorComponentsNames_;
61 
62  //- Is mesh symmetric
63  const bool symmetric_;
64 
65  //- Direction to sort
66  const direction dir_;
67 
68  //- Per cell the global region
69  autoPtr<regionSplit> cellRegion_;
70 
71  //- Per global region the number of cells (scalarField so we can use
72  // field algebra)
73  scalarField regionCount_;
74 
75  //- From sorted region back to unsorted global region
76  labelList sortMap_;
77 
78  //- Sorted component of cell centres
79  scalarField y_;
80 
81 
82 
83  // Private Member Functions
84 
85  void walkOppositeFaces
86  (
87  const polyMesh& mesh,
88  const labelList& startFaces,
89  boolList& blockedFace
90  );
91 
92  void calcLayeredRegions
93  (
94  const polyMesh& mesh,
95  const labelList& startFaces
96  );
97 
98  //- No copy construct
99  channelIndex(const channelIndex&) = delete;
100 
101  //- No copy assignment
102  void operator=(const channelIndex&) = delete;
103 
104 
105 public:
106 
107  // Constructors
108 
109  //- Construct from dictionary
110  channelIndex(const polyMesh&, const dictionary&);
111 
112  //- Construct from supplied starting faces
114  (
115  const polyMesh& mesh,
116  const labelList& startFaces,
117  const bool symmetric,
118  const direction dir
119  );
120 
121 
122  // Member Functions
123 
124  // Access
125 
126  //- Sum field per region
127  template<class T>
128  Field<T> regionSum(const Field<T>& cellField) const;
129 
130  //- Collapse a field to a line
131  template<class T>
133  (
134  const Field<T>& vsf,
135  const bool asymmetric=false
136  ) const;
137 
138  //- Return the field of Y locations from the cell centres
139  const scalarField& y() const
140  {
141  return y_;
142  }
143 
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #ifdef NoRepository
154  #include "channelIndexTemplates.C"
155 #endif
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
Foam::Enum< vector::components >
Foam::channelIndex
Does averaging of fields over layers of cells. Assumes layered mesh.
Definition: channelIndex.H:54
scalarField.H
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::channelIndex::collapse
Field< T > collapse(const Field< T > &vsf, const bool asymmetric=false) const
Collapse a field to a line.
channelIndexTemplates.C
Foam::Field< scalar >
regionSplit.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::channelIndex::y
const scalarField & y() const
Return the field of Y locations from the cell centres.
Definition: channelIndex.H:138
direction.H
Direction is an 8-bit unsigned integer type used to represent Cartesian directions,...
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< label >
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::channelIndex::regionSum
Field< T > regionSum(const Field< T > &cellField) const
Sum field per region.