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 "polyPatch.H"
00027 #include <OpenFOAM/dictionary.H>
00028
00029
00030
00031 Foam::autoPtr<Foam::polyPatch> Foam::polyPatch::New
00032 (
00033 const word& patchType,
00034 const word& name,
00035 const label size,
00036 const label start,
00037 const label index,
00038 const polyBoundaryMesh& bm
00039 )
00040 {
00041 if (debug)
00042 {
00043 Info<< "polyPatch::New(const word&, const word&, const label, "
00044 "const label, const label, const polyBoundaryMesh&) : "
00045 "constructing polyPatch"
00046 << endl;
00047 }
00048
00049 wordConstructorTable::iterator cstrIter =
00050 wordConstructorTablePtr_->find(patchType);
00051
00052 if (cstrIter == wordConstructorTablePtr_->end())
00053 {
00054 FatalErrorIn
00055 (
00056 "polyPatch::New(const word&, const word&, const label, "
00057 "const label, const label, const polyBoundaryMesh&) "
00058 ) << "Unknown polyPatch type " << patchType << " for patch " << name
00059 << endl << endl
00060 << "Valid polyPatch types are :" << endl
00061 << wordConstructorTablePtr_->sortedToc()
00062 << exit(FatalError);
00063 }
00064
00065 return autoPtr<polyPatch>(cstrIter()(name, size, start, index, bm));
00066 }
00067
00068
00069 Foam::autoPtr<Foam::polyPatch> Foam::polyPatch::New
00070 (
00071 const word& name,
00072 const dictionary& dict,
00073 const label index,
00074 const polyBoundaryMesh& bm
00075 )
00076 {
00077 if (debug)
00078 {
00079 Info<< "polyPatch::New(const word&, const dictionary&, const label, "
00080 "const polyBoundaryMesh&) : constructing polyPatch"
00081 << endl;
00082 }
00083
00084 word patchType(dict.lookup("type"));
00085
00086 dict.readIfPresent("geometricType", patchType);
00087
00088 dictionaryConstructorTable::iterator cstrIter =
00089 dictionaryConstructorTablePtr_->find(patchType);
00090
00091 if (cstrIter == dictionaryConstructorTablePtr_->end())
00092 {
00093 if (!disallowGenericPolyPatch)
00094 {
00095 cstrIter = dictionaryConstructorTablePtr_->find("genericPatch");
00096 }
00097
00098 if (cstrIter == dictionaryConstructorTablePtr_->end())
00099 {
00100 FatalIOErrorIn
00101 (
00102 "polyPatch::New(const word&, const dictionary&, "
00103 "const label, const polyBoundaryMesh&)",
00104 dict
00105 ) << "Unknown polyPatch type " << patchType
00106 << " for patch " << name
00107 << endl << endl
00108 << "Valid polyPatch types are :" << endl
00109 << dictionaryConstructorTablePtr_->sortedToc()
00110 << exit(FatalIOError);
00111 }
00112 }
00113
00114 return autoPtr<polyPatch>(cstrIter()(name, dict, index, bm));
00115 }
00116
00117
00118