Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #include <OpenFOAM/lduMatrix.H>
00027 
00028 
00029 
00030 namespace Foam
00031 {
00032     defineRunTimeSelectionTable(lduMatrix::smoother, symMatrix);
00033     defineRunTimeSelectionTable(lduMatrix::smoother, asymMatrix);
00034 }
00035 
00036 
00037 
00038 Foam::word
00039 Foam::lduMatrix::smoother::getName
00040 (
00041     const dictionary& solverControls
00042 )
00043 {
00044     word name;
00045 
00046     
00047     const entry& e = solverControls.lookupEntry("smoother", false, false);
00048     if (e.isDict())
00049     {
00050         e.dict().lookup("smoother") >> name;
00051     }
00052     else
00053     {
00054         e.stream() >> name;
00055     }
00056 
00057     return name;
00058 }
00059 
00060 
00061 Foam::autoPtr<Foam::lduMatrix::smoother> Foam::lduMatrix::smoother::New
00062 (
00063     const word& fieldName,
00064     const lduMatrix& matrix,
00065     const FieldField<Field, scalar>& interfaceBouCoeffs,
00066     const FieldField<Field, scalar>& interfaceIntCoeffs,
00067     const lduInterfaceFieldPtrsList& interfaces,
00068     const dictionary& solverControls
00069 )
00070 {
00071     word name;
00072 
00073     
00074     const entry& e = solverControls.lookupEntry("smoother", false, false);
00075     if (e.isDict())
00076     {
00077         e.dict().lookup("smoother") >> name;
00078     }
00079     else
00080     {
00081         e.stream() >> name;
00082     }
00083 
00084     
00085     
00086 
00087     if (matrix.symmetric())
00088     {
00089         symMatrixConstructorTable::iterator constructorIter =
00090             symMatrixConstructorTablePtr_->find(name);
00091 
00092         if (constructorIter == symMatrixConstructorTablePtr_->end())
00093         {
00094             FatalIOErrorIn
00095             (
00096                 "lduMatrix::smoother::New", solverControls
00097             )   << "Unknown symmetric matrix smoother "
00098                 << name << nl << nl
00099                 << "Valid symmetric matrix smoothers are :" << endl
00100                 << symMatrixConstructorTablePtr_->sortedToc()
00101                 << exit(FatalIOError);
00102         }
00103 
00104         return autoPtr<lduMatrix::smoother>
00105         (
00106             constructorIter()
00107             (
00108                 fieldName,
00109                 matrix,
00110                 interfaceBouCoeffs,
00111                 interfaceIntCoeffs,
00112                 interfaces
00113             )
00114         );
00115     }
00116     else if (matrix.asymmetric())
00117     {
00118         asymMatrixConstructorTable::iterator constructorIter =
00119             asymMatrixConstructorTablePtr_->find(name);
00120 
00121         if (constructorIter == asymMatrixConstructorTablePtr_->end())
00122         {
00123             FatalIOErrorIn
00124             (
00125                 "lduMatrix::smoother::New", solverControls
00126             )   << "Unknown asymmetric matrix smoother "
00127                 << name << nl << nl
00128                 << "Valid asymmetric matrix smoothers are :" << endl
00129                 << asymMatrixConstructorTablePtr_->sortedToc()
00130                 << exit(FatalIOError);
00131         }
00132 
00133         return autoPtr<lduMatrix::smoother>
00134         (
00135             constructorIter()
00136             (
00137                 fieldName,
00138                 matrix,
00139                 interfaceBouCoeffs,
00140                 interfaceIntCoeffs,
00141                 interfaces
00142             )
00143         );
00144     }
00145     else
00146     {
00147         FatalIOErrorIn
00148         (
00149             "lduMatrix::smoother::New", solverControls
00150         )   << "cannot solve incomplete matrix, "
00151                "no diagonal or off-diagonal coefficient"
00152             << exit(FatalIOError);
00153 
00154         return autoPtr<lduMatrix::smoother>(NULL);
00155     }
00156 }
00157 
00158 
00159 
00160 
00161 Foam::lduMatrix::smoother::smoother
00162 (
00163     const word& fieldName,
00164     const lduMatrix& matrix,
00165     const FieldField<Field, scalar>& interfaceBouCoeffs,
00166     const FieldField<Field, scalar>& interfaceIntCoeffs,
00167     const lduInterfaceFieldPtrsList& interfaces
00168 )
00169 :
00170     fieldName_(fieldName),
00171     matrix_(matrix),
00172     interfaceBouCoeffs_(interfaceBouCoeffs),
00173     interfaceIntCoeffs_(interfaceIntCoeffs),
00174     interfaces_(interfaces)
00175 {}
00176 
00177 
00178