Merge commit '9bd721da3e43cb8da8c6dfbc9b264bd30374bd72' into nextRelease
This commit is contained in:
commit
6a78019898
3 changed files with 77 additions and 125 deletions
|
@ -38,52 +38,30 @@ using namespace Foam;
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
// Global patch combination class
|
// Global patch table combination class
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class globalPatchCombine
|
class globalPatchTableCombine
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
typedef HashTable<label, Type, Hash<Type> > HashTableType;
|
||||||
|
|
||||||
void operator()
|
void operator()
|
||||||
(
|
(
|
||||||
SLList<Type>& globalObjects,
|
HashTableType& globalObject,
|
||||||
const SLList<Type>& myObjects
|
const HashTableType& myObject
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// For each of my points check whether it exists in the global
|
label mySize = globalObject.size();
|
||||||
// points list; if not, add it to the global points
|
|
||||||
|
|
||||||
for
|
forAllConstIter (typename HashTableType, myObject, iter)
|
||||||
(
|
|
||||||
typename SLList<Type>::const_iterator myObjectsIter =
|
|
||||||
myObjects.begin();
|
|
||||||
myObjectsIter != myObjects.end();
|
|
||||||
++myObjectsIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const Type& curMyType = myObjectsIter();
|
const Type& myCurType = iter.key();
|
||||||
|
|
||||||
bool found = false;
|
if (!globalObject.found(myCurType))
|
||||||
|
|
||||||
for
|
|
||||||
(
|
|
||||||
typename SLList<Type>::iterator globalObjectsIter =
|
|
||||||
globalObjects.begin();
|
|
||||||
globalObjectsIter != globalObjects.end();
|
|
||||||
++globalObjectsIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (globalObjectsIter() == curMyType)
|
globalObject.insert(myCurType, mySize++);
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
globalObjects.append(curMyType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,52 +167,56 @@ void Foam::tetPolyMesh::addParallelPointPatch()
|
||||||
// Get the list of local parallel processor edges
|
// Get the list of local parallel processor edges
|
||||||
const edgeList& localParEdges = parallelEdges();
|
const edgeList& localParEdges = parallelEdges();
|
||||||
|
|
||||||
// Extract global numbers for each of the parallel edges
|
// Label to store global parallel edges count
|
||||||
SLList<edge> globalParEdges;
|
label nGlobalParEdges = 0;
|
||||||
|
|
||||||
forAll (localParEdges, edgeI)
|
|
||||||
{
|
|
||||||
globalParEdges.append
|
|
||||||
(
|
|
||||||
edge
|
|
||||||
(
|
|
||||||
pointProcAddressing[localParEdges[edgeI].start()],
|
|
||||||
pointProcAddressing[localParEdges[edgeI].end()]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the local-to-global edge mapping
|
// Create the local-to-global edge mapping
|
||||||
labelList localEdgeMapping(localParEdges.size(), -1);
|
labelList localEdgeMapping(localParEdges.size(), -1);
|
||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
// Create a global list of edges by reduction from all processors
|
// Global numbers for each of the parallel edges
|
||||||
combineReduce(globalParEdges, globalPatchCombine<edge>());
|
HashTable<label, edge, Hash<edge> > globalParEdgesTable;
|
||||||
|
|
||||||
// Find out which of the parallel edges are local. For
|
|
||||||
// easier search indexing make a plain list out ot the
|
|
||||||
// singly linked list of global edges
|
|
||||||
edgeList ge(globalParEdges);
|
|
||||||
|
|
||||||
|
// Insert local parallel edges
|
||||||
forAll (localParEdges, edgeI)
|
forAll (localParEdges, edgeI)
|
||||||
{
|
{
|
||||||
edge curGlobal =
|
globalParEdgesTable.insert
|
||||||
|
(
|
||||||
|
edge
|
||||||
|
(
|
||||||
|
pointProcAddressing[localParEdges[edgeI].start()],
|
||||||
|
pointProcAddressing[localParEdges[edgeI].end()]
|
||||||
|
),
|
||||||
|
edgeI
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a global set of edges by reduction from all processors
|
||||||
|
combineReduce
|
||||||
|
(
|
||||||
|
globalParEdgesTable,
|
||||||
|
globalPatchTableCombine<edge>()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Find out which of the parallel edges are local
|
||||||
|
forAll (localParEdges, edgeI)
|
||||||
|
{
|
||||||
|
edge curGlobalEdge =
|
||||||
edge
|
edge
|
||||||
(
|
(
|
||||||
pointProcAddressing[localParEdges[edgeI].start()],
|
pointProcAddressing[localParEdges[edgeI].start()],
|
||||||
pointProcAddressing[localParEdges[edgeI].end()]
|
pointProcAddressing[localParEdges[edgeI].end()]
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll (ge, geI)
|
localEdgeMapping[edgeI] = globalParEdgesTable[curGlobalEdge];
|
||||||
{
|
|
||||||
if (curGlobal == ge[geI])
|
|
||||||
{
|
|
||||||
localEdgeMapping[edgeI] = geI;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store global parallel edges count
|
||||||
|
nGlobalParEdges = globalParEdgesTable.size();
|
||||||
|
|
||||||
|
// Clear global parallel edge table
|
||||||
|
globalParEdgesTable.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug check
|
// Debug check
|
||||||
|
@ -291,11 +273,13 @@ void Foam::tetPolyMesh::addParallelPointPatch()
|
||||||
const unallocLabelList& L = lduAddr().lowerAddr();
|
const unallocLabelList& L = lduAddr().lowerAddr();
|
||||||
const unallocLabelList& U = lduAddr().upperAddr();
|
const unallocLabelList& U = lduAddr().upperAddr();
|
||||||
|
|
||||||
|
labelHashSet localParPointsSet(localParPoints);
|
||||||
|
|
||||||
forAll (localParPoints, pointI)
|
forAll (localParPoints, pointI)
|
||||||
{
|
{
|
||||||
const label curPoint = localParPoints[pointI];
|
const label curPoint = localParPoints[pointI];
|
||||||
|
|
||||||
labelList curEdges = edgesForPoint(localParPoints[pointI]);
|
labelList curEdges = edgesForPoint(curPoint);
|
||||||
|
|
||||||
forAll (curEdges, edgeI)
|
forAll (curEdges, edgeI)
|
||||||
{
|
{
|
||||||
|
@ -311,19 +295,9 @@ void Foam::tetPolyMesh::addParallelPointPatch()
|
||||||
otherEnd = e.start();
|
otherEnd = e.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the other end is not a local point, this is a cut edge
|
// If the other end is not a local point,
|
||||||
bool found = false;
|
// this is a cut edge
|
||||||
|
if (!localParPointsSet.found(otherEnd))
|
||||||
forAll (localParPoints, compI)
|
|
||||||
{
|
|
||||||
if (localParPoints[compI] == otherEnd)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
{
|
{
|
||||||
// This is a cut edge. Add it to the list
|
// This is a cut edge. Add it to the list
|
||||||
localCutEdges[nCutEdges] = e;
|
localCutEdges[nCutEdges] = e;
|
||||||
|
@ -332,6 +306,9 @@ void Foam::tetPolyMesh::addParallelPointPatch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear parallel points set
|
||||||
|
localParPointsSet.clear();
|
||||||
|
|
||||||
// Reset the size of the local cut edge list
|
// Reset the size of the local cut edge list
|
||||||
localCutEdges.setSize(nCutEdges);
|
localCutEdges.setSize(nCutEdges);
|
||||||
|
|
||||||
|
@ -350,11 +327,11 @@ void Foam::tetPolyMesh::addParallelPointPatch()
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
// Master's mask is always one. Add all edges to the list
|
// Master's mask is always one. Add all edges to the list
|
||||||
SLList<edge> globalCutEdges;
|
HashSet<edge, Hash<edge> > globalCutEdgesSet;
|
||||||
|
|
||||||
forAll (localCutEdges, edgeI)
|
forAll (localCutEdges, edgeI)
|
||||||
{
|
{
|
||||||
globalCutEdges.append
|
globalCutEdgesSet.insert
|
||||||
(
|
(
|
||||||
edge
|
edge
|
||||||
(
|
(
|
||||||
|
@ -371,7 +348,7 @@ void Foam::tetPolyMesh::addParallelPointPatch()
|
||||||
Pstream::firstSlave()
|
Pstream::firstSlave()
|
||||||
);
|
);
|
||||||
|
|
||||||
toFirstSlave << globalCutEdges;
|
toFirstSlave << globalCutEdgesSet;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -398,7 +375,7 @@ void Foam::tetPolyMesh::addParallelPointPatch()
|
||||||
|
|
||||||
IPstream rf(Pstream::blocking, receiveFrom);
|
IPstream rf(Pstream::blocking, receiveFrom);
|
||||||
|
|
||||||
SLList<edge> globalCutEdges(rf);
|
HashSet<edge, Hash<edge> > globalCutEdgesSet(rf);
|
||||||
|
|
||||||
// Check local cut edges against the list
|
// Check local cut edges against the list
|
||||||
forAll (localCutEdges, edgeI)
|
forAll (localCutEdges, edgeI)
|
||||||
|
@ -410,24 +387,7 @@ void Foam::tetPolyMesh::addParallelPointPatch()
|
||||||
pointProcAddressing[localCutEdges[edgeI].end()]
|
pointProcAddressing[localCutEdges[edgeI].end()]
|
||||||
);
|
);
|
||||||
|
|
||||||
bool found = false;
|
if (globalCutEdgesSet.found(e))
|
||||||
|
|
||||||
for
|
|
||||||
(
|
|
||||||
SLList<edge>::iterator gEdgeIter =
|
|
||||||
globalCutEdges.begin();
|
|
||||||
gEdgeIter != globalCutEdges.end();
|
|
||||||
++gEdgeIter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (gEdgeIter() == e)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found)
|
|
||||||
{
|
{
|
||||||
// Edge already exists. Set mask to zero
|
// Edge already exists. Set mask to zero
|
||||||
localCutEdgeMask[edgeI] = 0;
|
localCutEdgeMask[edgeI] = 0;
|
||||||
|
@ -435,15 +395,15 @@ void Foam::tetPolyMesh::addParallelPointPatch()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Edge not found. Add it to the list
|
// Edge not found. Add it to the list
|
||||||
globalCutEdges.append(e);
|
globalCutEdgesSet.insert(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-transmit the list to the next processor
|
// Re-transmit the list to the next processor
|
||||||
if (slave < Pstream::lastSlave())
|
if (slave < Pstream::lastSlave())
|
||||||
{
|
{
|
||||||
OPstream passOnEdges(Pstream::blocking, sendTo);
|
OPstream st(Pstream::blocking, sendTo);
|
||||||
passOnEdges << globalCutEdges;
|
st << globalCutEdgesSet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -461,7 +421,7 @@ void Foam::tetPolyMesh::addParallelPointPatch()
|
||||||
mesh_.globalData().nGlobalPoints(),
|
mesh_.globalData().nGlobalPoints(),
|
||||||
localParPoints,
|
localParPoints,
|
||||||
mesh_.globalData().sharedPointAddr(),
|
mesh_.globalData().sharedPointAddr(),
|
||||||
globalParEdges.size(),
|
nGlobalParEdges,
|
||||||
localParEdges,
|
localParEdges,
|
||||||
localEdgeMapping,
|
localEdgeMapping,
|
||||||
localCutEdges,
|
localCutEdges,
|
||||||
|
|
|
@ -85,7 +85,7 @@ void Foam::tetPolyMesh::calcParPointData() const
|
||||||
// parallel points. The list will have duplicates, which need
|
// parallel points. The list will have duplicates, which need
|
||||||
// to be eliminated
|
// to be eliminated
|
||||||
|
|
||||||
SLList<edge> parEdges;
|
HashSet<edge, Hash<edge> > parEdgesSet;
|
||||||
|
|
||||||
forAll (mesh_.boundaryMesh(), patchI)
|
forAll (mesh_.boundaryMesh(), patchI)
|
||||||
{
|
{
|
||||||
|
@ -110,26 +110,9 @@ void Foam::tetPolyMesh::calcParPointData() const
|
||||||
edge newEdge = edge(p[e[eI].start()], p[e[eI].end()]);
|
edge newEdge = edge(p[e[eI].start()], p[e[eI].end()]);
|
||||||
|
|
||||||
// Check if the edge is already on the list
|
// Check if the edge is already on the list
|
||||||
bool found = false;
|
if (!parEdgesSet.found(newEdge))
|
||||||
|
|
||||||
for
|
|
||||||
(
|
|
||||||
SLList<edge>::iterator parEIter =
|
|
||||||
parEdges.begin();
|
|
||||||
parEIter != parEdges.end();
|
|
||||||
++parEIter
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (parEIter() == newEdge)
|
parEdgesSet.insert(newEdge);
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
|
||||||
{
|
|
||||||
parEdges.append(newEdge);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +120,7 @@ void Foam::tetPolyMesh::calcParPointData() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-pack the list
|
// Re-pack the list
|
||||||
parEdgesPtr_ = new edgeList(parEdges);
|
parEdgesPtr_ = new edgeList(parEdgesSet.toc());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,10 @@ Description
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
defineTypeNameAndDebug(Foam::tetPolyMesh, 0);
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(tetPolyMesh, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
@ -88,6 +91,12 @@ tetPolyMesh::tetPolyMesh(const polyMesh& pMesh)
|
||||||
}
|
}
|
||||||
|
|
||||||
addParallelPointPatch();
|
addParallelPointPatch();
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "tetPolyMesh::tetPolyMesh(const polyMesh&) : "
|
||||||
|
<< "Finished creating tetPolyMesh" << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue