FreeFOAM The Cross-Platform CFD Toolkit
processorGAMGInterfaceField.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) 1991-2010 OpenCFD Ltd.
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 
28 #include <OpenFOAM/lduMatrix.H>
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(processorGAMGInterfaceField, 0);
36  (
37  GAMGInterfaceField,
38  processorGAMGInterfaceField,
39  lduInterface
40  );
41 }
42 
43 
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45 
46 Foam::processorGAMGInterfaceField::processorGAMGInterfaceField
47 (
48  const GAMGInterface& GAMGCp,
49  const lduInterfaceField& fineInterface
50 )
51 :
52  GAMGInterfaceField(GAMGCp, fineInterface),
53  procInterface_(refCast<const processorGAMGInterface>(GAMGCp)),
54  doTransform_(false),
55  rank_(0)
56 {
58  refCast<const processorLduInterfaceField>(fineInterface);
59 
60  doTransform_ = p.doTransform();
61  rank_ = p.rank();
62 }
63 
64 
65 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
66 
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 
74 (
75  const scalarField& psiInternal,
76  scalarField&,
77  const lduMatrix&,
78  const scalarField&,
79  const direction,
80  const Pstream::commsTypes commsType
81 ) const
82 {
83  procInterface_.compressedSend
84  (
85  commsType,
86  procInterface_.interfaceInternalField(psiInternal)()
87  );
88 }
89 
90 
92 (
93  const scalarField&,
94  scalarField& result,
95  const lduMatrix&,
96  const scalarField& coeffs,
97  const direction cmpt,
98  const Pstream::commsTypes commsType
99 ) const
100 {
101  scalarField pnf
102  (
103  procInterface_.compressedReceive<scalar>(commsType, coeffs.size())
104  );
105  transformCoupleField(pnf, cmpt);
106 
107  const unallocLabelList& faceCells = procInterface_.faceCells();
108 
109  forAll(faceCells, elemI)
110  {
111  result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
112  }
113 }
114 
115 
116 // ************************ vim: set sw=4 sts=4 et: ************************ //