initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / OpenFOAM / matrices / lduMatrix / lduMatrix / lduMatrixSmoother.C
blob7554e4085c0e83e493b62f80f9f9ef904e8b867a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
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 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
19     for more details.
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 * * * * * * * * * * * * * //
31 namespace Foam
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,
47     Istream& smootherData
50     word smootherName(smootherData);
52     if (matrix.symmetric())
53     {
54         symMatrixConstructorTable::iterator constructorIter =
55             symMatrixConstructorTablePtr_->find(smootherName);
57         if (constructorIter == symMatrixConstructorTablePtr_->end())
58         {
59             FatalIOErrorIn
60             (
61                 "lduMatrix::smoother::New", smootherData
62             )   << "Unknown symmetric matrix smoother " << smootherName
63                 << endl << endl
64                 << "Valid symmetric matrix smoothers are :" << endl
65                 << symMatrixConstructorTablePtr_->toc()
66                 << exit(FatalIOError);
67         }
69         return autoPtr<lduMatrix::smoother>
70         (
71             constructorIter()
72             (
73                 fieldName,
74                 matrix,
75                 interfaceBouCoeffs,
76                 interfaceIntCoeffs,
77                 interfaces
78             )
79         );
80     }
81     else if (matrix.asymmetric())
82     {
83         asymMatrixConstructorTable::iterator constructorIter =
84             asymMatrixConstructorTablePtr_->find(smootherName);
86         if (constructorIter == asymMatrixConstructorTablePtr_->end())
87         {
88             FatalIOErrorIn
89             (
90                 "lduMatrix::smoother::New", smootherData
91             )   << "Unknown asymmetric matrix smoother " << smootherName
92                 << endl << endl
93                 << "Valid asymmetric matrix smoothers are :" << endl
94                 << asymMatrixConstructorTablePtr_->toc()
95                 << exit(FatalIOError);
96         }
98         return autoPtr<lduMatrix::smoother>
99         (
100             constructorIter()
101             (
102                 fieldName,
103                 matrix,
104                 interfaceBouCoeffs,
105                 interfaceIntCoeffs,
106                 interfaces
107             )
108         );
109     }
110     else
111     {
112         FatalIOErrorIn
113         (
114             "lduMatrix::smoother::New", smootherData
115         )   << "cannot solve incomplete matrix, no off-diagonal coefficients"
116             << exit(FatalIOError);
118         return autoPtr<lduMatrix::smoother>(NULL);
119     }
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),
135     matrix_(matrix),
136     interfaceBouCoeffs_(interfaceBouCoeffs),
137     interfaceIntCoeffs_(interfaceIntCoeffs),
138     interfaces_(interfaces)
142 // ************************************************************************* //