interpolationCellPatchConstrained.C
Go to the documentation of this file.
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.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "volFields.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34 // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
35 
36 template<class Type>
38 (
40 )
41 :
43 {}
44 
45 
46 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
47 
48 template<class Type>
50 (
51  const vector& pt,
52  const label cellI,
53  const label faceI
54 ) const
55 {
56  if (faceI >= 0 && faceI >= this->psi_.mesh().nInternalFaces())
57  {
58  // Use boundary value
59  const polyBoundaryMesh& pbm = this->psi_.mesh().boundaryMesh();
60  label patchI = pbm.patchID()[faceI-this->psi_.mesh().nInternalFaces()];
61  label patchFaceI = pbm[patchI].whichFace(faceI);
62 
63  return this->psi_.boundaryField()[patchI][patchFaceI];
64  }
65  else
66  {
67  return this->psi_[cellI];
68  }
69 }
70 
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 } // End namespace Foam
75 
76 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Abstract base class for interpolation.
Namespace for OpenFOAM.
Type interpolate(const vector &position, const label cellI, const label faceI=-1) const
Interpolate field to the given point in the given cell.
Foam::polyBoundaryMesh.
const volScalarField & psi
Definition: createFields.H:24
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:421
const labelList & patchID() const
Per boundary face label the patch index.
Generic GeometricField class.
const polyMesh & mesh() const
Return the mesh reference.
interpolationCellPatchConstrained(const GeometricField< Type, fvPatchField, volMesh > &psi)
Construct from components.