OpenFOAM logo
Open Source CFD Toolkit

faPatch.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-2005 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     faPatch
00027 
00028 Description
00029     Finite area patch class.  Used for 2-D non-Euclidian finite area method.
00030 
00031 SourceFiles
00032     faPatch.C
00033     newFaPatch.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef faPatch_H
00038 #define faPatch_H
00039 
00040 #include "patchIdentifier.H"
00041 #include "labelList.H"
00042 #include "pointField.H"
00043 #include "typeInfo.H"
00044 #include "autoPtr.H"
00045 #include "runTimeSelectionTables.H"
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 namespace Foam
00050 {
00051 
00052 class faBoundaryMesh;
00053 
00054 /*---------------------------------------------------------------------------*\
00055                            Class faPatch Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 class faPatch
00059 :
00060     public labelList,
00061     public patchIdentifier
00062 {
00063 private:
00064 
00065     // Private data
00066 
00067         //- Neighbour polyPatch index
00068         const label ngbPolyPatchIndex_;
00069 
00070         //- Reference to boundary mesh
00071         const faBoundaryMesh& boundaryMesh_;
00072 
00073 
00074     // Private Member Functions
00075 
00076         //- Disallow construct as copy
00077         faPatch(const faPatch&);
00078 
00079         //- Disallow assignment
00080         void operator=(const faPatch&);
00081 
00082 protected:
00083 
00084         // The faPatch geometry initialisation is called by faBoundaryMesh
00085         friend class faBoundaryMesh;
00086 
00087         //- Initialise the calculation of the patch geometry
00088         virtual void initGeometry()
00089         {}
00090 
00091         //- Calculate the patch geometry
00092         virtual void calcGeometry()
00093         {}
00094 
00095 
00096 public:
00097 
00098     typedef faBoundaryMesh BoundaryMesh;
00099 
00100 
00101     //- Runtime type information
00102     TypeName("patch");
00103 
00104     // Declare run-time constructor selection tables
00105 
00106         declareRunTimeSelectionTable
00107         (
00108             autoPtr,
00109             faPatch,
00110             dictionary,
00111             (
00112                 const word& name,
00113                 const dictionary& dict,
00114                 const label index,
00115                 const faBoundaryMesh& bm
00116             ),
00117             (name, dict, index, bm)
00118         );
00119 
00120 
00121     // Constructors
00122 
00123         //- Construct from components
00124         faPatch
00125         (
00126             const word& name,
00127             const labelList& edgeLabels,
00128             const label index,
00129             const faBoundaryMesh& bm
00130         );
00131 
00132         //- Construct from dictionary
00133         faPatch
00134         (
00135             const word& name,
00136             const dictionary& dict,
00137             const label index,
00138             const faBoundaryMesh& bm
00139         );
00140 
00141         //- Construct as copy, resetting the boundary mesh
00142         faPatch(const faPatch&, const faBoundaryMesh&);
00143 
00144 
00145     // Selectors
00146 
00147         //- Return a pointer to a new patch created on freestore from dictionary
00148         static autoPtr<faPatch> New
00149         (
00150             const word& name,
00151             const dictionary& dict,
00152             const label index,
00153             const faBoundaryMesh& bm
00154         );
00155 
00156 
00157     // Destructor
00158 
00159         virtual ~faPatch();
00160 
00161 
00162     // Member Functions
00163 
00164         //- Return neighbour polyPatch index
00165         label ngbPolyPatchIndex() const;
00166 
00167         //- Return boundaryMesh reference
00168         const faBoundaryMesh& boundaryMesh() const;
00169 
00170         //- Patch start in edge list
00171         label start() const;
00172 
00173         //- Patch size
00174         virtual label size() const
00175         {
00176             return labelList::size();
00177         }
00178 
00179         //- Slice list to patch
00180         template<class T>
00181         typename List<T>::subList patchSlice(const List<T>& l) const
00182         {
00183             return typename List<T>::subList(l, size(), start());
00184         }
00185 
00186         //- Correct patch after moving points
00187         virtual void movePoints(const pointField&);
00188 
00189         //- Write
00190         virtual void write(Ostream&) const;
00191 
00192         //- Write dictionary
00193         virtual void writeDict(Ostream&) const;
00194 
00195 
00196         // Acces functions for geometrical data
00197 
00198             //- Return patch point labels
00199             labelList pointLabels() const;
00200 
00201             //- Return patch point-edge addressing
00202             labelListList pointEdges() const;
00203 
00204             //- Return edge neighbour polyPatch faces
00205             labelList ngbPolyPatchFaces() const;
00206 
00207             //- Return normals of neighbour polyPatch faces
00208             tmp<vectorField> ngbPolyPatchFaceNormals() const;
00209 
00210             //- Return normals of neighbour polyPatch joined points
00211             tmp<vectorField> ngbPolyPatchPointNormals() const;
00212 
00213             //- Return edge-face addressing
00214             labelList::subList edgeFaces() const;
00215 
00216             //- Return edge centres
00217             const vectorField& edgeCentres() const;
00218 
00219             //- Return edge length vectors
00220             const vectorField& edgeLengths() const;
00221 
00222             //- Return edge length magnitudes
00223             const scalarField& magEdgeLengths() const;
00224 
00225             //- Return edge normals
00226             tmp<vectorField> edgeNormals() const;
00227 
00228             //- Return neighbour face centres
00229             tmp<vectorField> edgeFaceCentres() const;
00230 
00231             //- Return cell-centre to face-centre vector
00232             //  except for coupled patches for which the cell-centre
00233             //  to coupled-cell-centre vector is returned
00234             virtual tmp<vectorField> delta() const;
00235 
00236 
00237         // Access functions for demand driven data
00238 
00239             //- Make patch weighting factors
00240             virtual void makeWeights(scalarField&) const;
00241 
00242             //- Return patch weighting factors
00243             const scalarField& weights() const;
00244 
00245             //- Make patch edge - neighbour face distances
00246             virtual void makeDeltaCoeffs(scalarField&) const;
00247 
00248             //- Return patch edge - neighbour face distances
00249             const scalarField& deltaCoeffs() const;
00250 
00251 
00252     // Ostream Operator
00253 
00254         friend Ostream& operator<<(Ostream&, const faPatch&);
00255 };
00256 
00257 
00258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00259 
00260 } // End namespace Foam
00261 
00262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00263 
00264 #endif
00265 
00266 // ************************************************************************* //
For further information go to www.openfoam.org