OpenFOAM logo
Open Source CFD Toolkit

fvPatch.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     fvPatch
00027 
00028 Description
00029 
00030 SourceFiles
00031     fvPatch.C
00032     newFvPatch.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef fvPatch_H
00037 #define fvPatch_H
00038 
00039 #include "polyPatch.H"
00040 #include "labelList.H"
00041 #include "SubList.H"
00042 #include "typeInfo.H"
00043 #include "tmp.H"
00044 #include "primitiveFields.H"
00045 #include "SubField.H"
00046 #include "fvPatchFieldsFwd.H"
00047 #include "autoPtr.H"
00048 #include "runTimeSelectionTables.H"
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace Foam
00053 {
00054 
00055 class fvBoundaryMesh;
00056 class surfaceInterpolation;
00057 
00058 /*---------------------------------------------------------------------------*\
00059                            Class fvPatch Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class fvPatch
00063 {
00064     // Private data
00065 
00066         //- Reference to the underlying polyPatch
00067         const polyPatch& polyPatch_;
00068 
00069         //- Reference to boundary mesh
00070         const fvBoundaryMesh& boundaryMesh_;
00071 
00072 
00073     // Private Member Functions
00074 
00075         //- Disallow construct as copy
00076         fvPatch(const fvPatch&);
00077 
00078         //- Disallow assignment
00079         void operator=(const fvPatch&);
00080 
00081 
00082 protected:
00083 
00084     // Protected Member Functions
00085 
00086         //- Make patch weighting factors
00087         virtual void makeWeights(scalarField&) const;
00088 
00089         //- Make patch face - neighbour cell distances
00090         virtual void makeDeltaCoeffs(scalarField&) const;
00091 
00092         //- Initialise the patches for moving points
00093         virtual void initMovePoints();
00094 
00095         //- Correct patches after moving points
00096         virtual void movePoints();
00097 
00098 
00099 public:
00100 
00101     typedef fvBoundaryMesh BoundaryMesh;
00102 
00103     friend class fvBoundaryMesh;
00104     friend class surfaceInterpolation;
00105 
00106     //- Runtime type information
00107     TypeName(polyPatch::typeName_());
00108 
00109 
00110     // Declare run-time constructor selection tables
00111 
00112         declareRunTimeSelectionTable
00113         (
00114             autoPtr,
00115             fvPatch,
00116             polyPatch,
00117             (const polyPatch& patch, const fvBoundaryMesh& bm),
00118             (patch, bm)
00119         );
00120 
00121 
00122     // Constructors
00123 
00124         //- Construct from polyPatch
00125         fvPatch(const polyPatch&, const fvBoundaryMesh&);
00126 
00127 
00128     // Selectors
00129 
00130         //- Return a pointer to a new patch created on freestore from polyPatch
00131         static autoPtr<fvPatch> New(const polyPatch&, const fvBoundaryMesh&);
00132 
00133 
00134     // Destructor
00135 
00136         virtual ~fvPatch();
00137 
00138 
00139     // Member Functions
00140 
00141         //- Return the polyPatch
00142         const polyPatch& patch() const
00143         {
00144             return polyPatch_;
00145         }
00146 
00147         //- Return name
00148         const word& name() const
00149         {
00150             return polyPatch_.name();
00151         }
00152 
00153         //- Return size
00154         virtual label size() const
00155         {
00156             return polyPatch_.size();
00157         }
00158 
00159         //- Return true if this patch is coupled
00160         bool coupled() const
00161         {
00162             return polyPatch_.coupled();
00163         }
00164 
00165         //- Return true if the given type is a constraint type
00166         static bool constraintType(const word& pt);
00167 
00168         //- Return a list of all the constraint patch types
00169         static wordList constraintTypes();
00170 
00171         //- Return the index of this patch in the fvBoundaryMesh
00172         label index() const
00173         {
00174             return polyPatch_.index();
00175         }
00176 
00177         //- Return boundaryMesh reference
00178         const fvBoundaryMesh& boundaryMesh() const
00179         {
00180             return boundaryMesh_;
00181         }
00182 
00183         //- Slice list to patch
00184         template<class T>
00185         const typename List<T>::subList patchSlice(const List<T>& l) const
00186         {
00187             return typename List<T>::subList(l, size(), polyPatch_.start());
00188         }
00189 
00190 
00191         // Access functions for geometrical data
00192 
00193             //- Return faceCells
00194             const labelList::subList faceCells() const;
00195 
00196             //- Return face centres
00197             const vectorField::subField Cf() const;
00198 
00199             //- Return neighbour cell centres
00200             tmp<vectorField> Cn() const;
00201 
00202             //- Return face normals
00203             //  Virtual because of re-use of primitive patch data
00204             //  (see emptyFvPatch)
00205             virtual const vectorField& nf() const;
00206 
00207 
00208             //- Return face area vectors
00209             const vectorField::subField Sf() const;
00210 
00211             //- Return face area magnitudes
00212             const scalarField& magSf() const;
00213 
00214             //- Return cell-centre to face-centre vector
00215             //  except for coupled patches for which the cell-centre
00216             //  to coupled-cell-centre vector is returned
00217             virtual tmp<vectorField> delta() const;
00218 
00219 
00220         // Access functions for demand driven data
00221 
00222             //- Return patch weighting factors
00223             const scalarField& weights() const;
00224 
00225             //- Return the face - cell distance coeffient
00226             //  except for coupled patches for which the cell-centre
00227             //  to coupled-cell-centre distance coeffient is returned
00228             const scalarField& deltaCoeffs() const;
00229 };
00230 
00231 
00232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00233 
00234 } // End namespace Foam
00235 
00236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00237 
00238 #endif
00239 
00240 // ************************************************************************* //
For further information go to www.openfoam.org