tolerances.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 "tolerances.H"
00028
00029
00030
00031 namespace Foam
00032 {
00033
00034
00035
00036 tolerances::tolerances(const Time& t, const fileName& dictName)
00037 :
00038 IOdictionary
00039 (
00040 IOobject
00041 (
00042 dictName,
00043 t.system(),
00044 t,
00045 IOobject::MUST_READ,
00046 IOobject::NO_WRITE
00047 )
00048 ),
00049 relaxationFactors_(ITstream("relaxationFactors", tokenList())()),
00050 solverTolerances_(ITstream("solverTolerances", tokenList())()),
00051 solverRelativeTolerances_
00052 (
00053 ITstream("solverRelativeTolerances", tokenList())()
00054 )
00055 {
00056 read();
00057 }
00058
00059
00060
00061
00062 bool tolerances::read()
00063 {
00064 if (regIOobject::read())
00065 {
00066 word toleranceSetName(lookup("toleranceSet"));
00067 const dictionary& toleranceSet(subDict(toleranceSetName));
00068
00069 if (toleranceSet.found("relaxationFactors"))
00070 {
00071 relaxationFactors_ = toleranceSet.subDict("relaxationFactors");
00072 }
00073
00074 if (toleranceSet.found("solverTolerances"))
00075 {
00076 solverTolerances_ = toleranceSet.subDict("solverTolerances");
00077 }
00078
00079 if (toleranceSet.found("solverRelativeTolerances"))
00080 {
00081 solverRelativeTolerances_ =
00082 toleranceSet.subDict("solverRelativeTolerances");
00083 }
00084
00085 return true;
00086 }
00087 else
00088 {
00089 return false;
00090 }
00091 }
00092
00093
00094 bool tolerances::relax(const word& name) const
00095 {
00096 return relaxationFactors_.found(name);
00097 }
00098
00099 scalar tolerances::relaxationFactor(const word& name) const
00100 {
00101 return readScalar(relaxationFactors_.lookup(name));
00102 }
00103
00104 scalar tolerances::solverTolerance(const word& name) const
00105 {
00106 return readScalar(solverTolerances_.lookup(name));
00107 }
00108
00109 bool tolerances::solverRelativeTolerances() const
00110 {
00111 return solverRelativeTolerances_.size();
00112 }
00113
00114 scalar tolerances::solverRelativeTolerance(const word& name) const
00115 {
00116 return readScalar(solverRelativeTolerances_.lookup(name));
00117 }
00118
00119
00120
00121
00122 }
00123
00124
Copyright © 2000-2009 OpenCFD Ltd