1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-6 H. Jasak All rights reserved
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 "BlockLduPrecon.H"
28 #include "blockNoPrecons.H"
33 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
36 Foam::autoPtr<Foam::BlockLduPrecon<Type> > Foam::BlockLduPrecon<Type>::New
38 const BlockLduMatrix<Type>& matrix,
39 const dictionary& dict
44 // handle primitive or dictionary entry
45 const entry& e = dict.lookupEntry("preconditioner", false, false);
48 e.dict().lookup("preconditioner") >> preconName;
52 e.stream() >> preconName;
55 const dictionary& controls = e.isDict() ? e.dict() : dictionary::null;
57 if (matrix.diagonal())
59 // No preconditioning for the diagonal matrix
60 return autoPtr<BlockLduPrecon<Type> >
62 new BlockNoPrecon<Type>
71 typename dictionaryConstructorTable::iterator constructorIter =
72 dictionaryConstructorTablePtr_->find(preconName);
74 if (constructorIter == dictionaryConstructorTablePtr_->end())
78 "autoPtr<BlockLduPrecon> BlockLduPrecon::New\n"
80 " const BlockLduMatrix<Type>& matrix,\n"
81 " const dictionary& dict\n"
84 ) << "Unknown matrix preconditioner " << preconName
86 << "Valid matrix preconditioners are :" << endl
87 << dictionaryConstructorTablePtr_->toc()
88 << exit(FatalIOError);
91 return autoPtr<BlockLduPrecon<Type> >
103 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 Foam::word Foam::BlockLduPrecon<Type>::getName(const dictionary& dict)
110 // handle primitive or dictionary entry
111 const entry& e = dict.lookupEntry("preconditioner", false, false);
114 e.dict().lookup("preconditioner") >> name;
125 // ************************************************************************* //