BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / finiteVolume / fvMesh / fvPatches / fvPatch / fvPatch.C
blobf9d1b8aca70042ad542626da8ce84168231816d1
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "fvPatch.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "fvBoundaryMesh.H"
29 #include "fvMesh.H"
30 #include "primitiveMesh.H"
31 #include "volFields.H"
32 #include "surfaceFields.H"
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 namespace Foam
38     defineTypeNameAndDebug(fvPatch, 0);
39     defineRunTimeSelectionTable(fvPatch, polyPatch);
40     addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch);
43 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
45 Foam::fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm)
47     polyPatch_(p),
48     boundaryMesh_(bm)
52 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
54 Foam::fvPatch::~fvPatch()
58 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
60 bool Foam::fvPatch::constraintType(const word& pt)
62     return fvPatchField<scalar>::patchConstructorTablePtr_->found(pt);
66 Foam::wordList Foam::fvPatch::constraintTypes()
68     wordList cTypes(polyPatchConstructorTablePtr_->size());
70     label i = 0;
72     for
73     (
74         polyPatchConstructorTable::iterator cstrIter =
75             polyPatchConstructorTablePtr_->begin();
76         cstrIter != polyPatchConstructorTablePtr_->end();
77         ++cstrIter
78     )
79     {
80         if (constraintType(cstrIter.key()))
81         {
82             cTypes[i++] = cstrIter.key();
83         }
84     }
86     cTypes.setSize(i);
88     return cTypes;
92 const Foam::labelUList& Foam::fvPatch::faceCells() const
94     return polyPatch_.faceCells();
98 const Foam::vectorField& Foam::fvPatch::Cf() const
100     return boundaryMesh().mesh().Cf().boundaryField()[index()];
104 Foam::tmp<Foam::vectorField> Foam::fvPatch::Cn() const
106     tmp<vectorField> tcc(new vectorField(size()));
107     vectorField& cc = tcc();
109     const labelUList& faceCells = this->faceCells();
111     // get reference to global cell centres
112     const vectorField& gcc = boundaryMesh().mesh().cellCentres();
114     forAll(faceCells, faceI)
115     {
116         cc[faceI] = gcc[faceCells[faceI]];
117     }
119     return tcc;
123 Foam::tmp<Foam::vectorField> Foam::fvPatch::nf() const
125     return Sf()/magSf();
129 const Foam::vectorField& Foam::fvPatch::Sf() const
131     return boundaryMesh().mesh().Sf().boundaryField()[index()];
135 const Foam::scalarField& Foam::fvPatch::magSf() const
137     return boundaryMesh().mesh().magSf().boundaryField()[index()];
141 Foam::tmp<Foam::vectorField> Foam::fvPatch::delta() const
143     return Cf() - Cn();
147 void Foam::fvPatch::makeWeights(scalarField& w) const
149     w = 1.0;
153 void Foam::fvPatch::makeDeltaCoeffs(scalarField& dc) const
155     dc = 1.0/(nf() & delta());
159 void Foam::fvPatch::initMovePoints()
163 void Foam::fvPatch::movePoints()
167 const Foam::scalarField& Foam::fvPatch::deltaCoeffs() const
169     return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()];
173 const Foam::scalarField& Foam::fvPatch::weights() const
175     return boundaryMesh().mesh().weights().boundaryField()[index()];
179 // ************************************************************************* //