autoPtr<PatchField<Type> > PointPatchField<PatchField, Mesh, PointPatch, MatrixType, Type>::New ( const PointPatch& p, const DimensionedField<Type, Mesh>& iF, const dictionary& dict ) { if (debug) { InfoIn ( "PointPatchField<PatchField, Mesh, PointPatch, MatrixType, Type>::" "New(const PointPatch&, const DimensionedField<Type, Mesh>&, " "const dictionary&)" ) << "constructing PointPatchField<PatchField, PointPatch, " << "MatrixType, Type>" << endl; } word patchFieldType(dict.lookup("type")); typename dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(patchFieldType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { cstrIter = dictionaryConstructorTablePtr_->find("default"); if (cstrIter == dictionaryConstructorTablePtr_->end()) { FatalIOErrorIn ( "PointPatchField<PatchField, Mesh, PointPatch, " "MatrixType, Type>::" "New(const PointPatch&, const DimensionedField<Type, Mesh>&, " "const dictionary&)", dict ) << "Unknown patchField type " << patchFieldType << " for patch type " << p.type() << endl << endl << "Valid patchField types are :" << endl << dictionaryConstructorTablePtr_->toc() << exit(FatalIOError); } } typename dictionaryConstructorTable::iterator patchTypeCstrIter = dictionaryConstructorTablePtr_->find(p.type()); if ( patchTypeCstrIter != dictionaryConstructorTablePtr_->end() && patchTypeCstrIter() != cstrIter() ) { FatalIOErrorIn ( "PointPatchField<PatchField, Mesh, PointPatch, MatrixType, Type>" "const PointPatch&, const DimensionedField<Type, Mesh>&, " "const dictionary&)", dict ) << "inconsistent patch and patchField types for \n" << " patch type " << p.type() << " and patchField type " << patchFieldType << exit(FatalIOError); } return autoPtr<PatchField<Type> >(cstrIter()(p, iF, dict)); }
tmp<faePatchField<Type> > faePatchField<Type>::New ( const faPatch& p, const DimensionedField<Type, edgeMesh>& iF, const dictionary& dict ) { if (debug) { Info<< "faePatchField<Type>::New(const faPatch&, " "const DimensionedField<Type, edgeMesh>&, " "const dictionary&) : " "constructing faePatchField<Type>" << endl; } word patchFieldType(dict.lookup("type")); typename dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(patchFieldType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { if (!disallowDefaultFaePatchField) { cstrIter = dictionaryConstructorTablePtr_->find("default"); } if (cstrIter == dictionaryConstructorTablePtr_->end()) { FatalIOErrorIn ( "faePatchField<Type>::New(const faPatch&, " "const DimensionedField<Type, edgeMesh>&, " "const dictionary&)", dict ) << "Unknown patchField type " << patchFieldType << " for patch type " << p.type() << endl << endl << "Valid patchField types are :" << endl << dictionaryConstructorTablePtr_->toc() << exit(FatalIOError); } } typename dictionaryConstructorTable::iterator patchTypeCstrIter = dictionaryConstructorTablePtr_->find(p.type()); if ( patchTypeCstrIter != dictionaryConstructorTablePtr_->end() && *patchTypeCstrIter != *cstrIter ) { FatalIOErrorIn ( "faePatchField<Type>const faPatch&, " "const DimensionedField<Type, edgeMesh>&, " "const dictionary&)", dict ) << "inconsistent patch and patchField types for \n" " patch type " << p.type() << " and patchField type " << patchFieldType << exit(FatalIOError); } return cstrIter()(p, iF, dict); }
Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New ( const pointPatch& p, const DimensionedField<Type, pointMesh>& iF, const dictionary& dict ) { if (debug) { Info<< "PointPatchField<Type>::" "New(const pointPatch&, const Field<Type>&, const dictionary&)" " : constructing pointPatchField<Type>" << endl; } word patchFieldType(dict.lookup("type")); typename dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(patchFieldType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { if (!disallowGenericPointPatchField) { cstrIter = dictionaryConstructorTablePtr_->find("generic"); } if (cstrIter == dictionaryConstructorTablePtr_->end()) { FatalIOErrorIn ( "PointPatchField<Type>::" "New(const pointPatch&, const Field<Type>&, const dictionary&)", dict ) << "Unknown patchField type " << patchFieldType << " for patch type " << p.type() << nl << nl << "Valid patchField types are :" << endl << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalIOError); } } // Construct (but not necesarily returned) autoPtr<pointPatchField<Type> > pfPtr(cstrIter()(p, iF, dict)); if ( !dict.found("patchType") || word(dict.lookup("patchType")) != p.type() ) { if (pfPtr().constraintType() == p.constraintType()) { // Compatible (constraint-wise) with the patch type return pfPtr; } else { // Use default constraint type typename dictionaryConstructorTable::iterator patchTypeCstrIter = dictionaryConstructorTablePtr_->find(p.type()); if (patchTypeCstrIter == pointPatchConstructorTablePtr_->end()) { FatalIOErrorIn ( "PointPatchField<Type>const pointPatch&, " "const Field<Type>&, const dictionary&)", dict ) << "inconsistent patch and patchField types for \n" << " patch type " << p.type() << " and patchField type " << patchFieldType << exit(FatalIOError); } return patchTypeCstrIter()(p, iF, dict); } } return cstrIter()(p, iF, dict); }