Merge commit '333c815d8fbb0a0b57250be9f8f4d47120245f1d' into nextRelease

This commit is contained in:
Hrvoje Jasak 2018-02-07 12:12:12 +00:00
commit ee38fbdc4e
2 changed files with 48 additions and 33 deletions

View file

@ -36,48 +36,49 @@ Description
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(Foam::wedgeFaPatch, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // addToRunTimeSelectionTable(faPatch, wedgeFaPatch, dictionary);
}
defineTypeNameAndDebug(wedgeFaPatch, 0);
addToRunTimeSelectionTable(faPatch, wedgeFaPatch, dictionary);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void wedgeFaPatch::findAxisPoint() const void Foam::wedgeFaPatch::findAxisPoints() const
{ {
// Find axis point // Find axis point
labelList ptLabels = pointLabels(); const labelList& ptLabels = pointLabels();
labelListList ptEdges = pointEdges(); const labelListList& ptEdges = pointEdges();
const vectorField& points = boundaryMesh().mesh().points(); const vectorField& points = boundaryMesh().mesh().points();
const scalarField& magL = magEdgeLengths(); const scalarField& magL = magEdgeLengths();
forAll(ptEdges, pointI) labelHashSet axisPointsSet;
forAll (ptEdges, pointI)
{ {
if( ptEdges[pointI].size() == 1 ) if (ptEdges[pointI].size() == 1 )
{ {
scalar r = mag((I-axis()*axis())&points[ptLabels[pointI]]); scalar r = mag((I-axis()*axis())&points[ptLabels[pointI]]);
if( r < magL[ptEdges[pointI][0]] ) if( r < magL[ptEdges[pointI][0]] )
{ {
axisPoint_ = ptLabels[pointI]; axisPointsSet.insert(ptLabels[pointI]);
break;
} }
} }
} }
axisPointChecked_ = true; axisPoints_ = axisPointsSet.toc();
axisPointsChecked_ = true;
} }
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
//- Construct from polyPatch //- Construct from polyPatch
wedgeFaPatch::wedgeFaPatch Foam::wedgeFaPatch::wedgeFaPatch
( (
const word& name, const word& name,
const dictionary& dict, const dictionary& dict,
@ -87,14 +88,14 @@ wedgeFaPatch::wedgeFaPatch
: :
faPatch(name, dict, index, bm), faPatch(name, dict, index, bm),
wedgePolyPatchPtr_(NULL), wedgePolyPatchPtr_(NULL),
axisPoint_(-1), axisPointsChecked_(false)
axisPointChecked_(false)
{ {
if(ngbPolyPatchIndex() == -1) if(ngbPolyPatchIndex() == -1)
{ {
FatalErrorIn FatalErrorIn
( (
"wedgeFaPatch::wedgeFaPatch(const word&, const dictionary&, const label, const faBoundaryMesh&)" "wedgeFaPatch::wedgeFaPatch(const word&, const dictionary&,"
" const label, const faBoundaryMesh&)"
) << "Neighbour polyPatch index is not specified for faPatch " ) << "Neighbour polyPatch index is not specified for faPatch "
<< this->name() << exit(FatalError); << this->name() << exit(FatalError);
} }
@ -117,16 +118,12 @@ wedgeFaPatch::wedgeFaPatch
{ {
FatalErrorIn FatalErrorIn
( (
"wedgeFaPatch::wedgeFaPatch(const word&, const dictionary&, const label, const faBoundaryMesh&)" "wedgeFaPatch::wedgeFaPatch(const word&, const dictionary&,"
"const label, const faBoundaryMesh&)"
) << "Neighbour polyPatch is not of type " ) << "Neighbour polyPatch is not of type "
<< wedgePolyPatch::typeName << wedgePolyPatch::typeName
<< exit(FatalError); << exit(FatalError);
} }
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View file

@ -55,14 +55,14 @@ class wedgeFaPatch
const wedgePolyPatch* wedgePolyPatchPtr_; const wedgePolyPatch* wedgePolyPatchPtr_;
//- Axis point label //- Axis point labels
mutable label axisPoint_; mutable labelList axisPoints_;
//- Is it axis point looked for? //- Have axis points already been checked?
mutable bool axisPointChecked_; mutable bool axisPointsChecked_;
//- Finde axis point //- Find axis points
void findAxisPoint() const; void findAxisPoints() const;
public: public:
@ -116,15 +116,33 @@ public:
return wedgePolyPatchPtr_->cellT(); return wedgePolyPatchPtr_->cellT();
} }
//- Return axis point label //- Return first axis point label
label axisPoint() const label axisPoint() const
{ {
if(axisPoint_ == -1 && !axisPointChecked_) if (!axisPointsChecked_)
{ {
findAxisPoint(); findAxisPoints();
} }
return axisPoint_; if (axisPoints_.size() > 0)
{
return axisPoints_[0];
}
else
{
return -1;
}
}
//- Return all axis point labels
const labelList& axisPoints() const
{
if (!axisPointsChecked_)
{
findAxisPoints();
}
return axisPoints_;
} }
}; };