ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / OpenFOAM / matrices / lduMatrix / solvers / GAMG / interfaceFields / processorGAMGInterfaceField / processorGAMGInterfaceField.C
blob3b6d1ee026590ef420f99f54137dfe5ff47a4b0f
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 "processorGAMGInterfaceField.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "lduMatrix.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 namespace Foam
34     defineTypeNameAndDebug(processorGAMGInterfaceField, 0);
35     addToRunTimeSelectionTable
36     (
37         GAMGInterfaceField,
38         processorGAMGInterfaceField,
39         lduInterface
40     );
44 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
46 Foam::processorGAMGInterfaceField::processorGAMGInterfaceField
48     const GAMGInterface& GAMGCp,
49     const lduInterfaceField& fineInterface
52     GAMGInterfaceField(GAMGCp, fineInterface),
53     procInterface_(refCast<const processorGAMGInterface>(GAMGCp)),
54     doTransform_(false),
55     rank_(0)
57     const processorLduInterfaceField& p =
58         refCast<const processorLduInterfaceField>(fineInterface);
60     doTransform_ = p.doTransform();
61     rank_ = p.rank();
65 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
67 Foam::processorGAMGInterfaceField::~processorGAMGInterfaceField()
71 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
73 void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
75     const scalarField& psiInternal,
76     scalarField&,
77     const lduMatrix&,
78     const scalarField&,
79     const direction,
80     const Pstream::commsTypes commsType
81 ) const
83     procInterface_.compressedSend
84     (
85         commsType,
86         procInterface_.interfaceInternalField(psiInternal)()
87     );
91 void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
93     const scalarField&,
94     scalarField& result,
95     const lduMatrix&,
96     const scalarField& coeffs,
97     const direction cmpt,
98     const Pstream::commsTypes commsType
99 ) const
101     scalarField pnf
102     (
103         procInterface_.compressedReceive<scalar>(commsType, coeffs.size())
104     );
105     transformCoupleField(pnf, cmpt);
107     const labelUList& faceCells = procInterface_.faceCells();
109     forAll(faceCells, elemI)
110     {
111         result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
112     }
116 // ************************************************************************* //