00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 2011-2011 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 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your 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, see <http://www.gnu.org/licenses/>. 00023 00024 \*---------------------------------------------------------------------------*/ 00025 00026 #include "interpolationCellPatchConstrained.H" 00027 #include <finiteVolume/volFields.H> 00028 00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00030 00031 namespace Foam 00032 { 00033 00034 // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // 00035 00036 template<class Type> 00037 interpolationCellPatchConstrained<Type>::interpolationCellPatchConstrained 00038 ( 00039 const GeometricField<Type, fvPatchField, volMesh>& psi 00040 ) 00041 : 00042 interpolation<Type>(psi) 00043 {} 00044 00045 00046 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00047 00048 template<class Type> 00049 Type interpolationCellPatchConstrained<Type>::interpolate 00050 ( 00051 const vector& pt, 00052 const label cellI, 00053 const label faceI 00054 ) const 00055 { 00056 if (faceI >= 0 && faceI >= this->psi_.mesh().nInternalFaces()) 00057 { 00058 // Use boundary value 00059 const polyBoundaryMesh& pbm = this->psi_.mesh().boundaryMesh(); 00060 label patchI = pbm.whichPatch(faceI); 00061 label patchFaceI = pbm[patchI].whichFace(faceI); 00062 00063 return this->psi_.boundaryField()[patchI][patchFaceI]; 00064 } 00065 else 00066 { 00067 return this->psi_[cellI]; 00068 } 00069 } 00070 00071 00072 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00073 00074 } // End namespace Foam 00075 00076 // ************************ vim: set sw=4 sts=4 et: ************************ //