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/error.H>
00027
00028 #include "liquid.H"
00029 #include <OpenFOAM/HashTable.H>
00030
00031
00032
00033 namespace Foam
00034 {
00035 defineTypeNameAndDebug(liquid, 0);
00036 defineRunTimeSelectionTable(liquid,);
00037 defineRunTimeSelectionTable(liquid, Istream);
00038 }
00039
00040
00041
00042 Foam::autoPtr<Foam::liquid> Foam::liquid::New(Istream& is)
00043 {
00044 if (debug)
00045 {
00046 Info<< "liquid::New(Istream&) : "
00047 << "constructing liquid"
00048 << endl;
00049 }
00050
00051 word liquidType(is);
00052
00053 word coeffs(is);
00054
00055 if (coeffs == "defaultCoeffs")
00056 {
00057 ConstructorTable::iterator cstrIter =
00058 ConstructorTablePtr_->find(liquidType);
00059
00060 if (cstrIter == ConstructorTablePtr_->end())
00061 {
00062 FatalErrorIn("liquid::New(Istream&)")
00063 << "Unknown liquid type " << liquidType
00064 << nl << nl
00065 << "Valid liquid types are:" << nl
00066 << ConstructorTablePtr_->sortedToc()
00067 << abort(FatalError);
00068 }
00069
00070 return autoPtr<liquid>(cstrIter()());
00071 }
00072 else if (coeffs == "coeffs")
00073 {
00074 IstreamConstructorTable::iterator cstrIter =
00075 IstreamConstructorTablePtr_->find(liquidType);
00076
00077 if (cstrIter == IstreamConstructorTablePtr_->end())
00078 {
00079 FatalErrorIn("liquid::New(Istream&)")
00080 << "Unknown liquid type " << liquidType
00081 << endl << endl
00082 << "Valid liquid types are:" << nl
00083 << IstreamConstructorTablePtr_->sortedToc()
00084 << abort(FatalError);
00085 }
00086
00087 return autoPtr<liquid>(cstrIter()(is));
00088 }
00089 else
00090 {
00091 FatalErrorIn("liquid::New(Istream&)")
00092 << "liquid type " << liquidType
00093 << ", option " << coeffs << " given"
00094 << ", should be coeffs or defaultCoeffs"
00095 << abort(FatalError);
00096
00097 return autoPtr<liquid>(NULL);
00098 }
00099 }
00100
00101
00102