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,26 +36,26 @@ Description
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(wedgeFaPatch, 0);
defineTypeNameAndDebug(Foam::wedgeFaPatch, 0);
addToRunTimeSelectionTable(faPatch, wedgeFaPatch, dictionary);
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void wedgeFaPatch::findAxisPoint() const
void Foam::wedgeFaPatch::findAxisPoints() const
{
// Find axis point
labelList ptLabels = pointLabels();
const labelList& ptLabels = pointLabels();
labelListList ptEdges = pointEdges();
const labelListList& ptEdges = pointEdges();
const vectorField& points = boundaryMesh().mesh().points();
const scalarField& magL = magEdgeLengths();
labelHashSet axisPointsSet;
forAll (ptEdges, pointI)
{
if (ptEdges[pointI].size() == 1 )
@ -64,20 +64,21 @@ void wedgeFaPatch::findAxisPoint() const
if( r < magL[ptEdges[pointI][0]] )
{
axisPoint_ = ptLabels[pointI];
break;
axisPointsSet.insert(ptLabels[pointI]);
}
}
}
axisPointChecked_ = true;
axisPoints_ = axisPointsSet.toc();
axisPointsChecked_ = true;
}
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
//- Construct from polyPatch
wedgeFaPatch::wedgeFaPatch
Foam::wedgeFaPatch::wedgeFaPatch
(
const word& name,
const dictionary& dict,
@ -87,14 +88,14 @@ wedgeFaPatch::wedgeFaPatch
:
faPatch(name, dict, index, bm),
wedgePolyPatchPtr_(NULL),
axisPoint_(-1),
axisPointChecked_(false)
axisPointsChecked_(false)
{
if(ngbPolyPatchIndex() == -1)
{
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 "
<< this->name() << exit(FatalError);
}
@ -117,16 +118,12 @@ wedgeFaPatch::wedgeFaPatch
{
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 "
<< wedgePolyPatch::typeName
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -55,14 +55,14 @@ class wedgeFaPatch
const wedgePolyPatch* wedgePolyPatchPtr_;
//- Axis point label
mutable label axisPoint_;
//- Axis point labels
mutable labelList axisPoints_;
//- Is it axis point looked for?
mutable bool axisPointChecked_;
//- Have axis points already been checked?
mutable bool axisPointsChecked_;
//- Finde axis point
void findAxisPoint() const;
//- Find axis points
void findAxisPoints() const;
public:
@ -116,15 +116,33 @@ public:
return wedgePolyPatchPtr_->cellT();
}
//- Return axis point label
//- Return first axis point label
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_;
}
};