1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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);
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 Foam::lduMatrix::smoother::getName
42 const dictionary& solverControls
47 // handle primitive or dictionary entry
48 const entry& e = solverControls.lookupEntry("smoother", false, false);
51 e.dict().lookup("smoother") >> name;
62 Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
64 const word& fieldName,
65 const lduMatrix& matrix,
66 const FieldField<Field, scalar>& interfaceBouCoeffs,
67 const FieldField<Field, scalar>& interfaceIntCoeffs,
68 const lduInterfaceFieldPtrsList& interfaces,
69 const dictionary& solverControls
74 // handle primitive or dictionary entry
75 const entry& e = solverControls.lookupEntry("smoother", false, false);
78 e.dict().lookup("smoother") >> name;
86 // const dictionary& controls = e.isDict() ? e.dict() : dictionary::null;
88 if (matrix.symmetric())
90 symMatrixConstructorTable::iterator constructorIter =
91 symMatrixConstructorTablePtr_->find(name);
93 if (constructorIter == symMatrixConstructorTablePtr_->end())
97 "lduMatrix::smoother::New", solverControls
98 ) << "Unknown symmetric matrix smoother "
100 << "Valid symmetric matrix smoothers are :" << endl
101 << symMatrixConstructorTablePtr_->toc()
102 << exit(FatalIOError);
105 return autoPtr<lduMatrix::smoother>
117 else if (matrix.asymmetric())
119 asymMatrixConstructorTable::iterator constructorIter =
120 asymMatrixConstructorTablePtr_->find(name);
122 if (constructorIter == asymMatrixConstructorTablePtr_->end())
126 "lduMatrix::smoother::New", solverControls
127 ) << "Unknown asymmetric matrix smoother "
129 << "Valid asymmetric matrix smoothers are :" << endl
130 << asymMatrixConstructorTablePtr_->toc()
131 << exit(FatalIOError);
134 return autoPtr<lduMatrix::smoother>
150 "lduMatrix::smoother::New", solverControls
151 ) << "cannot solve incomplete matrix, "
152 "no diagonal or off-diagonal coefficient"
153 << exit(FatalIOError);
155 return autoPtr<lduMatrix::smoother>(NULL);
160 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
162 Foam::lduMatrix::smoother::smoother
164 const word& fieldName,
165 const lduMatrix& matrix,
166 const FieldField<Field, scalar>& interfaceBouCoeffs,
167 const FieldField<Field, scalar>& interfaceIntCoeffs,
168 const lduInterfaceFieldPtrsList& interfaces
171 fieldName_(fieldName),
173 interfaceBouCoeffs_(interfaceBouCoeffs),
174 interfaceIntCoeffs_(interfaceIntCoeffs),
175 interfaces_(interfaces)
179 // ************************************************************************* //