ENH: Allow pointPatchFields derived from constrained pointPatchField types.

This commit is contained in:
mattijs
2010-04-13 16:46:35 +01:00
parent 089e593907
commit 8d2e5df846
13 changed files with 137 additions and 26 deletions

View File

@ -36,6 +36,7 @@ SourceFiles
#define basicSymmetryPointPatchField_H #define basicSymmetryPointPatchField_H
#include "pointPatchField.H" #include "pointPatchField.H"
#include "symmetryPointPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -120,6 +121,12 @@ public:
// Evaluation functions // Evaluation functions
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return symmetryPointPatch::typeName;
}
//- Update the patch field //- Update the patch field
virtual void evaluate virtual void evaluate
( (

View File

@ -127,6 +127,14 @@ public:
// Member functions // Member functions
//- Constraint handling
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return cyclicPointPatch::typeName;
}
//- Cyclic coupled interface functions //- Cyclic coupled interface functions
//- Does the patch field perform the transfromation //- Does the patch field perform the transfromation

View File

@ -119,6 +119,17 @@ public:
) )
); );
} }
// Member functions
//- Constraint handling
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return type();
}
}; };

View File

@ -159,6 +159,15 @@ public:
} }
//- Constraint handling
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return type();
}
// Evaluation functions // Evaluation functions
//- Evaluate the patch field //- Evaluate the patch field

View File

@ -122,6 +122,14 @@ public:
// Member functions // Member functions
//- Constraint handling
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return type();
}
// Evaluation functions // Evaluation functions
//- Update the patch field //- Update the patch field

View File

@ -50,7 +50,7 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
( (
"PointPatchField<Type>::New" "PointPatchField<Type>::New"
"(const word&, const pointPatch&, const Field<Type>&)" "(const word&, const pointPatch&, const Field<Type>&)"
) << "Unknown patchTypefield type " ) << "Unknown patchFieldType type "
<< patchFieldType << patchFieldType
<< endl << endl << endl << endl
<< "Valid patchField types are :" << endl << "Valid patchField types are :" << endl
@ -58,16 +58,32 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
<< exit(FatalError); << exit(FatalError);
} }
typename pointPatchConstructorTable::iterator patchTypeCstrIter = autoPtr<pointPatchField<Type> > pfPtr(cstrIter()(p, iF));
pointPatchConstructorTablePtr_->find(p.type());
if (patchTypeCstrIter != pointPatchConstructorTablePtr_->end()) if (pfPtr().constraintType() == p.constraintType())
{ {
return autoPtr<pointPatchField<Type> >(patchTypeCstrIter()(p, iF)); // Compatible (constraint-wise) with the patch type
return pfPtr;
} }
else else
{ {
return autoPtr<pointPatchField<Type> >(cstrIter()(p, iF)); // Use default constraint type
typename pointPatchConstructorTable::iterator patchTypeCstrIter =
pointPatchConstructorTablePtr_->find(p.type());
if (patchTypeCstrIter == pointPatchConstructorTablePtr_->end())
{
FatalErrorIn
(
"PointPatchField<Type>::New"
"(const word&, const pointPatch&, const Field<Type>&)"
) << "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<Type> > Foam::pointPatchField<Type>::New
} }
} }
// Construct (but not necesarily returned)
autoPtr<pointPatchField<Type> > pfPtr(cstrIter()(p, iF, dict));
if if
( (
!dict.found("patchType") !dict.found("patchType")
|| word(dict.lookup("patchType")) != p.type() || word(dict.lookup("patchType")) != p.type()
) )
{ {
typename dictionaryConstructorTable::iterator patchTypeCstrIter if (pfPtr().constraintType() == p.constraintType())
= dictionaryConstructorTablePtr_->find(p.type());
if
(
patchTypeCstrIter != dictionaryConstructorTablePtr_->end()
&& patchTypeCstrIter() != cstrIter()
)
{ {
FatalIOErrorIn // Compatible (constraint-wise) with the patch type
( return pfPtr;
"PointPatchField<Type>const pointPatch&, " }
"const Field<Type>&, const dictionary&)", else
dict {
) << "inconsistent patch and patchField types for \n" // Use default constraint type
<< " patch type " << p.type() typename dictionaryConstructorTable::iterator patchTypeCstrIter
<< " and patchField type " << patchFieldType = dictionaryConstructorTablePtr_->find(p.type());
<< exit(FatalIOError);
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 autoPtr<pointPatchField<Type> >(cstrIter()(p, iF, dict)); return cstrIter()(p, iF, dict);
} }
@ -185,7 +211,7 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
<< exit(FatalError); << exit(FatalError);
} }
return autoPtr<pointPatchField<Type> >(cstrIter()(ptf, p, iF, pfMapper)); return cstrIter()(ptf, p, iF, pfMapper);
} }

View File

@ -337,9 +337,15 @@ public:
const Field<Type1>& pF const Field<Type1>& pF
) const; ) const;
//- Return the type of the calculated for of pointPatchField //- Return the type of the calculated form of pointPatchField
static const word& calculatedType(); static const word& calculatedType();
//- Return the constraint type this pointPatchField implements.
virtual const word& constraintType() const
{
return word::null;
}
// Mapping functions // Mapping functions

View File

@ -114,6 +114,12 @@ public:
// Access // Access
//- Return the constraint type this pointPatch implements.
virtual const word& constraintType() const
{
return type();
}
//- Return the underlying cyclicPolyPatch //- Return the underlying cyclicPolyPatch
const cyclicPolyPatch& cyclicPatch() const const cyclicPolyPatch& cyclicPatch() const
{ {

View File

@ -73,6 +73,12 @@ public:
// Member Functions // 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 //- Accumulate the effect of constraint direction of this patch
virtual void applyConstraint virtual void applyConstraint
( (

View File

@ -130,6 +130,12 @@ public:
} }
} }
//- Return the constraint type this pointPatch implements.
virtual const word& constraintType() const
{
return type();
}
//- Return processor number //- Return processor number
int myProcNo() const int myProcNo() const
{ {

View File

@ -73,6 +73,12 @@ public:
// Member Functions // 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 //- Accumulate the effect of constraint direction of this patch
virtual void applyConstraint virtual void applyConstraint
( (

View File

@ -73,6 +73,12 @@ public:
// Member Functions // 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 //- Accumulate the effect of constraint direction of this patch
virtual void applyConstraint virtual void applyConstraint
( (

View File

@ -158,6 +158,12 @@ public:
//- Return point normals //- Return point normals
virtual const vectorField& pointNormals() const = 0; 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 //- Accumulate the effect of constraint direction of this patch
virtual void applyConstraint virtual void applyConstraint
( (