mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: simplify coding for local faces (in enrichedPatch)
- similar to changes made in PrimitivePatch (commit 8a5d108fd2)
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -50,10 +50,7 @@ void Foam::enrichedPatch::calcMeshPoints() const
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
meshPointsPtr_ = new labelList(pointMap().toc());
|
meshPointsPtr_ = new labelList(pointMap().sortedToc());
|
||||||
labelList& mp = *meshPointsPtr_;
|
|
||||||
|
|
||||||
sort(mp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -71,27 +68,24 @@ void Foam::enrichedPatch::calcLocalFaces() const
|
|||||||
|
|
||||||
Map<label> mpLookup(2*mp.size());
|
Map<label> mpLookup(2*mp.size());
|
||||||
|
|
||||||
forAll(mp, mpI)
|
forAll(mp, mpi)
|
||||||
{
|
{
|
||||||
mpLookup.insert(mp[mpI], mpI);
|
mpLookup.insert(mp[mpi], mpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create local faces.
|
||||||
|
// Copy original faces and overwrite vertices after
|
||||||
|
|
||||||
const faceList& faces = enrichedFaces();
|
const faceList& faces = enrichedFaces();
|
||||||
|
|
||||||
localFacesPtr_ = new faceList(faces.size());
|
localFacesPtr_ = new faceList(faces);
|
||||||
faceList& lf = *localFacesPtr_;
|
auto& locFaces = *localFacesPtr_;
|
||||||
|
|
||||||
forAll(faces, facei)
|
for (face& f : locFaces)
|
||||||
{
|
{
|
||||||
const face& f = faces[facei];
|
for (label& pointi : f)
|
||||||
|
|
||||||
face& curlf = lf[facei];
|
|
||||||
|
|
||||||
curlf.setSize(f.size());
|
|
||||||
|
|
||||||
forAll(f, pointi)
|
|
||||||
{
|
{
|
||||||
curlf[pointi] = mpLookup.cfind(f[pointi])();
|
pointi = *(mpLookup.cfind(pointi));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,11 +103,11 @@ void Foam::enrichedPatch::calcLocalPoints() const
|
|||||||
const labelList& mp = meshPoints();
|
const labelList& mp = meshPoints();
|
||||||
|
|
||||||
localPointsPtr_ = new pointField(mp.size());
|
localPointsPtr_ = new pointField(mp.size());
|
||||||
pointField& lp = *localPointsPtr_;
|
auto& locPoints = *localPointsPtr_;
|
||||||
|
|
||||||
forAll(lp, i)
|
forAll(locPoints, i)
|
||||||
{
|
{
|
||||||
lp[i] = pointMap().cfind(mp[i])();
|
locPoints[i] = *(pointMap().cfind(mp[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,15 +223,13 @@ bool Foam::enrichedPatch::checkSupport() const
|
|||||||
|
|
||||||
forAll(faces, facei)
|
forAll(faces, facei)
|
||||||
{
|
{
|
||||||
const face& curFace = faces[facei];
|
for (const label pointi : faces[facei])
|
||||||
|
|
||||||
forAll(curFace, pointi)
|
|
||||||
{
|
{
|
||||||
if (!pointMap().found(curFace[pointi]))
|
if (!pointMap().found(pointi))
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Point " << pointi << " of face " << facei
|
<< "Point " << pointi << " of face " << facei
|
||||||
<< " global point index: " << curFace[pointi]
|
<< " global point index: " << pointi
|
||||||
<< " not supported in point map. This is not allowed."
|
<< " not supported in point map. This is not allowed."
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -46,25 +47,26 @@ void Foam::slidingInterface::clearCouple
|
|||||||
<< "Clearing old couple points and faces." << endl;
|
<< "Clearing old couple points and faces." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all points from the point zone
|
|
||||||
|
|
||||||
const polyMesh& mesh = topoChanger().mesh();
|
const polyMesh& mesh = topoChanger().mesh();
|
||||||
|
|
||||||
const labelList& cutPointZoneLabels =
|
// Remove all points from the point zone
|
||||||
mesh.pointZones()[cutPointZoneID_.index()];
|
for
|
||||||
|
(
|
||||||
forAll(cutPointZoneLabels, pointi)
|
const label pointi
|
||||||
|
: mesh.pointZones()[cutPointZoneID_.index()]
|
||||||
|
)
|
||||||
{
|
{
|
||||||
ref.setAction(polyRemovePoint(cutPointZoneLabels[pointi]));
|
ref.setAction(polyRemovePoint(pointi));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all faces from the face zone
|
// Remove all faces from the face zone
|
||||||
const labelList& cutFaceZoneLabels =
|
for
|
||||||
mesh.faceZones()[cutFaceZoneID_.index()];
|
(
|
||||||
|
const label facei
|
||||||
forAll(cutFaceZoneLabels, facei)
|
: mesh.faceZones()[cutFaceZoneID_.index()]
|
||||||
|
)
|
||||||
{
|
{
|
||||||
ref.setAction(polyRemoveFace(cutFaceZoneLabels[facei]));
|
ref.setAction(polyRemoveFace(facei));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
Reference in New Issue
Block a user