mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Added master-slave addressing for coupled points.
- Rewrote globalPoints to use globalIndex class so now only transfers
single label instead of labelPair
- Added addressing in globalMeshData
- from coupled master points to slave points
- ,, edges ,, edges
- from coupled points (master or slave) to uncoupled boundary faces
- ,, ,, cells
- See test/globalMeshData for simple test
This commit is contained in:
3
applications/test/globalMeshData/Make/files
Normal file
3
applications/test/globalMeshData/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
globalMeshDataTest.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/globalMeshDataTest
|
||||
3
applications/test/globalMeshData/Make/options
Normal file
3
applications/test/globalMeshData/Make/options
Normal file
@ -0,0 +1,3 @@
|
||||
EXE_INC =
|
||||
|
||||
EXE_LIBS =
|
||||
221
applications/test/globalMeshData/globalMeshDataTest.C
Normal file
221
applications/test/globalMeshData/globalMeshDataTest.C
Normal file
@ -0,0 +1,221 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
globalMeshDataTest
|
||||
|
||||
Description
|
||||
Test global point communication
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "globalMeshData.H"
|
||||
#include "argList.H"
|
||||
#include "polyMesh.H"
|
||||
#include "Time.H"
|
||||
#include "mapDistribute.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createPolyMesh.H"
|
||||
|
||||
const globalMeshData& globalData = mesh.globalData();
|
||||
const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
|
||||
|
||||
|
||||
// Test:print shared points
|
||||
{
|
||||
const labelListList& globalPointSlaves =
|
||||
globalData.globalPointSlaves();
|
||||
const mapDistribute& globalPointSlavesMap =
|
||||
globalData.globalPointSlavesMap();
|
||||
|
||||
pointField coords(globalPointSlavesMap.constructSize());
|
||||
SubList<point>(coords, coupledPatch.nPoints()).assign
|
||||
(
|
||||
coupledPatch.localPoints()
|
||||
);
|
||||
|
||||
// Exchange data
|
||||
globalPointSlavesMap.distribute(coords);
|
||||
|
||||
// Print
|
||||
forAll(globalPointSlaves, pointI)
|
||||
{
|
||||
const labelList& slavePoints = globalPointSlaves[pointI];
|
||||
|
||||
if (slavePoints.size() > 0)
|
||||
{
|
||||
Pout<< "Master point:" << pointI
|
||||
<< " coord:" << coords[pointI]
|
||||
<< " connected to slave points:" << endl;
|
||||
|
||||
forAll(slavePoints, i)
|
||||
{
|
||||
Pout<< " " << coords[slavePoints[i]] << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Test: point to faces addressing
|
||||
{
|
||||
const labelListList& globalPointBoundaryFaces =
|
||||
globalData.globalPointBoundaryFaces();
|
||||
const mapDistribute& globalPointBoundaryFacesMap =
|
||||
globalData.globalPointBoundaryFacesMap();
|
||||
|
||||
label nBnd = mesh.nFaces()-mesh.nInternalFaces();
|
||||
|
||||
pointField fc(globalPointBoundaryFacesMap.constructSize());
|
||||
SubList<point>(fc, nBnd).assign
|
||||
(
|
||||
primitivePatch
|
||||
(
|
||||
SubList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
nBnd,
|
||||
mesh.nInternalFaces()
|
||||
),
|
||||
mesh.points()
|
||||
).faceCentres()
|
||||
);
|
||||
|
||||
// Exchange data
|
||||
globalPointBoundaryFacesMap.distribute(fc);
|
||||
|
||||
// Print
|
||||
forAll(globalPointBoundaryFaces, pointI)
|
||||
{
|
||||
const labelList& bFaces = globalPointBoundaryFaces[pointI];
|
||||
|
||||
Pout<< "Point:" << pointI
|
||||
<< " at:" << coupledPatch.localPoints()[pointI]
|
||||
<< " connected to faces:" << endl;
|
||||
|
||||
forAll(bFaces, i)
|
||||
{
|
||||
Pout<< " " << fc[bFaces[i]] << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Test:point to cells addressing
|
||||
{
|
||||
const labelList& boundaryCells = globalData.boundaryCells();
|
||||
const labelListList& globalPointBoundaryCells =
|
||||
globalData.globalPointBoundaryCells();
|
||||
const mapDistribute& globalPointBoundaryCellsMap =
|
||||
globalData.globalPointBoundaryCellsMap();
|
||||
|
||||
pointField cc(globalPointBoundaryCellsMap.constructSize());
|
||||
forAll(boundaryCells, i)
|
||||
{
|
||||
cc[i] = mesh.cellCentres()[boundaryCells[i]];
|
||||
}
|
||||
|
||||
// Exchange data
|
||||
globalPointBoundaryCellsMap.distribute(cc);
|
||||
|
||||
// Print
|
||||
forAll(globalPointBoundaryCells, pointI)
|
||||
{
|
||||
const labelList& bCells = globalPointBoundaryCells[pointI];
|
||||
|
||||
Pout<< "Point:" << pointI
|
||||
<< " at:" << coupledPatch.localPoints()[pointI]
|
||||
<< " connected to cells:" << endl;
|
||||
|
||||
forAll(bCells, i)
|
||||
{
|
||||
Pout<< " " << cc[bCells[i]] << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Test:print shared edges
|
||||
{
|
||||
const labelListList& globalEdgeSlaves =
|
||||
globalData.globalEdgeSlaves();
|
||||
const mapDistribute& globalEdgeSlavesMap =
|
||||
globalData.globalEdgeSlavesMap();
|
||||
|
||||
// Test: distribute edge centres
|
||||
pointField ec(globalEdgeSlavesMap.constructSize());
|
||||
forAll(coupledPatch.edges(), edgeI)
|
||||
{
|
||||
ec[edgeI] = coupledPatch.edges()[edgeI].centre
|
||||
(
|
||||
coupledPatch.localPoints()
|
||||
);
|
||||
}
|
||||
|
||||
// Exchange data
|
||||
globalEdgeSlavesMap.distribute(ec);
|
||||
|
||||
// Print
|
||||
forAll(globalEdgeSlaves, edgeI)
|
||||
{
|
||||
const labelList& slaveEdges = globalEdgeSlaves[edgeI];
|
||||
|
||||
if (slaveEdges.size() > 0)
|
||||
{
|
||||
Pout<< "Master edge:" << edgeI
|
||||
<< " centre:" << ec[edgeI]
|
||||
<< " connected to slave edges:" << endl;
|
||||
|
||||
forAll(slaveEdges, i)
|
||||
{
|
||||
Pout<< " " << ec[slaveEdges[i]] << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -32,6 +32,8 @@ License
|
||||
#include "demandDrivenData.H"
|
||||
#include "globalPoints.H"
|
||||
//#include "geomGlobalPoints.H"
|
||||
#include "polyMesh.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "labelIOList.H"
|
||||
#include "PackedList.H"
|
||||
#include "mergePoints.H"
|
||||
@ -115,24 +117,17 @@ void Foam::globalMeshData::initProcAddr()
|
||||
// Given information about locally used edges allocate global shared edges.
|
||||
void Foam::globalMeshData::countSharedEdges
|
||||
(
|
||||
const HashTable<labelList, edge, Hash<edge> >& procSharedEdges,
|
||||
HashTable<label, edge, Hash<edge> >& globalShared,
|
||||
const EdgeMap<labelList>& procSharedEdges,
|
||||
EdgeMap<label>& globalShared,
|
||||
label& sharedEdgeI
|
||||
)
|
||||
{
|
||||
// Count occurrences of procSharedEdges in global shared edges table.
|
||||
for
|
||||
(
|
||||
HashTable<labelList, edge, Hash<edge> >::const_iterator iter =
|
||||
procSharedEdges.begin();
|
||||
iter != procSharedEdges.end();
|
||||
++iter
|
||||
)
|
||||
forAllConstIter(EdgeMap<labelList>, procSharedEdges, iter)
|
||||
{
|
||||
const edge& e = iter.key();
|
||||
|
||||
HashTable<label, edge, Hash<edge> >::iterator globalFnd =
|
||||
globalShared.find(e);
|
||||
EdgeMap<label>::iterator globalFnd = globalShared.find(e);
|
||||
|
||||
if (globalFnd == globalShared.end())
|
||||
{
|
||||
@ -189,10 +184,7 @@ void Foam::globalMeshData::calcSharedEdges() const
|
||||
// Find edges using shared points. Store correspondence to local edge
|
||||
// numbering. Note that multiple local edges can have the same shared
|
||||
// points! (for cyclics or separated processor patches)
|
||||
HashTable<labelList, edge, Hash<edge> > localShared
|
||||
(
|
||||
2*sharedPtAddr.size()
|
||||
);
|
||||
EdgeMap<labelList> localShared(2*sharedPtAddr.size());
|
||||
|
||||
const edgeList& edges = mesh_.edges();
|
||||
|
||||
@ -218,7 +210,7 @@ void Foam::globalMeshData::calcSharedEdges() const
|
||||
sharedPtAddr[e1Fnd()]
|
||||
);
|
||||
|
||||
HashTable<labelList, edge, Hash<edge> >::iterator iter =
|
||||
EdgeMap<labelList>::iterator iter =
|
||||
localShared.find(sharedEdge);
|
||||
|
||||
if (iter == localShared.end())
|
||||
@ -249,7 +241,7 @@ void Foam::globalMeshData::calcSharedEdges() const
|
||||
// used). But then this only gets done once so not too bothered about the
|
||||
// extra global communication.
|
||||
|
||||
HashTable<label, edge, Hash<edge> > globalShared(nGlobalPoints());
|
||||
EdgeMap<label> globalShared(nGlobalPoints());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
@ -275,10 +267,7 @@ void Foam::globalMeshData::calcSharedEdges() const
|
||||
{
|
||||
// Receive the edges using shared points from the slave.
|
||||
IPstream fromSlave(Pstream::blocking, slave);
|
||||
HashTable<labelList, edge, Hash<edge> > procSharedEdges
|
||||
(
|
||||
fromSlave
|
||||
);
|
||||
EdgeMap<labelList> procSharedEdges(fromSlave);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -295,17 +284,11 @@ void Foam::globalMeshData::calcSharedEdges() const
|
||||
// These were only used once so are not proper shared edges.
|
||||
// Remove them.
|
||||
{
|
||||
HashTable<label, edge, Hash<edge> > oldSharedEdges(globalShared);
|
||||
EdgeMap<label> oldSharedEdges(globalShared);
|
||||
|
||||
globalShared.clear();
|
||||
|
||||
for
|
||||
(
|
||||
HashTable<label, edge, Hash<edge> >::const_iterator iter =
|
||||
oldSharedEdges.begin();
|
||||
iter != oldSharedEdges.end();
|
||||
++iter
|
||||
)
|
||||
forAllConstIter(EdgeMap<label>, oldSharedEdges, iter)
|
||||
{
|
||||
if (iter() != -1)
|
||||
{
|
||||
@ -361,18 +344,11 @@ void Foam::globalMeshData::calcSharedEdges() const
|
||||
DynamicList<label> dynSharedEdgeLabels(globalShared.size());
|
||||
DynamicList<label> dynSharedEdgeAddr(globalShared.size());
|
||||
|
||||
for
|
||||
(
|
||||
HashTable<labelList, edge, Hash<edge> >::const_iterator iter =
|
||||
localShared.begin();
|
||||
iter != localShared.end();
|
||||
++iter
|
||||
)
|
||||
forAllConstIter(EdgeMap<labelList>, localShared, iter)
|
||||
{
|
||||
const edge& e = iter.key();
|
||||
|
||||
HashTable<label, edge, Hash<edge> >::const_iterator edgeFnd =
|
||||
globalShared.find(e);
|
||||
EdgeMap<label>::const_iterator edgeFnd = globalShared.find(e);
|
||||
|
||||
if (edgeFnd != globalShared.end())
|
||||
{
|
||||
@ -434,6 +410,557 @@ Foam::label Foam::globalMeshData::countCoincidentFaces
|
||||
}
|
||||
|
||||
|
||||
void Foam::globalMeshData::calcGlobalPointSlaves() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalPointSlaves() :"
|
||||
<< " calculating coupled master to slave point addressing."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Calculate connected points for master points
|
||||
globalPoints globalData(mesh_, coupledPatch(), true);
|
||||
|
||||
const Map<label>& meshToProcPoint = globalData.meshToProcPoint();
|
||||
|
||||
// Create global numbering for coupled points
|
||||
globalPointNumberingPtr_.reset
|
||||
(
|
||||
new globalIndex(globalData.globalIndices())
|
||||
);
|
||||
const globalIndex& globalIndices = globalPointNumberingPtr_();
|
||||
|
||||
// Create master to slave addressing. Empty for slave points.
|
||||
globalPointSlavesPtr_.reset
|
||||
(
|
||||
new labelListList(coupledPatch().nPoints())
|
||||
);
|
||||
labelListList& globalPointSlaves = globalPointSlavesPtr_();
|
||||
|
||||
forAllConstIter(Map<label>, meshToProcPoint, iter)
|
||||
{
|
||||
label localPointI = iter.key();
|
||||
const labelList& pPoints = globalData.procPoints()[iter()];
|
||||
|
||||
// Am I master?
|
||||
if
|
||||
(
|
||||
globalIndices.isLocal(pPoints[0])
|
||||
&& globalIndices.toLocal(pPoints[0]) == localPointI
|
||||
)
|
||||
{
|
||||
labelList& slaves = globalPointSlaves[localPointI];
|
||||
slaves.setSize(pPoints.size()-1);
|
||||
for (label i = 1; i < pPoints.size(); i++)
|
||||
{
|
||||
slaves[i-1] = pPoints[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create schedule to get information from slaves onto master
|
||||
|
||||
// Construct compact numbering and distribution map.
|
||||
// Changes globalPointSlaves to be indices into compact data
|
||||
|
||||
List<Map<label> > compactMap(Pstream::nProcs());
|
||||
globalPointSlavesMapPtr_.reset
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
globalIndices,
|
||||
globalPointSlaves,
|
||||
compactMap
|
||||
)
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalPointSlaves() :"
|
||||
<< " coupled points:" << coupledPatch().nPoints()
|
||||
<< " additional remote points:"
|
||||
<< globalPointSlavesMapPtr_().constructSize()
|
||||
- coupledPatch().nPoints()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalEdgeSlaves() :"
|
||||
<< " calculating coupled master to slave edge addressing."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
const labelListList& globalPointSlaves = this->globalPointSlaves();
|
||||
const mapDistribute& globalPointSlavesMap = this->globalPointSlavesMap();
|
||||
|
||||
// - Send across connected edges (in global edge addressing)
|
||||
// - Check on receiving side whether edge has same slave edge
|
||||
// on both endpoints.
|
||||
|
||||
// Create global numbering for coupled edges
|
||||
globalEdgeNumberingPtr_.reset
|
||||
(
|
||||
new globalIndex(coupledPatch().nEdges())
|
||||
);
|
||||
const globalIndex& globalIndices = globalEdgeNumberingPtr_();
|
||||
|
||||
// Coupled point to global coupled edges.
|
||||
labelListList globalPointEdges(globalPointSlavesMap.constructSize());
|
||||
|
||||
// Create local version
|
||||
const labelListList& pointEdges = coupledPatch().pointEdges();
|
||||
forAll(pointEdges, pointI)
|
||||
{
|
||||
const labelList& pEdges = pointEdges[pointI];
|
||||
labelList& globalPEdges = globalPointEdges[pointI];
|
||||
globalPEdges.setSize(pEdges.size());
|
||||
forAll(pEdges, i)
|
||||
{
|
||||
globalPEdges[i] = globalIndices.toGlobal(pEdges[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Pull slave data to master
|
||||
globalPointSlavesMap.distribute(globalPointEdges);
|
||||
|
||||
// Now check on master if any of my edges are also on slave.
|
||||
// This assumes that if slaves have a coupled edge it is also on
|
||||
// the master (otherwise the mesh would be illegal anyway)
|
||||
|
||||
labelHashSet pointEdgeSet;
|
||||
|
||||
const edgeList& edges = coupledPatch().edges();
|
||||
|
||||
// Create master to slave addressing. Empty for slave edges.
|
||||
globalEdgeSlavesPtr_.reset(new labelListList(edges.size()));
|
||||
labelListList& globalEdgeSlaves = globalEdgeSlavesPtr_();
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
const edge& e = edges[edgeI];
|
||||
const labelList& slaves0 = globalPointSlaves[e[0]];
|
||||
const labelList& slaves1 = globalPointSlaves[e[1]];
|
||||
|
||||
// Check for edges that are in both slaves0 and slaves1.
|
||||
pointEdgeSet.clear();
|
||||
forAll(slaves0, i)
|
||||
{
|
||||
const labelList& connectedEdges = globalPointEdges[slaves0[i]];
|
||||
pointEdgeSet.insert(connectedEdges);
|
||||
}
|
||||
forAll(slaves1, i)
|
||||
{
|
||||
const labelList& connectedEdges = globalPointEdges[slaves1[i]];
|
||||
|
||||
forAll(connectedEdges, j)
|
||||
{
|
||||
label globalEdgeI = connectedEdges[j];
|
||||
|
||||
if (pointEdgeSet.found(globalEdgeI))
|
||||
{
|
||||
// Found slave edge.
|
||||
label sz = globalEdgeSlaves[edgeI].size();
|
||||
globalEdgeSlaves[edgeI].setSize(sz+1);
|
||||
globalEdgeSlaves[edgeI][sz] = globalEdgeI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Construct map
|
||||
List<Map<label> > compactMap(Pstream::nProcs());
|
||||
globalEdgeSlavesMapPtr_.reset
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
globalIndices,
|
||||
globalEdgeSlaves,
|
||||
compactMap
|
||||
)
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalEdgeSlaves() :"
|
||||
<< " coupled edge:" << edges.size()
|
||||
<< " additional remote edges:"
|
||||
<< globalEdgeSlavesMapPtr_().constructSize() - edges.size()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Calculate uncoupled boundary faces (without calculating
|
||||
// primitiveMesh::pointFaces())
|
||||
void Foam::globalMeshData::calcPointBoundaryFaces
|
||||
(
|
||||
labelListList& pointBoundaryFaces
|
||||
) const
|
||||
{
|
||||
const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
|
||||
const Map<label>& meshPointMap = coupledPatch().meshPointMap();
|
||||
|
||||
// 1. Count
|
||||
|
||||
labelList nPointFaces(coupledPatch().nPoints(), 0);
|
||||
|
||||
forAll(bMesh, patchI)
|
||||
{
|
||||
const polyPatch& pp = bMesh[patchI];
|
||||
|
||||
if (!pp.coupled())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
const face& f = pp[i];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
Map<label>::const_iterator iter = meshPointMap.find(f[fp]);
|
||||
if (iter != meshPointMap.end())
|
||||
{
|
||||
nPointFaces[iter()]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 2. Size
|
||||
|
||||
pointBoundaryFaces.setSize(coupledPatch().nPoints());
|
||||
forAll(nPointFaces, pointI)
|
||||
{
|
||||
pointBoundaryFaces[pointI].setSize(nPointFaces[pointI]);
|
||||
}
|
||||
nPointFaces = 0;
|
||||
|
||||
|
||||
// 3. Fill
|
||||
|
||||
forAll(bMesh, patchI)
|
||||
{
|
||||
const polyPatch& pp = bMesh[patchI];
|
||||
|
||||
if (!pp.coupled())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
const face& f = pp[i];
|
||||
forAll(f, fp)
|
||||
{
|
||||
Map<label>::const_iterator iter = meshPointMap.find(f[fp]);
|
||||
if (iter != meshPointMap.end())
|
||||
{
|
||||
label bFaceI = pp.start() + i - mesh_.nInternalFaces();
|
||||
pointBoundaryFaces[iter()][nPointFaces[iter()]++] =
|
||||
bFaceI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Foam::globalMeshData::calcGlobalPointBoundaryFaces() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalPointBoundaryFaces() :"
|
||||
<< " calculating coupled point to boundary face addressing."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Construct local point to (uncoupled)boundaryfaces.
|
||||
labelListList pointBoundaryFaces;
|
||||
calcPointBoundaryFaces(pointBoundaryFaces);
|
||||
|
||||
|
||||
// Global indices for boundary faces
|
||||
globalBoundaryFaceNumberingPtr_.reset
|
||||
(
|
||||
new globalIndex(mesh_.nFaces()-mesh_.nInternalFaces())
|
||||
);
|
||||
globalIndex& globalIndices = globalBoundaryFaceNumberingPtr_();
|
||||
|
||||
|
||||
// Convert local boundary faces to global numbering
|
||||
globalPointBoundaryFacesPtr_.reset
|
||||
(
|
||||
new labelListList(globalPointSlavesMap().constructSize())
|
||||
);
|
||||
labelListList& globalPointBoundaryFaces = globalPointBoundaryFacesPtr_();
|
||||
|
||||
forAll(pointBoundaryFaces, pointI)
|
||||
{
|
||||
const labelList& bFaces = pointBoundaryFaces[pointI];
|
||||
labelList& globalFaces = globalPointBoundaryFaces[pointI];
|
||||
globalFaces.setSize(bFaces.size());
|
||||
forAll(bFaces, i)
|
||||
{
|
||||
globalFaces[i] = globalIndices.toGlobal(bFaces[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Pull slave pointBoundaryFaces to master
|
||||
globalPointSlavesMap().distribute(globalPointBoundaryFaces);
|
||||
|
||||
|
||||
// Merge slave labels into master globalPointBoundaryFaces
|
||||
const labelListList& pointSlaves = globalPointSlaves();
|
||||
|
||||
forAll(pointSlaves, pointI)
|
||||
{
|
||||
const labelList& slaves = pointSlaves[pointI];
|
||||
|
||||
if (slaves.size() > 0)
|
||||
{
|
||||
labelList& myBFaces = globalPointBoundaryFaces[pointI];
|
||||
|
||||
forAll(slaves, i)
|
||||
{
|
||||
const labelList& slaveBFaces =
|
||||
globalPointBoundaryFaces[slaves[i]];
|
||||
|
||||
// Add all slaveBFaces. Note that need to check for
|
||||
// uniqueness only in case of cyclics.
|
||||
|
||||
label sz = myBFaces.size();
|
||||
myBFaces.setSize(sz+slaveBFaces.size());
|
||||
forAll(slaveBFaces, j)
|
||||
{
|
||||
label slave = slaveBFaces[j];
|
||||
if (findIndex(SubList<label>(myBFaces, sz), slave) == -1)
|
||||
{
|
||||
myBFaces[sz++] = slave;
|
||||
}
|
||||
}
|
||||
myBFaces.setSize(sz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Copy merged boundaryFaces back from master into slave slot
|
||||
forAll(pointSlaves, pointI)
|
||||
{
|
||||
const labelList& bFaces = globalPointBoundaryFaces[pointI];
|
||||
const labelList& slaves = pointSlaves[pointI];
|
||||
|
||||
forAll(slaves, i)
|
||||
{
|
||||
globalPointBoundaryFaces[slaves[i]] = bFaces;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sync back to slaves.
|
||||
globalPointSlavesMap().reverseDistribute
|
||||
(
|
||||
coupledPatch().nPoints(),
|
||||
globalPointBoundaryFaces
|
||||
);
|
||||
|
||||
|
||||
// Construct a map to get the face data directly
|
||||
List<Map<label> > compactMap(Pstream::nProcs());
|
||||
globalPointBoundaryFacesMapPtr_.reset
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
globalIndices,
|
||||
globalPointBoundaryFaces,
|
||||
compactMap
|
||||
)
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalPointBoundaryFaces() :"
|
||||
<< " coupled points:" << coupledPatch().nPoints()
|
||||
<< " local boundary faces:" << globalIndices.localSize()
|
||||
<< " additional remote faces:"
|
||||
<< globalPointBoundaryFacesMapPtr_().constructSize()
|
||||
- globalIndices.localSize()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::globalMeshData::calcGlobalPointBoundaryCells() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalPointBoundaryCells() :"
|
||||
<< " calculating coupled point to boundary cell addressing."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Create map of boundary cells and point-cell addressing
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
label bCellI = 0;
|
||||
Map<label> meshCellMap(4*coupledPatch().nPoints());
|
||||
DynamicList<label> cellMap(meshCellMap.size());
|
||||
|
||||
// Create addressing for point to boundary cells (local)
|
||||
labelListList pointBoundaryCells(coupledPatch().nPoints());
|
||||
|
||||
forAll(coupledPatch().meshPoints(), pointI)
|
||||
{
|
||||
label meshPointI = coupledPatch().meshPoints()[pointI];
|
||||
const labelList& pCells = mesh_.pointCells(meshPointI);
|
||||
|
||||
labelList& bCells = pointBoundaryCells[pointI];
|
||||
bCells.setSize(pCells.size());
|
||||
|
||||
forAll(pCells, i)
|
||||
{
|
||||
label cellI = pCells[i];
|
||||
Map<label>::iterator fnd = meshCellMap.find(cellI);
|
||||
|
||||
if (fnd != meshCellMap.end())
|
||||
{
|
||||
bCells[i] = fnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
meshCellMap.insert(cellI, bCellI);
|
||||
cellMap.append(cellI);
|
||||
bCells[i] = bCellI;
|
||||
bCellI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boundaryCellsPtr_.reset(new labelList());
|
||||
labelList& boundaryCells = boundaryCellsPtr_();
|
||||
boundaryCells.transfer(cellMap.shrink());
|
||||
|
||||
|
||||
// Convert point-cells to global point numbers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
globalBoundaryCellNumberingPtr_.reset
|
||||
(
|
||||
new globalIndex(boundaryCells.size())
|
||||
);
|
||||
globalIndex& globalIndices = globalBoundaryCellNumberingPtr_();
|
||||
|
||||
|
||||
globalPointBoundaryCellsPtr_.reset
|
||||
(
|
||||
new labelListList(globalPointSlavesMap().constructSize())
|
||||
);
|
||||
labelListList& globalPointBoundaryCells = globalPointBoundaryCellsPtr_();
|
||||
|
||||
forAll(pointBoundaryCells, pointI)
|
||||
{
|
||||
const labelList& pCells = pointBoundaryCells[pointI];
|
||||
labelList& globalCells = globalPointBoundaryCells[pointI];
|
||||
globalCells.setSize(pCells.size());
|
||||
forAll(pCells, i)
|
||||
{
|
||||
globalCells[i] = globalIndices.toGlobal(pCells[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Pull slave pointBoundaryCells to master
|
||||
globalPointSlavesMap().distribute(globalPointBoundaryCells);
|
||||
|
||||
|
||||
// Merge slave labels into master globalPointBoundaryCells
|
||||
const labelListList& pointSlaves = globalPointSlaves();
|
||||
|
||||
forAll(pointSlaves, pointI)
|
||||
{
|
||||
const labelList& slaves = pointSlaves[pointI];
|
||||
|
||||
if (slaves.size() > 0)
|
||||
{
|
||||
labelList& myBCells = globalPointBoundaryCells[pointI];
|
||||
|
||||
forAll(slaves, i)
|
||||
{
|
||||
const labelList& slaveBCells =
|
||||
globalPointBoundaryCells[slaves[i]];
|
||||
|
||||
// Add all slaveBCells. Note that need to check for
|
||||
// uniqueness only in case of cyclics.
|
||||
|
||||
label sz = myBCells.size();
|
||||
myBCells.setSize(sz+slaveBCells.size());
|
||||
forAll(slaveBCells, j)
|
||||
{
|
||||
label slave = slaveBCells[j];
|
||||
if (findIndex(SubList<label>(myBCells, sz), slave) == -1)
|
||||
{
|
||||
myBCells[sz++] = slave;
|
||||
}
|
||||
}
|
||||
myBCells.setSize(sz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Copy merged boundaryCells back from master into slave slot
|
||||
forAll(pointSlaves, pointI)
|
||||
{
|
||||
const labelList& bCells = globalPointBoundaryCells[pointI];
|
||||
const labelList& slaves = pointSlaves[pointI];
|
||||
|
||||
forAll(slaves, i)
|
||||
{
|
||||
globalPointBoundaryCells[slaves[i]] = bCells;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sync back to slaves.
|
||||
globalPointSlavesMap().reverseDistribute
|
||||
(
|
||||
coupledPatch().nPoints(),
|
||||
globalPointBoundaryCells
|
||||
);
|
||||
|
||||
|
||||
// Construct a map to get the cell data directly
|
||||
List<Map<label> > compactMap(Pstream::nProcs());
|
||||
globalPointBoundaryCellsMapPtr_.reset
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
globalIndices,
|
||||
globalPointBoundaryCells,
|
||||
compactMap
|
||||
)
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalPointBoundaryCells() :"
|
||||
<< " coupled points:" << coupledPatch().nPoints()
|
||||
<< " local boundary cells:" << globalIndices.localSize()
|
||||
<< " additional remote cells:"
|
||||
<< globalPointBoundaryCellsMapPtr_().constructSize()
|
||||
- globalIndices.localSize()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from polyMesh
|
||||
@ -511,6 +1038,25 @@ void Foam::globalMeshData::clearOut()
|
||||
nGlobalPoints_ = -1;
|
||||
deleteDemandDrivenData(sharedEdgeLabelsPtr_);
|
||||
deleteDemandDrivenData(sharedEdgeAddrPtr_);
|
||||
|
||||
coupledPatchPtr_.clear();
|
||||
// Point
|
||||
globalPointNumberingPtr_.clear();
|
||||
globalPointSlavesPtr_.clear();
|
||||
globalPointSlavesMapPtr_.clear();
|
||||
// Edge
|
||||
globalEdgeNumberingPtr_.clear();
|
||||
globalEdgeSlavesPtr_.clear();
|
||||
globalEdgeSlavesMapPtr_.clear();
|
||||
// Face
|
||||
globalBoundaryFaceNumberingPtr_.clear();
|
||||
globalPointBoundaryFacesPtr_.clear();
|
||||
globalPointBoundaryFacesMapPtr_.clear();
|
||||
// Cell
|
||||
boundaryCellsPtr_.clear();
|
||||
globalBoundaryCellNumberingPtr_.clear();
|
||||
globalPointBoundaryCellsPtr_.clear();
|
||||
globalPointBoundaryCellsMapPtr_.clear();
|
||||
}
|
||||
|
||||
|
||||
@ -709,6 +1255,203 @@ const Foam::labelList& Foam::globalMeshData::sharedEdgeAddr() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::indirectPrimitivePatch& Foam::globalMeshData::coupledPatch() const
|
||||
{
|
||||
if (!coupledPatchPtr_.valid())
|
||||
{
|
||||
const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
|
||||
|
||||
label nCoupled = 0;
|
||||
|
||||
forAll(bMesh, patchI)
|
||||
{
|
||||
const polyPatch& pp = bMesh[patchI];
|
||||
|
||||
if (pp.coupled())
|
||||
{
|
||||
nCoupled += pp.size();
|
||||
}
|
||||
}
|
||||
labelList coupledFaces(nCoupled);
|
||||
nCoupled = 0;
|
||||
|
||||
forAll(bMesh, patchI)
|
||||
{
|
||||
const polyPatch& pp = bMesh[patchI];
|
||||
|
||||
if (pp.coupled())
|
||||
{
|
||||
label faceI = pp.start();
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
coupledFaces[nCoupled++] = faceI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coupledPatchPtr_.reset
|
||||
(
|
||||
new indirectPrimitivePatch
|
||||
(
|
||||
IndirectList<face>
|
||||
(
|
||||
mesh_.faces(),
|
||||
coupledFaces
|
||||
),
|
||||
mesh_.points()
|
||||
)
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::coupledPatch() :"
|
||||
<< " constructed coupled faces patch:"
|
||||
<< " faces:" << coupledPatchPtr_().size()
|
||||
<< " points:" << coupledPatchPtr_().nPoints()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
return coupledPatchPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::globalIndex& Foam::globalMeshData::globalPointNumbering() const
|
||||
{
|
||||
if (!globalPointNumberingPtr_.valid())
|
||||
{
|
||||
calcGlobalPointSlaves();
|
||||
}
|
||||
return globalPointNumberingPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::globalMeshData::globalPointSlaves() const
|
||||
{
|
||||
if (!globalPointSlavesPtr_.valid())
|
||||
{
|
||||
calcGlobalPointSlaves();
|
||||
}
|
||||
return globalPointSlavesPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::mapDistribute& Foam::globalMeshData::globalPointSlavesMap() const
|
||||
{
|
||||
if (!globalPointSlavesMapPtr_.valid())
|
||||
{
|
||||
calcGlobalPointSlaves();
|
||||
}
|
||||
return globalPointSlavesMapPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::globalIndex& Foam::globalMeshData::globalEdgeNumbering() const
|
||||
{
|
||||
if (!globalEdgeNumberingPtr_.valid())
|
||||
{
|
||||
calcGlobalEdgeSlaves();
|
||||
}
|
||||
return globalEdgeNumberingPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::globalMeshData::globalEdgeSlaves() const
|
||||
{
|
||||
if (!globalEdgeSlavesPtr_.valid())
|
||||
{
|
||||
calcGlobalEdgeSlaves();
|
||||
}
|
||||
return globalEdgeSlavesPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::mapDistribute& Foam::globalMeshData::globalEdgeSlavesMap() const
|
||||
{
|
||||
if (!globalEdgeSlavesMapPtr_.valid())
|
||||
{
|
||||
calcGlobalEdgeSlaves();
|
||||
}
|
||||
return globalEdgeSlavesMapPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::globalIndex& Foam::globalMeshData::globalBoundaryFaceNumbering()
|
||||
const
|
||||
{
|
||||
if (!globalBoundaryFaceNumberingPtr_.valid())
|
||||
{
|
||||
calcGlobalPointBoundaryFaces();
|
||||
}
|
||||
return globalBoundaryFaceNumberingPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::globalMeshData::globalPointBoundaryFaces()
|
||||
const
|
||||
{
|
||||
if (!globalPointBoundaryFacesPtr_.valid())
|
||||
{
|
||||
calcGlobalPointBoundaryFaces();
|
||||
}
|
||||
return globalPointBoundaryFacesPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::mapDistribute& Foam::globalMeshData::globalPointBoundaryFacesMap()
|
||||
const
|
||||
{
|
||||
if (!globalPointBoundaryFacesMapPtr_.valid())
|
||||
{
|
||||
calcGlobalPointBoundaryFaces();
|
||||
}
|
||||
return globalPointBoundaryFacesMapPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelList& Foam::globalMeshData::boundaryCells() const
|
||||
{
|
||||
if (!boundaryCellsPtr_.valid())
|
||||
{
|
||||
calcGlobalPointBoundaryCells();
|
||||
}
|
||||
return boundaryCellsPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::globalIndex& Foam::globalMeshData::globalBoundaryCellNumbering()
|
||||
const
|
||||
{
|
||||
if (!globalBoundaryCellNumberingPtr_.valid())
|
||||
{
|
||||
calcGlobalPointBoundaryCells();
|
||||
}
|
||||
return globalBoundaryCellNumberingPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::globalMeshData::globalPointBoundaryCells()
|
||||
const
|
||||
{
|
||||
if (!globalPointBoundaryCellsPtr_.valid())
|
||||
{
|
||||
calcGlobalPointBoundaryCells();
|
||||
}
|
||||
return globalPointBoundaryCellsPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::mapDistribute& Foam::globalMeshData::globalPointBoundaryCellsMap()
|
||||
const
|
||||
{
|
||||
if (!globalPointBoundaryCellsMapPtr_.valid())
|
||||
{
|
||||
calcGlobalPointBoundaryCells();
|
||||
}
|
||||
return globalPointBoundaryCellsMapPtr_();
|
||||
}
|
||||
|
||||
|
||||
void Foam::globalMeshData::movePoints(const pointField& newPoints)
|
||||
{
|
||||
// Topology does not change and we don't store any geometry so nothing
|
||||
@ -740,7 +1483,7 @@ void Foam::globalMeshData::updateMesh()
|
||||
// Option 1. Topological
|
||||
{
|
||||
// Calculate all shared points. This does all the hard work.
|
||||
globalPoints parallelPoints(mesh_);
|
||||
globalPoints parallelPoints(mesh_, false);
|
||||
|
||||
// Copy data out.
|
||||
nGlobalPoints_ = parallelPoints.nGlobalPoints();
|
||||
|
||||
@ -74,10 +74,13 @@ SourceFiles
|
||||
#ifndef globalMeshData_H
|
||||
#define globalMeshData_H
|
||||
|
||||
#include "polyMesh.H"
|
||||
//#include "polyMesh.H"
|
||||
#include "Switch.H"
|
||||
#include "processorTopology.H"
|
||||
#include "labelPair.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "boundBox.H"
|
||||
#include "IOobject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -88,7 +91,10 @@ namespace Foam
|
||||
|
||||
class globalMeshData;
|
||||
Ostream& operator<<(Ostream&, const globalMeshData&);
|
||||
|
||||
class globalIndex;
|
||||
class polyMesh;
|
||||
class mapDistribute;
|
||||
template<class T> class EdgeMap;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class globalMeshData Declaration
|
||||
@ -194,6 +200,39 @@ class globalMeshData
|
||||
mutable labelList* sharedEdgeAddrPtr_;
|
||||
|
||||
|
||||
// Coupled point addressing
|
||||
// This is addressing from coupled point to coupled points,faces,cells
|
||||
// This is a full schedule so includes points only used by two
|
||||
// coupled patches.
|
||||
|
||||
mutable autoPtr<indirectPrimitivePatch> coupledPatchPtr_;
|
||||
|
||||
// Coupled point to coupled points
|
||||
|
||||
mutable autoPtr<globalIndex> globalPointNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointSlavesMapPtr_;
|
||||
|
||||
// Coupled edge to coupled edges
|
||||
|
||||
mutable autoPtr<globalIndex> globalEdgeNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalEdgeSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalEdgeSlavesMapPtr_;
|
||||
|
||||
// Coupled point to boundary faces
|
||||
|
||||
mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
|
||||
|
||||
// Coupled point to boundary cells
|
||||
|
||||
mutable autoPtr<labelList> boundaryCellsPtr_;
|
||||
mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointBoundaryCellsPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointBoundaryCellsMapPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Set up processor patch addressing
|
||||
@ -202,8 +241,8 @@ class globalMeshData
|
||||
//- Helper function for shared edge addressing
|
||||
static void countSharedEdges
|
||||
(
|
||||
const HashTable<labelList, edge, Hash<edge> >& procSharedEdges,
|
||||
HashTable<label, edge, Hash<edge> >&,
|
||||
const EdgeMap<labelList>&,
|
||||
EdgeMap<label>&,
|
||||
label&
|
||||
);
|
||||
|
||||
@ -217,6 +256,22 @@ class globalMeshData
|
||||
const vectorField& separationDist
|
||||
);
|
||||
|
||||
//- Calculate global point addressing.
|
||||
void calcGlobalPointSlaves() const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeSlaves() const;
|
||||
|
||||
//- Calculate coupled point to uncoupled boundary faces. Local only.
|
||||
void calcPointBoundaryFaces(labelListList& pointBoundaryFaces) const;
|
||||
|
||||
//- Calculate global point to global boundary face addressing.
|
||||
void calcGlobalPointBoundaryFaces() const;
|
||||
|
||||
//- Calculate global point to global boundary cell addressing.
|
||||
void calcGlobalPointBoundaryCells() const;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
globalMeshData(const globalMeshData&);
|
||||
|
||||
@ -388,6 +443,47 @@ public:
|
||||
const labelList& sharedEdgeAddr() const;
|
||||
|
||||
|
||||
|
||||
// Global master - slave point communication
|
||||
|
||||
//- Return patch of all coupled faces
|
||||
const indirectPrimitivePatch& coupledPatch() const;
|
||||
|
||||
// Coupled point to coupled points. Coupled points are points on
|
||||
// any coupled patch.
|
||||
|
||||
//- Numbering of coupled points is according to coupledPatch.
|
||||
const globalIndex& globalPointNumbering() const;
|
||||
//- For every coupled point the indices into the field
|
||||
// distributed by below map.
|
||||
const labelListList& globalPointSlaves() const;
|
||||
const mapDistribute& globalPointSlavesMap() const;
|
||||
|
||||
// Coupled edge to coupled edges.
|
||||
|
||||
const globalIndex& globalEdgeNumbering() const;
|
||||
const labelListList& globalEdgeSlaves() const;
|
||||
const mapDistribute& globalEdgeSlavesMap() const;
|
||||
|
||||
// Coupled point to boundary faces. These are uncoupled boundary
|
||||
// faces only but include empty patches.
|
||||
|
||||
//- Numbering of boundary faces is face-mesh.nInternalFaces()
|
||||
const globalIndex& globalBoundaryFaceNumbering() const;
|
||||
const labelListList& globalPointBoundaryFaces() const;
|
||||
const mapDistribute& globalPointBoundaryFacesMap() const;
|
||||
|
||||
// Coupled point to boundary cell
|
||||
|
||||
//- From boundary cell to mesh cell
|
||||
const labelList& boundaryCells() const;
|
||||
|
||||
//- Numbering of boundary cells is according to boundaryCells()
|
||||
const globalIndex& globalBoundaryCellNumbering() const;
|
||||
const labelListList& globalPointBoundaryCells() const;
|
||||
const mapDistribute& globalPointBoundaryCellsMap() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Update for moving points.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -29,9 +29,8 @@ Description
|
||||
Calculates points shared by more than two processor patches or cyclic
|
||||
patches.
|
||||
|
||||
Is used in globalMeshData. (this info is needed for point-edge
|
||||
communication where you do all but these shared points with patch to
|
||||
patch communication but need to do a reduce on these shared points)
|
||||
Is used in globalMeshData. (this info is needed for point/edge
|
||||
communication where processor swaps are not enough to exchange data)
|
||||
|
||||
Works purely topological and using local communication only.
|
||||
Needs:
|
||||
@ -41,8 +40,8 @@ Description
|
||||
- f[0] ordering on patch faces to be ok.
|
||||
|
||||
Works by constructing equivalence lists for all the points on processor
|
||||
patches. These list are procPointList and give processor and meshPoint
|
||||
label on that processor.
|
||||
patches. These list are in globalIndex numbering (so consecutively numbered
|
||||
per processor)
|
||||
E.g.
|
||||
@verbatim
|
||||
((7 93)(4 731)(3 114))
|
||||
@ -85,6 +84,9 @@ Description
|
||||
endloop until nothing changes.
|
||||
|
||||
|
||||
Note: the data held is either mesh point labels (construct from mesh only)
|
||||
or patch point labels (construct from mesh and patch).
|
||||
|
||||
SourceFiles
|
||||
globalPoints.C
|
||||
|
||||
@ -95,11 +97,11 @@ SourceFiles
|
||||
|
||||
#include "DynamicList.H"
|
||||
#include "Map.H"
|
||||
#include "labelList.H"
|
||||
#include "FixedList.H"
|
||||
#include "primitivePatch.H"
|
||||
#include "className.H"
|
||||
#include "edgeList.H"
|
||||
#include "globalIndex.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -119,30 +121,29 @@ class globalPoints
|
||||
{
|
||||
// Private classes
|
||||
|
||||
//- Define procPointList as holding a list of meshPoint/processor labels
|
||||
typedef FixedList<label, 2> procPoint;
|
||||
typedef List<procPoint> procPointList;
|
||||
|
||||
// Private data
|
||||
|
||||
//- Mesh reference
|
||||
const polyMesh& mesh_;
|
||||
|
||||
//- Global numbering of points
|
||||
globalIndex globalIndices_;
|
||||
|
||||
//- Sum of points on processor patches (unfiltered, point on 2 patches
|
||||
// counts as 2)
|
||||
const label nPatchPoints_;
|
||||
|
||||
//- All points on boundaries and their corresponding connected points
|
||||
// on other processors.
|
||||
DynamicList<procPointList> procPoints_;
|
||||
DynamicList<labelList> procPoints_;
|
||||
|
||||
//- Map from mesh point to index in procPoints
|
||||
//- Map from mesh (or patch) point to index in procPoints
|
||||
Map<label> meshToProcPoint_;
|
||||
|
||||
//- Shared points used by this processor (= global point number)
|
||||
labelList sharedPointAddr_;
|
||||
|
||||
//- My meshpoints corresponding to the shared points
|
||||
//- My mesh(or patch) points corresponding to the shared points
|
||||
labelList sharedPointLabels_;
|
||||
|
||||
//- Total number of shared points.
|
||||
@ -155,56 +156,108 @@ class globalPoints
|
||||
// information is collected.
|
||||
static label countPatchPoints(const polyBoundaryMesh&);
|
||||
|
||||
////- Get all faces on coupled patches
|
||||
//static labelListl coupledFaces(const polyBoundaryMesh&);
|
||||
|
||||
//- Add information about patchPointI in relative indices to send
|
||||
// buffers (patchFaces, indexInFace etc.)
|
||||
static void addToSend
|
||||
(
|
||||
const primitivePatch&,
|
||||
const label patchPointI,
|
||||
const procPointList&,
|
||||
const labelList&,
|
||||
DynamicList<label>& patchFaces,
|
||||
DynamicList<label>& indexInFace,
|
||||
DynamicList<procPointList>& allInfo
|
||||
DynamicList<labelList>& allInfo
|
||||
);
|
||||
|
||||
//- Merge info from neighbour into my data
|
||||
static bool mergeInfo
|
||||
(
|
||||
const procPointList& nbrInfo,
|
||||
procPointList& myInfo
|
||||
const labelList& nbrInfo,
|
||||
labelList& myInfo
|
||||
);
|
||||
|
||||
//- From mesh point to 'local point'. Is the mesh point itself
|
||||
// if meshToPatchPoint is empty.
|
||||
static label meshToLocalPoint
|
||||
(
|
||||
const Map<label>& meshToPatchPoint,
|
||||
const label meshPointI
|
||||
);
|
||||
|
||||
//- Opposite of meshToLocalPoint.
|
||||
static label localToMeshPoint
|
||||
(
|
||||
const labelList& patchToMeshPoint,
|
||||
const label localPointI
|
||||
);
|
||||
|
||||
//- Store (and merge) info for meshPointI
|
||||
bool storeInfo(const procPointList& nbrInfo, const label meshPointI);
|
||||
bool storeInfo
|
||||
(
|
||||
const labelList& nbrInfo,
|
||||
const label localPointI
|
||||
);
|
||||
|
||||
//- Initialize procPoints_ to my patch points. allPoints = true:
|
||||
// seed with all patch points, = false: only boundaryPoints().
|
||||
void initOwnPoints(const bool allPoints, labelHashSet& changedPoints);
|
||||
void initOwnPoints
|
||||
(
|
||||
const Map<label>& meshToPatchPoint,
|
||||
const bool allPoints,
|
||||
labelHashSet& changedPoints
|
||||
);
|
||||
|
||||
//- Send subset of procPoints to neighbours
|
||||
void sendPatchPoints(const labelHashSet& changedPoints) const;
|
||||
void sendPatchPoints
|
||||
(
|
||||
const Map<label>&,
|
||||
PstreamBuffers&,
|
||||
const labelHashSet&
|
||||
) const;
|
||||
|
||||
//- Receive neighbour points and merge into my procPoints.
|
||||
void receivePatchPoints(labelHashSet& changedPoints);
|
||||
void receivePatchPoints
|
||||
(
|
||||
const Map<label>&,
|
||||
PstreamBuffers&,
|
||||
labelHashSet&
|
||||
);
|
||||
|
||||
//- Remove entries of size 2 where meshPoint is in provided Map.
|
||||
// Used to remove normal face-face connected points.
|
||||
void remove(const Map<label>&);
|
||||
void remove(const labelList& patchToMeshPoint, const Map<label>&);
|
||||
|
||||
//- Compact out unused elements of procPoints.
|
||||
void compact();
|
||||
|
||||
//- Get indices of point for which I am master (lowest numbered proc)
|
||||
labelList getMasterPoints() const;
|
||||
labelList getMasterPoints(const labelList& patchToMeshPoint) const;
|
||||
|
||||
//- Send subset of shared points to neighbours
|
||||
void sendSharedPoints(const labelList& changedIndices) const;
|
||||
void sendSharedPoints(PstreamBuffers&, const labelList&) const;
|
||||
|
||||
//- Receive shared points and update subset.
|
||||
void receiveSharedPoints(labelList& changedIndices);
|
||||
void receiveSharedPoints
|
||||
(
|
||||
const Map<label>&,
|
||||
PstreamBuffers&,
|
||||
labelList&
|
||||
);
|
||||
|
||||
|
||||
//- Should move into cyclicPolyPatch but some ordering problem
|
||||
//- Should move into cyclicPolyPatch ordering problem
|
||||
// keeps on giving problems.
|
||||
static edgeList coupledPoints(const cyclicPolyPatch&);
|
||||
|
||||
//- Do all calculations.
|
||||
void calculateSharedPoints
|
||||
(
|
||||
const Map<label>&,
|
||||
const labelList&,
|
||||
const bool keepAllPoints
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
globalPoints(const globalPoints&);
|
||||
|
||||
@ -220,36 +273,59 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
globalPoints(const polyMesh& mesh);
|
||||
//- Construct from mesh.
|
||||
// keepAllPoints = false : filter out points that are on two
|
||||
// neighbouring coupled patches (so can be swapped)
|
||||
globalPoints(const polyMesh& mesh, const bool keepAllPoints);
|
||||
|
||||
//- Construct from mesh and patch of coupled faces. Difference with
|
||||
// construct from mesh only is that this stores the meshToProcPoint,
|
||||
// procPoints and sharedPointLabels as patch local point labels
|
||||
// instead of mesh point labels.
|
||||
globalPoints
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const indirectPrimitivePatch& coupledPatch,
|
||||
const bool keepAllPoints
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
label nPatchPoints() const
|
||||
{
|
||||
return nPatchPoints_;
|
||||
}
|
||||
|
||||
//- From (mesh or patch) point to index in procPoints
|
||||
const Map<label>& meshToProcPoint() const
|
||||
{
|
||||
return meshToProcPoint_;
|
||||
}
|
||||
|
||||
//- procPoints is per point the connected points (in global
|
||||
// point numbers)
|
||||
const DynamicList<labelList>& procPoints() const
|
||||
{
|
||||
return procPoints_;
|
||||
}
|
||||
|
||||
//- Global numbering of (mesh or patch) points
|
||||
const globalIndex& globalIndices() const
|
||||
{
|
||||
return globalIndices_;
|
||||
}
|
||||
|
||||
//- shared points used by this processor (= global point number)
|
||||
const labelList& sharedPointAddr() const
|
||||
{
|
||||
return sharedPointAddr_;
|
||||
}
|
||||
|
||||
//- my meshpoints corresponding to the shared points
|
||||
//- my (mesh or patch)points corresponding to the shared points
|
||||
const labelList& sharedPointLabels() const
|
||||
{
|
||||
return sharedPointLabels_;
|
||||
}
|
||||
|
||||
//- total number of shared points
|
||||
label nGlobalPoints() const
|
||||
{
|
||||
return nGlobalPoints_;
|
||||
|
||||
Reference in New Issue
Block a user