OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

channelIndex.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::channelIndex
00027 
00028 Description
00029     Does averaging of fields over layers of cells. Assumes layered mesh.
00030 
00031 SourceFiles
00032     channelIndex.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef channelIndex_H
00037 #define channelIndex_H
00038 
00039 #include "regionSplit.H"
00040 #include "direction.H"
00041 #include "scalarField.H"
00042 #include "polyMesh.H"
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 
00050 /*---------------------------------------------------------------------------*\
00051                            Class channelIndex Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 class channelIndex
00055 {
00056 
00057     // Private data
00058 
00059         static const NamedEnum<vector::components, 3> vectorComponentsNames_;
00060 
00061         //- Is mesh symmetric
00062         const bool symmetric_;
00063 
00064         //- direction to sort
00065         const direction dir_;
00066 
00067         //- Per cell the global region
00068         autoPtr<regionSplit> cellRegion_;
00069 
00070         //- Per global region the number of cells (scalarField so we can use
00071         //  field algebra)
00072         scalarField regionCount_;
00073 
00074         //- From sorted region back to unsorted global region
00075         labelList sortMap_;
00076 
00077         //- Sorted component of cell centres
00078         scalarField y_;
00079 
00080 
00081 
00082     // Private Member Functions
00083 
00084         void walkOppositeFaces
00085         (
00086             const polyMesh& mesh,
00087             const labelList& startFaces,
00088             boolList& blockedFace
00089         );
00090 
00091         void calcLayeredRegions
00092         (
00093             const polyMesh& mesh,
00094             const labelList& startFaces
00095         );
00096 
00097         //- Disallow default bitwise copy construct and assignment
00098         channelIndex(const channelIndex&);
00099         void operator=(const channelIndex&);
00100 
00101 
00102 public:
00103 
00104     // Constructors
00105 
00106         //- Construct from dictionary
00107         channelIndex(const polyMesh&, const dictionary&);
00108 
00109         //- Construct from supplied starting faces
00110         channelIndex
00111         (
00112             const polyMesh& mesh,
00113             const labelList& startFaces,
00114             const bool symmetric,
00115             const direction dir
00116         );
00117 
00118 
00119     // Member Functions
00120 
00121         // Access
00122 
00123             //- Sum field per region
00124             template<class T>
00125             Field<T> regionSum(const Field<T>& cellField) const;
00126 
00127             //- collapse a field to a line
00128             template<class T>
00129             Field<T> collapse
00130             (
00131                 const Field<T>& vsf,
00132                 const bool asymmetric=false
00133             ) const;
00134 
00135             //- return the field of Y locations from the cell centres
00136             const scalarField& y() const
00137             {
00138                 return y_;
00139             }
00140 
00141 };
00142 
00143 
00144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00145 
00146 } // End namespace Foam
00147 
00148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00149 
00150 #ifdef NoRepository
00151 #   include "channelIndexTemplates.C"
00152 #endif
00153 
00154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00155 
00156 #endif
00157 
00158 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd