mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: mappedPatchBase: abstract common code
This commit is contained in:
@ -86,18 +86,6 @@ Foam::mappedPatchBase::offsetModeNames_
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::mappedPatchBase::calcGeometry(PstreamBuffers& pBufs)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::mappedPatchBase::movePoints
|
|
||||||
(
|
|
||||||
PstreamBuffers& pBufs,
|
|
||||||
const pointField& p
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::mappedPatchBase::updateMesh(PstreamBuffers& pBufs)
|
void Foam::mappedPatchBase::updateMesh(PstreamBuffers& pBufs)
|
||||||
{
|
{
|
||||||
clearOut();
|
clearOut();
|
||||||
@ -1705,49 +1693,58 @@ bool Foam::mappedPatchBase::upToDate() const
|
|||||||
: true
|
: true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Lambda to check for points on the patch being the same
|
||||||
|
auto checkPointMovement = []
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const polyPatch& patch,
|
||||||
|
regIOobject& state
|
||||||
|
) -> bool
|
||||||
|
{
|
||||||
|
bool upToDate = true;
|
||||||
|
const auto& oldPoints = mesh.oldPoints();
|
||||||
|
const auto& points = mesh.points();
|
||||||
|
|
||||||
|
for (const label pointi : patch.meshPoints())
|
||||||
|
{
|
||||||
|
const point& oldPt = oldPoints[pointi];
|
||||||
|
const point& currentPt = points[pointi];
|
||||||
|
|
||||||
|
if (mag(oldPt - currentPt) > SMALL)
|
||||||
|
{
|
||||||
|
upToDate = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Pstream::reduceAnd(upToDate);
|
||||||
|
|
||||||
|
if (upToDate)
|
||||||
|
{
|
||||||
|
state.setUpToDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
return upToDate;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
if (!thisUpToDate && thisMesh.moving())
|
if (!thisUpToDate && thisMesh.moving())
|
||||||
{
|
{
|
||||||
// Moving (but not topoChanging mesh) : do more accurate check:
|
// Moving (but not topoChanging mesh) : do more accurate check:
|
||||||
// compare actual patch point position
|
// compare actual patch point position
|
||||||
|
|
||||||
thisUpToDate = true;
|
thisUpToDate = checkPointMovement(thisMesh, patch_, updateMeshTime());
|
||||||
for (const label pointi : patch_.meshPoints())
|
|
||||||
{
|
|
||||||
const point& oldPt = thisMesh.oldPoints()[pointi];
|
|
||||||
const point& thisPt = thisMesh.points()[pointi];
|
|
||||||
if (mag(oldPt-thisPt) > SMALL)
|
|
||||||
{
|
|
||||||
thisUpToDate = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Pstream::reduceAnd(thisUpToDate);
|
|
||||||
|
|
||||||
if (thisUpToDate)
|
|
||||||
{
|
|
||||||
updateMeshTime().setUpToDate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sampleUpToDate && sampleMesh().moving())
|
if (!sampleUpToDate && sampleMesh().moving())
|
||||||
{
|
{
|
||||||
sampleUpToDate = true;
|
sampleUpToDate = checkPointMovement
|
||||||
for (const label pointi : samplePolyPatch().meshPoints())
|
(
|
||||||
{
|
sampleMesh(),
|
||||||
const point& oldPt = sampleMesh().oldPoints()[pointi];
|
samplePolyPatch(),
|
||||||
const point& samplePt = sampleMesh().points()[pointi];
|
updateSampleMeshTime()
|
||||||
if (mag(oldPt-samplePt) > SMALL)
|
);
|
||||||
{
|
|
||||||
sampleUpToDate = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Pstream::reduceAnd(sampleUpToDate);
|
|
||||||
|
|
||||||
if (sampleUpToDate)
|
|
||||||
{
|
|
||||||
updateSampleMeshTime().setUpToDate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (thisUpToDate && sampleUpToDate);
|
return (thisUpToDate && sampleUpToDate);
|
||||||
|
|||||||
@ -308,14 +308,16 @@ protected:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
//- Calculate the patch geometry
|
//- Calculate the patch geometry
|
||||||
virtual void calcGeometry(PstreamBuffers&);
|
virtual void calcGeometry(PstreamBuffers&)
|
||||||
|
{}
|
||||||
|
|
||||||
//- Initialise the patches for moving points
|
//- Initialise the patches for moving points
|
||||||
virtual void initMovePoints(PstreamBuffers&, const pointField&)
|
virtual void initMovePoints(PstreamBuffers&, const pointField&)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Correct patches after moving points
|
//- Correct patches after moving points
|
||||||
virtual void movePoints(PstreamBuffers&, const pointField&);
|
virtual void movePoints(PstreamBuffers&, const pointField&)
|
||||||
|
{}
|
||||||
|
|
||||||
//- Initialise the update of the patch topology
|
//- Initialise the update of the patch topology
|
||||||
virtual void initUpdateMesh(PstreamBuffers&)
|
virtual void initUpdateMesh(PstreamBuffers&)
|
||||||
|
|||||||
Reference in New Issue
Block a user