initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fvMesh / fvPatches / fvPatch / fvPatch.C
blob16092974d38e236e944549dba30941b655601f6a
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 \*---------------------------------------------------------------------------*/
27 #include "fvPatch.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvBoundaryMesh.H"
30 #include "fvMesh.H"
31 #include "primitiveMesh.H"
32 #include "volFields.H"
33 #include "surfaceFields.H"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 namespace Foam
40 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 defineTypeNameAndDebug(fvPatch, 0);
43 defineRunTimeSelectionTable(fvPatch, polyPatch);
44 addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch);
47 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
49 fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm)
51     polyPatch_(p),
52     boundaryMesh_(bm)
56 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
58 fvPatch::~fvPatch()
62 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
64 bool fvPatch::constraintType(const word& pt)
66     return fvPatchField<scalar>::patchConstructorTablePtr_->found(pt);
70 wordList fvPatch::constraintTypes()
72     wordList cTypes(polyPatchConstructorTablePtr_->size());
74     label i = 0;
76     for
77     (
78         polyPatchConstructorTable::iterator cstrIter =
79             polyPatchConstructorTablePtr_->begin();
80         cstrIter != polyPatchConstructorTablePtr_->end();
81         ++cstrIter
82     )
83     {
84         if (constraintType(cstrIter.key()))
85         {
86             cTypes[i++] = cstrIter.key();
87         }
88     }
90     cTypes.setSize(i);
92     return cTypes;
96 const unallocLabelList& fvPatch::faceCells() const
98     return polyPatch_.faceCells();
102 const vectorField& fvPatch::Cf() const
104     return boundaryMesh().mesh().Cf().boundaryField()[index()];
108 tmp<vectorField> fvPatch::Cn() const
110     tmp<vectorField> tcc(new vectorField(size()));
111     vectorField& cc = tcc();
113     const unallocLabelList& faceCells = this->faceCells();
115     // get reference to global cell centres
116     const vectorField& gcc = boundaryMesh().mesh().cellCentres();
118     forAll (faceCells, faceI)
119     {
120         cc[faceI] = gcc[faceCells[faceI]];
121     }
123     return tcc;
127 tmp<vectorField> fvPatch::nf() const
129     return Sf()/magSf();
133 const vectorField& fvPatch::Sf() const
135     return boundaryMesh().mesh().Sf().boundaryField()[index()];
139 const scalarField& fvPatch::magSf() const
141     return boundaryMesh().mesh().magSf().boundaryField()[index()];
145 tmp<vectorField> fvPatch::delta() const
147     return Cf() - Cn();
151 void fvPatch::makeWeights(scalarField& w) const
153     w = 1.0;
157 void fvPatch::makeDeltaCoeffs(scalarField& dc) const
159     dc = 1.0/(nf() & delta());
163 void fvPatch::initMovePoints()
167 void fvPatch::movePoints()
171 const scalarField& fvPatch::deltaCoeffs() const
173     return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()];
177 const scalarField& fvPatch::weights() const
179     return boundaryMesh().mesh().weights().boundaryField()[index()];
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
187 // ************************************************************************* //