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