1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "lduMatrix.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 defineRunTimeSelectionTable(lduMatrix::smoother, symMatrix);
34 defineRunTimeSelectionTable(lduMatrix::smoother, asymMatrix);
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
42 const word& fieldName,
43 const lduMatrix& matrix,
44 const FieldField<Field, scalar>& interfaceBouCoeffs,
45 const FieldField<Field, scalar>& interfaceIntCoeffs,
46 const lduInterfaceFieldPtrsList& interfaces,
50 word smootherName(smootherData);
52 if (matrix.symmetric())
54 symMatrixConstructorTable::iterator constructorIter =
55 symMatrixConstructorTablePtr_->find(smootherName);
57 if (constructorIter == symMatrixConstructorTablePtr_->end())
61 "lduMatrix::smoother::New", smootherData
62 ) << "Unknown symmetric matrix smoother " << smootherName
64 << "Valid symmetric matrix smoothers are :" << endl
65 << symMatrixConstructorTablePtr_->toc()
66 << exit(FatalIOError);
69 return autoPtr<lduMatrix::smoother>
81 else if (matrix.asymmetric())
83 asymMatrixConstructorTable::iterator constructorIter =
84 asymMatrixConstructorTablePtr_->find(smootherName);
86 if (constructorIter == asymMatrixConstructorTablePtr_->end())
90 "lduMatrix::smoother::New", smootherData
91 ) << "Unknown asymmetric matrix smoother " << smootherName
93 << "Valid asymmetric matrix smoothers are :" << endl
94 << asymMatrixConstructorTablePtr_->toc()
95 << exit(FatalIOError);
98 return autoPtr<lduMatrix::smoother>
114 "lduMatrix::smoother::New", smootherData
115 ) << "cannot solve incomplete matrix, no off-diagonal coefficients"
116 << exit(FatalIOError);
118 return autoPtr<lduMatrix::smoother>(NULL);
123 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
125 Foam::lduMatrix::smoother::smoother
127 const word& fieldName,
128 const lduMatrix& matrix,
129 const FieldField<Field, scalar>& interfaceBouCoeffs,
130 const FieldField<Field, scalar>& interfaceIntCoeffs,
131 const lduInterfaceFieldPtrsList& interfaces
134 fieldName_(fieldName),
136 interfaceBouCoeffs_(interfaceBouCoeffs),
137 interfaceIntCoeffs_(interfaceIntCoeffs),
138 interfaces_(interfaces)
142 // ************************************************************************* //