mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' into cvm
Conflicts: applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C src/edgeMesh/Make/files src/edgeMesh/featureEdgeMesh/featureEdgeMesh.C src/edgeMesh/featureEdgeMesh/featureEdgeMesh.H
This commit is contained in:
@ -398,7 +398,15 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// Create global cell numbers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
label nAgglom = max(agglom)+1;
|
||||
label nAgglom;
|
||||
if (agglom.size())
|
||||
{
|
||||
nAgglom = max(agglom)+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nAgglom = 0;
|
||||
}
|
||||
globalIndex globalAgglom(nAgglom);
|
||||
|
||||
const labelList& faceOwner = mesh.faceOwner();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "simpleGeomDecomp.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "SortableList.H"
|
||||
#include "globalIndex.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,7 +54,7 @@ void Foam::simpleGeomDecomp::assignToProcessorGroup
|
||||
(
|
||||
labelList& processorGroup,
|
||||
const label nProcGroup
|
||||
)
|
||||
) const
|
||||
{
|
||||
label jump = processorGroup.size()/nProcGroup;
|
||||
label jumpb = jump + 1;
|
||||
@ -90,7 +91,7 @@ void Foam::simpleGeomDecomp::assignToProcessorGroup
|
||||
const labelList& indices,
|
||||
const scalarField& weights,
|
||||
const scalar summedWeights
|
||||
)
|
||||
) const
|
||||
{
|
||||
// This routine gets the sorted points.
|
||||
// Easiest to explain with an example.
|
||||
@ -126,7 +127,10 @@ void Foam::simpleGeomDecomp::assignToProcessorGroup
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::simpleGeomDecomp::decompose(const pointField& points)
|
||||
Foam::labelList Foam::simpleGeomDecomp::decomposeOneProc
|
||||
(
|
||||
const pointField& points
|
||||
) const
|
||||
{
|
||||
// construct a list for the final result
|
||||
labelList finalDecomp(points.size());
|
||||
@ -195,11 +199,11 @@ Foam::labelList Foam::simpleGeomDecomp::decompose(const pointField& points)
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
Foam::labelList Foam::simpleGeomDecomp::decomposeOneProc
|
||||
(
|
||||
const pointField& points,
|
||||
const scalarField& weights
|
||||
)
|
||||
) const
|
||||
{
|
||||
// construct a list for the final result
|
||||
labelList finalDecomp(points.size());
|
||||
@ -300,4 +304,162 @@ Foam::simpleGeomDecomp::simpleGeomDecomp(const dictionary& decompositionDict)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
(
|
||||
const pointField& points
|
||||
)
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
return decomposeOneProc(points);
|
||||
}
|
||||
else
|
||||
{
|
||||
globalIndex globalNumbers(points.size());
|
||||
|
||||
// Collect all points on master
|
||||
if (Pstream::master())
|
||||
{
|
||||
pointField allPoints(globalNumbers.size());
|
||||
|
||||
label nTotalPoints = 0;
|
||||
// Master first
|
||||
SubField<point>(allPoints, points.size()).assign(points);
|
||||
nTotalPoints += points.size();
|
||||
|
||||
// Add slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
pointField nbrPoints(fromSlave);
|
||||
SubField<point>
|
||||
(
|
||||
allPoints,
|
||||
nbrPoints.size(),
|
||||
nTotalPoints
|
||||
).assign(nbrPoints);
|
||||
nTotalPoints += nbrPoints.size();
|
||||
}
|
||||
|
||||
// Decompose
|
||||
labelList finalDecomp(decomposeOneProc(allPoints));
|
||||
|
||||
// Send back
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
OPstream toSlave(Pstream::scheduled, slave);
|
||||
toSlave << SubField<label>
|
||||
(
|
||||
finalDecomp,
|
||||
globalNumbers.localSize(slave),
|
||||
globalNumbers.offset(slave)
|
||||
);
|
||||
}
|
||||
// Get my own part
|
||||
finalDecomp.setSize(points.size());
|
||||
|
||||
return finalDecomp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Send my points
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< points;
|
||||
}
|
||||
|
||||
// Receive back decomposition
|
||||
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
labelList finalDecomp(fromMaster);
|
||||
|
||||
return finalDecomp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
(
|
||||
const pointField& points,
|
||||
const scalarField& weights
|
||||
)
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
return decomposeOneProc(points, weights);
|
||||
}
|
||||
else
|
||||
{
|
||||
globalIndex globalNumbers(points.size());
|
||||
|
||||
// Collect all points on master
|
||||
if (Pstream::master())
|
||||
{
|
||||
pointField allPoints(globalNumbers.size());
|
||||
scalarField allWeights(allPoints.size());
|
||||
|
||||
label nTotalPoints = 0;
|
||||
// Master first
|
||||
SubField<point>(allPoints, points.size()).assign(points);
|
||||
SubField<scalar>(allWeights, points.size()).assign(weights);
|
||||
nTotalPoints += points.size();
|
||||
|
||||
// Add slaves
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
pointField nbrPoints(fromSlave);
|
||||
scalarField nbrWeights(fromSlave);
|
||||
SubField<point>
|
||||
(
|
||||
allPoints,
|
||||
nbrPoints.size(),
|
||||
nTotalPoints
|
||||
).assign(nbrPoints);
|
||||
SubField<scalar>
|
||||
(
|
||||
allWeights,
|
||||
nbrWeights.size(),
|
||||
nTotalPoints
|
||||
).assign(nbrWeights);
|
||||
nTotalPoints += nbrPoints.size();
|
||||
}
|
||||
|
||||
// Decompose
|
||||
labelList finalDecomp(decomposeOneProc(allPoints, allWeights));
|
||||
|
||||
// Send back
|
||||
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||
{
|
||||
OPstream toSlave(Pstream::scheduled, slave);
|
||||
toSlave << SubField<label>
|
||||
(
|
||||
finalDecomp,
|
||||
globalNumbers.localSize(slave),
|
||||
globalNumbers.offset(slave)
|
||||
);
|
||||
}
|
||||
// Get my own part
|
||||
finalDecomp.setSize(points.size());
|
||||
|
||||
return finalDecomp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Send my points
|
||||
{
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster<< points << weights;
|
||||
}
|
||||
|
||||
// Receive back decomposition
|
||||
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
labelList finalDecomp(fromMaster);
|
||||
|
||||
return finalDecomp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,7 +49,7 @@ class simpleGeomDecomp
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
void assignToProcessorGroup(labelList& processorGroup, const label);
|
||||
void assignToProcessorGroup(labelList&, const label) const;
|
||||
|
||||
void assignToProcessorGroup
|
||||
(
|
||||
@ -58,7 +58,15 @@ class simpleGeomDecomp
|
||||
const labelList& indices,
|
||||
const scalarField& weights,
|
||||
const scalar summedWeights
|
||||
);
|
||||
) const;
|
||||
|
||||
labelList decomposeOneProc(const pointField& points) const;
|
||||
|
||||
labelList decomposeOneProc
|
||||
(
|
||||
const pointField& points,
|
||||
const scalarField& weights
|
||||
) const;
|
||||
|
||||
//- Disallow default bitwise copy construct and assignment
|
||||
void operator=(const simpleGeomDecomp&);
|
||||
@ -86,9 +94,9 @@ public:
|
||||
|
||||
virtual bool parallelAware() const
|
||||
{
|
||||
// simpleDecomp does not attempt to do anything across proc
|
||||
// boundaries
|
||||
return false;
|
||||
// simpleDecomp sends all points to the master which does
|
||||
// the decomposition.
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual labelList decompose(const pointField&);
|
||||
|
||||
Reference in New Issue
Block a user