initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / postProcessing / miscellaneous / postChannel / channelIndex.H
blob55c88f0ded3079cc47a11895cc87340497f566a1
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::channelIndex
28 Description
29     Does averaging of fields over layers of cells. Assumes layered mesh.
31 SourceFiles
32     channelIndex.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef channelIndex_H
37 #define channelIndex_H
39 #include "regionSplit.H"
40 #include "direction.H"
41 #include "scalarField.H"
42 #include "polyMesh.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
50 /*---------------------------------------------------------------------------*\
51                            Class channelIndex Declaration
52 \*---------------------------------------------------------------------------*/
54 class channelIndex
57     // Private data
59         static const NamedEnum<vector::components, 3> vectorComponentsNames_;
61         //- Is mesh symmetric
62         const bool symmetric_;
64         //- direction to sort
65         const direction dir_;
67         //- Per cell the global region
68         autoPtr<regionSplit> cellRegion_;
70         //- Per global region the number of cells (scalarField so we can use
71         //  field algebra)
72         scalarField regionCount_;
74         //- From sorted region back to unsorted global region
75         labelList sortMap_;
77         //- Sorted component of cell centres
78         scalarField y_;
82     // Private Member Functions
84         void walkOppositeFaces
85         (
86             const polyMesh& mesh,
87             const labelList& startFaces,
88             boolList& blockedFace
89         );
91         void calcLayeredRegions
92         (
93             const polyMesh& mesh,
94             const labelList& startFaces
95         );
97         //- Disallow default bitwise copy construct and assignment
98         channelIndex(const channelIndex&);
99         void operator=(const channelIndex&);
102 public:
104     // Constructors
106         //- Construct from dictionary
107         channelIndex(const polyMesh&, const dictionary&);
109         //- Construct from supplied starting faces
110         channelIndex
111         (
112             const polyMesh& mesh,
113             const labelList& startFaces,
114             const bool symmetric,
115             const direction dir
116         );
119     // Member Functions
121         // Access
123             //- Sum field per region
124             template<class T>
125             Field<T> regionSum(const Field<T>& cellField) const;
127             //- collapse a field to a line
128             template<class T>
129             Field<T> collapse
130             (
131                 const Field<T>& vsf,
132                 const bool asymmetric=false
133             ) const;
135             //- return the field of Y locations from the cell centres
136             const scalarField& y() const
137             {
138                 return y_;
139             }
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 } // End namespace Foam
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 #ifdef NoRepository
151 #   include "channelIndexTemplates.C"
152 #endif
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 #endif
158 // ************************************************************************* //