Commit 8d2e5df8 authored by mattijs's avatar mattijs
Browse files

ENH: Allow pointPatchFields derived from constrained pointPatchField types.

parent 089e5939
......@@ -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
(
......
......@@ -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
......
......@@ -119,6 +119,17 @@ public:
)
);
}
// Member functions
//- Constraint handling
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return type();
}
};
......
......@@ -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
......
......@@ -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
......
......@@ -50,7 +50,7 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
(
"PointPatchField<Type>::New"
"(const word&, const pointPatch&, const Field<Type>&)"
) << "Unknown patchTypefield type "
) << "Unknown patchFieldType type "
<< patchFieldType
<< endl << endl
<< "Valid patchField types are :" << endl
......@@ -58,16 +58,32 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
<< exit(FatalError);
}
typename pointPatchConstructorTable::iterator patchTypeCstrIter =
pointPatchConstructorTablePtr_->find(p.type());
autoPtr<pointPatchField<Type> > pfPtr(cstrIter()(p, iF));
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
{
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
(
!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
(
"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);
// 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 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);
}
return autoPtr<pointPatchField<Type> >(cstrIter()(ptf, p, iF, pfMapper));
return cstrIter()(ptf, p, iF, pfMapper);
}
......
......@@ -337,9 +337,15 @@ public:
const Field<Type1>& 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
......
......@@ -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
{
......
......@@ -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
(
......
......@@ -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
{
......
......@@ -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
(
......
......@@ -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
(
......
......@@ -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
(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment