FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::channelIndex
00026 
00027 Description
00028     Does averaging of fields over layers of cells. Assumes layered mesh.
00029 
00030 SourceFiles
00031     channelIndex.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef channelIndex_H
00036 #define channelIndex_H
00037 
00038 #include <meshTools/regionSplit.H>
00039 #include <OpenFOAM/direction.H>
00040 #include <OpenFOAM/scalarField.H>
00041 #include <OpenFOAM/polyMesh.H>
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 
00049 /*---------------------------------------------------------------------------*\
00050                            Class channelIndex Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 class channelIndex
00054 {
00055 
00056     // Private data
00057 
00058         static const NamedEnum<vector::components, 3> vectorComponentsNames_;
00059 
00060         //- Is mesh symmetric
00061         const bool symmetric_;
00062 
00063         //- direction to sort
00064         const direction dir_;
00065 
00066         //- Per cell the global region
00067         autoPtr<regionSplit> cellRegion_;
00068 
00069         //- Per global region the number of cells (scalarField so we can use
00070         //  field algebra)
00071         scalarField regionCount_;
00072 
00073         //- From sorted region back to unsorted global region
00074         labelList sortMap_;
00075 
00076         //- Sorted component of cell centres
00077         scalarField y_;
00078 
00079 
00080 
00081     // Private Member Functions
00082 
00083         void walkOppositeFaces
00084         (
00085             const polyMesh& mesh,
00086             const labelList& startFaces,
00087             boolList& blockedFace
00088         );
00089 
00090         void calcLayeredRegions
00091         (
00092             const polyMesh& mesh,
00093             const labelList& startFaces
00094         );
00095 
00096         //- Disallow default bitwise copy construct and assignment
00097         channelIndex(const channelIndex&);
00098         void operator=(const channelIndex&);
00099 
00100 
00101 public:
00102 
00103     // Constructors
00104 
00105         //- Construct from dictionary
00106         channelIndex(const polyMesh&, const dictionary&);
00107 
00108         //- Construct from supplied starting faces
00109         channelIndex
00110         (
00111             const polyMesh& mesh,
00112             const labelList& startFaces,
00113             const bool symmetric,
00114             const direction dir
00115         );
00116 
00117 
00118     // Member Functions
00119 
00120         // Access
00121 
00122             //- Sum field per region
00123             template<class T>
00124             Field<T> regionSum(const Field<T>& cellField) const;
00125 
00126             //- collapse a field to a line
00127             template<class T>
00128             Field<T> collapse
00129             (
00130                 const Field<T>& vsf,
00131                 const bool asymmetric=false
00132             ) const;
00133 
00134             //- return the field of Y locations from the cell centres
00135             const scalarField& y() const
00136             {
00137                 return y_;
00138             }
00139 
00140 };
00141 
00142 
00143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00144 
00145 } // End namespace Foam
00146 
00147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00148 
00149 #ifdef NoRepository
00150 #   include "channelIndexTemplates.C"
00151 #endif
00152 
00153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00154 
00155 #endif
00156 
00157 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines