GAMGInterfaceTemplates.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "GAMGInterface.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 template<class Type>
35 (
36  const UList<Type>& iF
37 ) const
38 {
39  auto tresult = tmp<Field<Type>>::New(size());
40  interfaceInternalField(iF, tresult.ref());
41  return tresult;
42 }
43 
44 
45 template<class Type>
47 (
48  const UList<Type>& iF,
49  const labelUList& faceCells
50 ) const
51 {
52  auto tresult = tmp<Field<Type>>::New(faceCells.size());
53  auto& result = tresult.ref();
54 
55  forAll(result, elemi)
56  {
57  result[elemi] = iF[faceCells[elemi]];
58  }
59  return tresult;
60 }
61 
62 
63 template<class Type>
65 (
66  const UList<Type>& iF,
67  List<Type>& result
68 ) const
69 {
70  result.resize(size());
71 
72  forAll(result, elemi)
73  {
74  result[elemi] = iF[faceCells_[elemi]];
75  }
76 }
77 
78 
79 // ************************************************************************* //
Foam::List::resize
void resize(const label len)
Adjust allocated size of list.
Definition: ListI.H:139
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
GAMGInterface.H
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::GAMGInterface::interfaceInternalField
tmp< Field< Type > > interfaceInternalField(const UList< Type > &internalData) const
Return the interface internal field of the given field.
Foam::List< Type >
Foam::UList< Type >
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56