ENH: fvPatchField: store patchType if construct from words

This commit is contained in:
mattijs
2013-08-08 15:35:07 +01:00
parent f5abba4df3
commit c111b59e42
4 changed files with 45 additions and 7 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -278,6 +278,18 @@ public:
return internalField_; return internalField_;
} }
//- Optional patch type
const word& patchType() const
{
return patchType_;
}
//- Optional patch type
word& patchType()
{
return patchType_;
}
//- Return true if this patch field fixes a value //- Return true if this patch field fixes a value
virtual bool fixesValue() const virtual bool fixesValue() const
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield |2011 OpenFOAM: The Open Source CFD Toolbox \\ / F ield |2011 OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -89,6 +89,13 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
return patchTypeCstrIter()(p, iF); return patchTypeCstrIter()(p, iF);
} }
} }
else
{
if (pointPatchConstructorTablePtr_->found(p.type()))
{
pfPtr().patchType() = actualPatchType;
}
}
return pfPtr; return pfPtr;
} }

View File

@ -308,6 +308,18 @@ public:
return internalField_; return internalField_;
} }
//- Optional patch type
const word& patchType() const
{
return patchType_;
}
//- Optional patch type
word& patchType()
{
return patchType_;
}
//- Return the type of the calculated for of fvPatchField //- Return the type of the calculated for of fvPatchField
static const word& calculatedType(); static const word& calculatedType();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -60,15 +60,15 @@ Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
<< exit(FatalError); << exit(FatalError);
} }
typename patchConstructorTable::iterator patchTypeCstrIter =
patchConstructorTablePtr_->find(p.type());
if if
( (
actualPatchType == word::null actualPatchType == word::null
|| actualPatchType != p.type() || actualPatchType != p.type()
) )
{ {
typename patchConstructorTable::iterator patchTypeCstrIter =
patchConstructorTablePtr_->find(p.type());
if (patchTypeCstrIter != patchConstructorTablePtr_->end()) if (patchTypeCstrIter != patchConstructorTablePtr_->end())
{ {
return patchTypeCstrIter()(p, iF); return patchTypeCstrIter()(p, iF);
@ -80,7 +80,14 @@ Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
} }
else else
{ {
return cstrIter()(p, iF); tmp<fvPatchField<Type> > tfvp = cstrIter()(p, iF);
// Check if constraint type override and store patchType if so
if ((patchTypeCstrIter != patchConstructorTablePtr_->end()))
{
tfvp().patchType() = actualPatchType;
}
return tfvp;
} }
} }