diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.H index 445a67281f..5d77b05804 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/basic/basicSymmetry/basicSymmetryPointPatchField.H @@ -36,6 +36,7 @@ SourceFiles #define basicSymmetryPointPatchField_H #include "pointPatchField.H" +#include "symmetryPointPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -120,6 +121,12 @@ public: // Evaluation functions + //- Return the constraint type this pointPatchField implements + virtual const word& constraintType() const + { + return symmetryPointPatch::typeName; + } + //- Update the patch field virtual void evaluate ( diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H index 14785b36eb..72eabdaaf9 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H @@ -127,6 +127,14 @@ public: // Member functions + //- Constraint handling + + //- Return the constraint type this pointPatchField implements + virtual const word& constraintType() const + { + return cyclicPointPatch::typeName; + } + //- Cyclic coupled interface functions //- Does the patch field perform the transfromation diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H index cc578731a0..bb58e0eeea 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H @@ -119,6 +119,17 @@ public: ) ); } + + // Member functions + + //- Constraint handling + + //- Return the constraint type this pointPatchField implements + virtual const word& constraintType() const + { + return type(); + } + }; diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H index 17bcfc1cb8..7f6f7b7173 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H @@ -159,6 +159,15 @@ public: } + //- Constraint handling + + //- Return the constraint type this pointPatchField implements + virtual const word& constraintType() const + { + return type(); + } + + // Evaluation functions //- Evaluate the patch field diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.H index 5f01f592e5..8c62f3e47b 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.H @@ -122,6 +122,14 @@ public: // Member functions + //- Constraint handling + + //- Return the constraint type this pointPatchField implements + virtual const word& constraintType() const + { + return type(); + } + // Evaluation functions //- Update the patch field diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/newPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/newPointPatchField.C index c77236f80d..b14fbeac8f 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/newPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/newPointPatchField.C @@ -50,7 +50,7 @@ Foam::autoPtr > Foam::pointPatchField::New ( "PointPatchField::New" "(const word&, const pointPatch&, const Field&)" - ) << "Unknown patchTypefield type " + ) << "Unknown patchFieldType type " << patchFieldType << endl << endl << "Valid patchField types are :" << endl @@ -58,16 +58,32 @@ Foam::autoPtr > Foam::pointPatchField::New << exit(FatalError); } - typename pointPatchConstructorTable::iterator patchTypeCstrIter = - pointPatchConstructorTablePtr_->find(p.type()); + autoPtr > pfPtr(cstrIter()(p, iF)); - if (patchTypeCstrIter != pointPatchConstructorTablePtr_->end()) + if (pfPtr().constraintType() == p.constraintType()) { - return autoPtr >(patchTypeCstrIter()(p, iF)); + // Compatible (constraint-wise) with the patch type + return pfPtr; } else { - return autoPtr >(cstrIter()(p, iF)); + // Use default constraint type + typename pointPatchConstructorTable::iterator patchTypeCstrIter = + pointPatchConstructorTablePtr_->find(p.type()); + + if (patchTypeCstrIter == pointPatchConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "PointPatchField::New" + "(const word&, const pointPatch&, const Field&)" + ) << "inconsistent patch and patchField types for \n" + << " patch type " << p.type() + << " and patchField type " << patchFieldType + << exit(FatalError); + } + + return patchTypeCstrIter()(p, iF); } } @@ -115,34 +131,44 @@ Foam::autoPtr > Foam::pointPatchField::New } } + // Construct (but not necesarily returned) + autoPtr > pfPtr(cstrIter()(p, iF, dict)); + if ( !dict.found("patchType") || word(dict.lookup("patchType")) != p.type() ) { - typename dictionaryConstructorTable::iterator patchTypeCstrIter - = dictionaryConstructorTablePtr_->find(p.type()); - - if - ( - patchTypeCstrIter != dictionaryConstructorTablePtr_->end() - && patchTypeCstrIter() != cstrIter() - ) + if (pfPtr().constraintType() == p.constraintType()) { - FatalIOErrorIn - ( - "PointPatchFieldconst pointPatch&, " - "const Field&, const dictionary&)", - dict - ) << "inconsistent patch and patchField types for \n" - << " patch type " << p.type() - << " and patchField type " << patchFieldType - << exit(FatalIOError); + // 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 + ( + "PointPatchFieldconst pointPatch&, " + "const Field&, 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 autoPtr >(cstrIter()(p, iF, dict)); + return cstrIter()(p, iF, dict); } @@ -185,7 +211,7 @@ Foam::autoPtr > Foam::pointPatchField::New << exit(FatalError); } - return autoPtr >(cstrIter()(ptf, p, iF, pfMapper)); + return cstrIter()(ptf, p, iF, pfMapper); } diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H index ae6ce5eb93..297b1c5370 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H @@ -337,9 +337,15 @@ public: const Field& pF ) const; - //- Return the type of the calculated for of pointPatchField + //- Return the type of the calculated form of pointPatchField static const word& calculatedType(); + //- Return the constraint type this pointPatchField implements. + virtual const word& constraintType() const + { + return word::null; + } + // Mapping functions diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H index 91fdb1cf84..df11e9cf3e 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H @@ -114,6 +114,12 @@ public: // Access + //- Return the constraint type this pointPatch implements. + virtual const word& constraintType() const + { + return type(); + } + //- Return the underlying cyclicPolyPatch const cyclicPolyPatch& cyclicPatch() const { diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/empty/emptyPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/empty/emptyPointPatch.H index c0450f1ce7..1352a71aa3 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/empty/emptyPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/empty/emptyPointPatch.H @@ -73,6 +73,12 @@ public: // Member Functions + //- Return the constraint type this pointPatch implements. + virtual const word& constraintType() const + { + return type(); + } + //- Accumulate the effect of constraint direction of this patch virtual void applyConstraint ( diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H index 9cdb82b2e3..6224e0c947 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H @@ -130,6 +130,12 @@ public: } } + //- Return the constraint type this pointPatch implements. + virtual const word& constraintType() const + { + return type(); + } + //- Return processor number int myProcNo() const { diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetry/symmetryPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetry/symmetryPointPatch.H index 16d66dccf8..cc66f9c505 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetry/symmetryPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetry/symmetryPointPatch.H @@ -73,6 +73,12 @@ public: // Member Functions + //- Return the constraint type this pointPatch implements. + virtual const word& constraintType() const + { + return type(); + } + //- Accumulate the effect of constraint direction of this patch virtual void applyConstraint ( diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/wedge/wedgePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/wedge/wedgePointPatch.H index 0de34e8661..0841de7f9c 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/wedge/wedgePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/wedge/wedgePointPatch.H @@ -73,6 +73,12 @@ public: // Member Functions + //- Return the constraint type this pointPatch implements. + virtual const word& constraintType() const + { + return type(); + } + //- Accumulate the effect of constraint direction of this patch virtual void applyConstraint ( diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H index 482c10128f..0bd6842743 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H @@ -158,6 +158,12 @@ public: //- Return point normals virtual const vectorField& pointNormals() const = 0; + //- Return the constraint type this pointPatch implements. + virtual const word& constraintType() const + { + return word::null; + } + //- Accumulate the effect of constraint direction of this patch virtual void applyConstraint (