1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "singleCellFvMesh.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37 tmp<GeometricField<Type, fvPatchField, volMesh> > singleCellFvMesh::interpolate
39 const GeometricField<Type, fvPatchField, volMesh>& vf
42 // Create internal-field values
43 Field<Type> internalField(1, gAverage(vf));
45 // Create and map the patch field values
46 PtrList<fvPatchField<Type> > patchFields(vf.boundaryField().size());
50 forAll(vf.boundaryField(), patchI)
52 const labelList& agglom = patchFaceAgglomeration_[patchI];
53 label nAgglom = max(agglom) + 1;
55 // Use inverse of agglomeration. This is from agglomeration to
56 // original (fine) mesh patch face.
57 labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
58 inplaceReorder(patchFaceMap_[patchI], coarseToFine);
59 scalarListList coarseWeights(nAgglom);
60 forAll(coarseToFine, coarseI)
62 const labelList& fineFaces = coarseToFine[coarseI];
63 coarseWeights[coarseI] = scalarList
73 fvPatchField<Type>::New
75 vf.boundaryField()[patchI],
77 DimensionedField<Type, volMesh>::null(),
78 agglomPatchFieldMapper(coarseToFine, coarseWeights, agglom.size())
85 forAll(vf.boundaryField(), patchI)
87 labelList map(identity(vf.boundaryField()[patchI].size()));
92 fvPatchField<Type>::New
94 vf.boundaryField()[patchI],
96 DimensionedField<Type, volMesh>::null(),
97 directPatchFieldMapper(map, map.size())
103 // Create the complete field from the pieces
104 tmp<GeometricField<Type, fvPatchField, volMesh> > tresF
106 new GeometricField<Type, fvPatchField, volMesh>
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 } // End namespace Foam
131 // ************************************************************************* //