1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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 "extendedFaceToCellStencil.H"
28 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
31 void Foam::extendedFaceToCellStencil::collectData
33 const mapDistribute& map,
34 const labelListList& stencil,
35 const GeometricField<Type, fvsPatchField, surfaceMesh>& fld,
36 List<List<Type> >& stencilFld
39 // 1. Construct face data in compact addressing
40 List<Type> compactFld(map.constructSize(), pTraits<Type>::zero);
42 // Insert my internal values
45 compactFld[cellI] = fld[cellI];
47 // Insert my boundary values
48 label nCompact = fld.size();
49 forAll(fld.boundaryField(), patchI)
51 const fvsPatchField<Type>& pfld = fld.boundaryField()[patchI];
55 compactFld[nCompact++] = pfld[i];
60 map.distribute(compactFld);
63 stencilFld.setSize(stencil.size());
65 forAll(stencil, faceI)
67 const labelList& compactCells = stencil[faceI];
69 stencilFld[faceI].setSize(compactCells.size());
71 forAll(compactCells, i)
73 stencilFld[faceI][i] = compactFld[compactCells[i]];
80 Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
81 Foam::extendedFaceToCellStencil::weightedSum
83 const mapDistribute& map,
84 const labelListList& stencil,
85 const GeometricField<Type, fvsPatchField, surfaceMesh>& fld,
86 const List<List<scalar> >& stencilWeights
89 const fvMesh& mesh = fld.mesh();
91 // Collect internal and boundary values
92 List<List<Type> > stencilFld;
93 collectData(map, stencil, fld, stencilFld);
95 tmp<GeometricField<Type, fvPatchField, volMesh> > tsfCorr
97 new GeometricField<Type, fvPatchField, volMesh>
102 mesh.time().timeName(),
114 GeometricField<Type, fvPatchField, volMesh>& sf = tsfCorr();
119 const List<Type>& stField = stencilFld[cellI];
120 const List<scalar>& stWeight = stencilWeights[cellI];
124 sf[cellI] += stField[i]*stWeight[i];
128 // Boundaries values?
134 // ************************************************************************* //