mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: simplify calling of decomposition, support CompactListList
- combined most of the unweighted and weighted decomposition routines such that an empty weight field is treated as uniform weighting. This allows default parameters and cuts down on the number of decompose methods. - for topology-driven decomposition, it is now possible to pass in the owner/neighbour connectivity as a CompactListList directly instead of first creating a labelListList (which was internally repacked into a CompactListList in many cases). However, multiLevelDecomp still uses unpacking (to avoid a larger reworking of code). - support direct creation of some methods (eg, random, scotch etc) without a dictionary - fix incorrect neighbour face weighting (fixes #3019) ENH: relocate calcCellCells from decompositionMethod to globalMeshData - makes it more universally available
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,6 +40,7 @@ Description
|
|||||||
#include "cpuTime.H"
|
#include "cpuTime.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "regionProperties.H"
|
#include "regionProperties.H"
|
||||||
|
#include "globalMeshData.H"
|
||||||
#include "decompositionInformation.H"
|
#include "decompositionInformation.H"
|
||||||
#include "decompositionModel.H"
|
#include "decompositionModel.H"
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ int main(int argc, char *argv[])
|
|||||||
const label nDomains = max(cellToProc) + 1;
|
const label nDomains = max(cellToProc) + 1;
|
||||||
|
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
decompositionMethod::calcCellCells
|
globalMeshData::calcCellCells
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
identity(mesh.nCells()),
|
identity(mesh.nCells()),
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +27,7 @@ License
|
|||||||
|
|
||||||
#include "domainDecompositionDryRun.H"
|
#include "domainDecompositionDryRun.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
#include "globalMeshData.H"
|
||||||
#include "decompositionModel.H"
|
#include "decompositionModel.H"
|
||||||
#include "decompositionInformation.H"
|
#include "decompositionInformation.H"
|
||||||
|
|
||||||
@ -112,12 +113,12 @@ void Foam::domainDecompositionDryRun::execute
|
|||||||
decompositionMethod& method = model.decomposer();
|
decompositionMethod& method = model.decomposer();
|
||||||
|
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
decompositionMethod::calcCellCells
|
globalMeshData::calcCellCells
|
||||||
(
|
(
|
||||||
mesh_,
|
mesh_,
|
||||||
identity(mesh_.nCells()),
|
identity(mesh_.nCells()),
|
||||||
mesh_.nCells(),
|
mesh_.nCells(),
|
||||||
false,
|
false, // false = local only
|
||||||
cellCells
|
cellCells
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -614,6 +614,7 @@ $(polyBoundaryMesh)/polyBoundaryMeshEntries.C
|
|||||||
|
|
||||||
globalMeshData = $(polyMesh)/globalMeshData
|
globalMeshData = $(polyMesh)/globalMeshData
|
||||||
$(globalMeshData)/globalMeshData.C
|
$(globalMeshData)/globalMeshData.C
|
||||||
|
$(globalMeshData)/globalMeshDataTopology.C
|
||||||
$(globalMeshData)/globalPoints.C
|
$(globalMeshData)/globalPoints.C
|
||||||
|
|
||||||
$(polyMesh)/syncTools/syncTools.C
|
$(polyMesh)/syncTools/syncTools.C
|
||||||
|
|||||||
@ -96,6 +96,7 @@ namespace Foam
|
|||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
class polyMesh;
|
class polyMesh;
|
||||||
class mapDistribute;
|
class mapDistribute;
|
||||||
|
template<class T> class CompactListList;
|
||||||
template<class T> class EdgeMap;
|
template<class T> class EdgeMap;
|
||||||
class globalIndex;
|
class globalIndex;
|
||||||
class globalIndexAndTransform;
|
class globalIndexAndTransform;
|
||||||
@ -305,6 +306,9 @@ class globalMeshData
|
|||||||
|
|
||||||
void calcGlobalCoPointSlaves() const;
|
void calcGlobalCoPointSlaves() const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
globalMeshData(const globalMeshData&) = delete;
|
globalMeshData(const globalMeshData&) = delete;
|
||||||
@ -313,8 +317,6 @@ class globalMeshData
|
|||||||
void operator=(const globalMeshData&) = delete;
|
void operator=(const globalMeshData&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
ClassName("globalMeshData");
|
ClassName("globalMeshData");
|
||||||
|
|
||||||
@ -606,6 +608,39 @@ public:
|
|||||||
// full parallel analysis to determine shared points and
|
// full parallel analysis to determine shared points and
|
||||||
// boundaries.
|
// boundaries.
|
||||||
void updateMesh();
|
void updateMesh();
|
||||||
|
|
||||||
|
|
||||||
|
// Mesh Topology Calculation
|
||||||
|
|
||||||
|
//- Determine (local or global) cellCells from mesh agglomeration.
|
||||||
|
// Agglomeration is local to the processor.
|
||||||
|
// - parallel = false
|
||||||
|
// Resulting connections are in local cell indices.
|
||||||
|
// Coupled across cyclics but not processor patches.
|
||||||
|
// - parallel = true
|
||||||
|
// Resulting connections are in global cell indices.
|
||||||
|
// Coupled across cyclics and processor patches.
|
||||||
|
static void calcCellCells
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const labelList& agglom,
|
||||||
|
const label nLocalCoarse,
|
||||||
|
const bool parallel, //!< Use global cell ids in parallel
|
||||||
|
CompactListList<label>& cellCells
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Determine (local or global) cellCells and face weights
|
||||||
|
//- from mesh agglomeration.
|
||||||
|
// Uses mag of faceArea as weights
|
||||||
|
static void calcCellCells
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const labelList& agglom,
|
||||||
|
const label nLocalCoarse,
|
||||||
|
const bool parallel, //!< Use global cell ids in parallel
|
||||||
|
CompactListList<label>& cellCells,
|
||||||
|
CompactListList<scalar>& cellCellWeights
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,401 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "globalMeshData.H"
|
||||||
|
#include "globalIndex.H"
|
||||||
|
#include "CompactListList.H"
|
||||||
|
#include "processorPolyPatch.H"
|
||||||
|
#include "syncTools.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::globalMeshData::calcCellCells
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const labelList& agglom,
|
||||||
|
const label nLocalCoarse,
|
||||||
|
const bool parallel,
|
||||||
|
CompactListList<label>& cellCells
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const labelList& faceOwner = mesh.faceOwner();
|
||||||
|
const labelList& faceNeigh = mesh.faceNeighbour();
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
// FUTURE? treat empty agglomeration like an identity map
|
||||||
|
|
||||||
|
// Global cell numbers (agglomerated numbering)
|
||||||
|
const label myProci = UPstream::myProcNo(UPstream::worldComm);
|
||||||
|
const globalIndex globalAgglom(nLocalCoarse, UPstream::worldComm, parallel);
|
||||||
|
|
||||||
|
|
||||||
|
// The agglomerated owner per boundary faces (global numbering)
|
||||||
|
// from the other side (of coupled patches)
|
||||||
|
|
||||||
|
labelList globalNeighbour(agglom, pbm.faceOwner());
|
||||||
|
globalAgglom.inplaceToGlobal(myProci, globalNeighbour);
|
||||||
|
syncTools::swapBoundaryFaceList(mesh, globalNeighbour);
|
||||||
|
|
||||||
|
|
||||||
|
// Count number of faces (internal + coupled)
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
// Number of faces per coarse cell
|
||||||
|
labelList nFacesPerCell(nLocalCoarse, Zero);
|
||||||
|
|
||||||
|
for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
|
||||||
|
{
|
||||||
|
const label own = agglom[faceOwner[facei]];
|
||||||
|
const label nei = agglom[faceNeigh[facei]];
|
||||||
|
|
||||||
|
++nFacesPerCell[own];
|
||||||
|
++nFacesPerCell[nei];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const polyPatch& pp : pbm)
|
||||||
|
{
|
||||||
|
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||||
|
{
|
||||||
|
label bFacei = pp.start()-mesh.nInternalFaces();
|
||||||
|
|
||||||
|
for (const label facei : pp.range())
|
||||||
|
{
|
||||||
|
const label own = agglom[faceOwner[facei]];
|
||||||
|
const label globalNei = globalNeighbour[bFacei];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!globalAgglom.isLocal(myProci, globalNei)
|
||||||
|
|| globalAgglom.toLocal(myProci, globalNei) != own
|
||||||
|
)
|
||||||
|
{
|
||||||
|
++nFacesPerCell[own];
|
||||||
|
}
|
||||||
|
|
||||||
|
++bFacei;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Fill in offset and data
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
cellCells.resize_nocopy(nFacesPerCell);
|
||||||
|
|
||||||
|
nFacesPerCell = 0; // Restart the count
|
||||||
|
|
||||||
|
labelList& m = cellCells.values();
|
||||||
|
const labelList& offsets = cellCells.offsets();
|
||||||
|
|
||||||
|
// For internal faces is just offsetted owner and neighbour
|
||||||
|
for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
|
||||||
|
{
|
||||||
|
const label own = agglom[faceOwner[facei]];
|
||||||
|
const label nei = agglom[faceNeigh[facei]];
|
||||||
|
|
||||||
|
const label ownIndex = offsets[own] + nFacesPerCell[own]++;
|
||||||
|
const label neiIndex = offsets[nei] + nFacesPerCell[nei]++;
|
||||||
|
|
||||||
|
m[ownIndex] = globalAgglom.toGlobal(myProci, nei);
|
||||||
|
m[neiIndex] = globalAgglom.toGlobal(myProci, own);
|
||||||
|
}
|
||||||
|
|
||||||
|
// For boundary faces is offsetted coupled neighbour
|
||||||
|
for (const polyPatch& pp : pbm)
|
||||||
|
{
|
||||||
|
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||||
|
{
|
||||||
|
label bFacei = pp.start()-mesh.nInternalFaces();
|
||||||
|
|
||||||
|
for (const label facei : pp.range())
|
||||||
|
{
|
||||||
|
const label own = agglom[faceOwner[facei]];
|
||||||
|
const label globalNei = globalNeighbour[bFacei];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!globalAgglom.isLocal(myProci, globalNei)
|
||||||
|
|| globalAgglom.toLocal(myProci, globalNei) != own
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label ownIndex = offsets[own] + nFacesPerCell[own]++;
|
||||||
|
|
||||||
|
m[ownIndex] = globalNei;
|
||||||
|
}
|
||||||
|
|
||||||
|
++bFacei;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check for duplicates connections between cells
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// Done as postprocessing step since we now have cellCells.
|
||||||
|
|
||||||
|
// NB: Because of agglomeration, self-connections will occur
|
||||||
|
// and must be filtered out.
|
||||||
|
|
||||||
|
if (!cellCells.empty())
|
||||||
|
{
|
||||||
|
label newIndex = 0;
|
||||||
|
labelHashSet nbrCells;
|
||||||
|
|
||||||
|
labelList& m = cellCells.values();
|
||||||
|
labelList& offsets = cellCells.offsets();
|
||||||
|
|
||||||
|
label startIndex = offsets[0];
|
||||||
|
|
||||||
|
const label nCellCells = cellCells.size();
|
||||||
|
|
||||||
|
for (label celli = 0; celli < nCellCells; ++celli)
|
||||||
|
{
|
||||||
|
// Could be done as combination of std::sort, std::unique_copy
|
||||||
|
// except need to block out 'self' and std::copy_if/remove_if
|
||||||
|
// are undefined for overlapping regions
|
||||||
|
|
||||||
|
const label self = globalAgglom.toGlobal(myProci, celli);
|
||||||
|
|
||||||
|
nbrCells.clear();
|
||||||
|
nbrCells.insert(self);
|
||||||
|
|
||||||
|
const label endIndex = offsets[celli+1];
|
||||||
|
|
||||||
|
for (label i = startIndex; i < endIndex; ++i)
|
||||||
|
{
|
||||||
|
if (nbrCells.insert(m[i]))
|
||||||
|
{
|
||||||
|
m[newIndex] = m[i];
|
||||||
|
++newIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
startIndex = endIndex;
|
||||||
|
offsets[celli+1] = newIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
m.resize(newIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
//forAll(cellCells, celli)
|
||||||
|
//{
|
||||||
|
// Pout<< "Original: Coarse cell " << celli << endl;
|
||||||
|
// forAll(mesh.cellCells()[celli], i)
|
||||||
|
// {
|
||||||
|
// Pout<< " nbr:" << mesh.cellCells()[celli][i] << endl;
|
||||||
|
// }
|
||||||
|
// Pout<< "Compacted: Coarse cell " << celli << endl;
|
||||||
|
// const labelUList cCells = cellCells[celli];
|
||||||
|
// forAll(cCells, i)
|
||||||
|
// {
|
||||||
|
// Pout<< " nbr:" << cCells[i] << endl;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::globalMeshData::calcCellCells
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const labelList& agglom,
|
||||||
|
const label nLocalCoarse,
|
||||||
|
const bool parallel,
|
||||||
|
CompactListList<label>& cellCells,
|
||||||
|
CompactListList<scalar>& cellCellWeights
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const labelList& faceOwner = mesh.faceOwner();
|
||||||
|
const labelList& faceNeigh = mesh.faceNeighbour();
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
// FUTURE? treat empty agglomeration like an identity map
|
||||||
|
|
||||||
|
// Global cell numbers (agglomerated numbering)
|
||||||
|
const label myProci = UPstream::myProcNo(UPstream::worldComm);
|
||||||
|
const globalIndex globalAgglom(nLocalCoarse, UPstream::worldComm, parallel);
|
||||||
|
|
||||||
|
|
||||||
|
// The agglomerated owner per boundary faces (global numbering)
|
||||||
|
// from the other side (of coupled patches)
|
||||||
|
|
||||||
|
labelList globalNeighbour(agglom, pbm.faceOwner());
|
||||||
|
globalAgglom.inplaceToGlobal(myProci, globalNeighbour);
|
||||||
|
syncTools::swapBoundaryFaceList(mesh, globalNeighbour);
|
||||||
|
|
||||||
|
|
||||||
|
// Count number of faces (internal + coupled)
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
// Number of faces per coarse cell
|
||||||
|
labelList nFacesPerCell(nLocalCoarse, Zero);
|
||||||
|
|
||||||
|
for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
|
||||||
|
{
|
||||||
|
const label own = agglom[faceOwner[facei]];
|
||||||
|
const label nei = agglom[faceNeigh[facei]];
|
||||||
|
|
||||||
|
++nFacesPerCell[own];
|
||||||
|
++nFacesPerCell[nei];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const polyPatch& pp : pbm)
|
||||||
|
{
|
||||||
|
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||||
|
{
|
||||||
|
label bFacei = pp.start()-mesh.nInternalFaces();
|
||||||
|
|
||||||
|
for (const label facei : pp.range())
|
||||||
|
{
|
||||||
|
const label own = agglom[faceOwner[facei]];
|
||||||
|
const label globalNei = globalNeighbour[bFacei];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!globalAgglom.isLocal(myProci, globalNei)
|
||||||
|
|| globalAgglom.toLocal(myProci, globalNei) != own
|
||||||
|
)
|
||||||
|
{
|
||||||
|
++nFacesPerCell[own];
|
||||||
|
}
|
||||||
|
|
||||||
|
++bFacei;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Fill in offset and data
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
cellCells.resize_nocopy(nFacesPerCell);
|
||||||
|
cellCellWeights.resize_nocopy(nFacesPerCell);
|
||||||
|
|
||||||
|
nFacesPerCell = 0; // Restart the count
|
||||||
|
|
||||||
|
labelList& m = cellCells.values();
|
||||||
|
scalarList& w = cellCellWeights.values();
|
||||||
|
const labelList& offsets = cellCells.offsets();
|
||||||
|
|
||||||
|
// For internal faces is just offsetted owner and neighbour
|
||||||
|
for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
|
||||||
|
{
|
||||||
|
const label own = agglom[faceOwner[facei]];
|
||||||
|
const label nei = agglom[faceNeigh[facei]];
|
||||||
|
|
||||||
|
const label ownIndex = offsets[own] + nFacesPerCell[own]++;
|
||||||
|
const label neiIndex = offsets[nei] + nFacesPerCell[nei]++;
|
||||||
|
|
||||||
|
m[ownIndex] = globalAgglom.toGlobal(myProci, nei);
|
||||||
|
m[neiIndex] = globalAgglom.toGlobal(myProci, own);
|
||||||
|
|
||||||
|
w[ownIndex] = mag(mesh.faceAreas()[facei]);
|
||||||
|
w[neiIndex] = w[ownIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
// For boundary faces is offsetted coupled neighbour
|
||||||
|
for (const polyPatch& pp : pbm)
|
||||||
|
{
|
||||||
|
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
||||||
|
{
|
||||||
|
label bFacei = pp.start()-mesh.nInternalFaces();
|
||||||
|
|
||||||
|
for (const label facei : pp.range())
|
||||||
|
{
|
||||||
|
const label own = agglom[faceOwner[facei]];
|
||||||
|
const label globalNei = globalNeighbour[bFacei];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!globalAgglom.isLocal(myProci, globalNei)
|
||||||
|
|| globalAgglom.toLocal(myProci, globalNei) != own
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label ownIndex = offsets[own] + nFacesPerCell[own]++;
|
||||||
|
|
||||||
|
m[ownIndex] = globalNei;
|
||||||
|
w[ownIndex] = mag(mesh.faceAreas()[facei]);
|
||||||
|
}
|
||||||
|
|
||||||
|
++bFacei;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check for duplicates connections between cells
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// Done as postprocessing step since we now have cellCells.
|
||||||
|
|
||||||
|
// NB: Because of agglomeration, self-connections will occur
|
||||||
|
// and must be filtered out.
|
||||||
|
|
||||||
|
if (!cellCells.empty())
|
||||||
|
{
|
||||||
|
label newIndex = 0;
|
||||||
|
labelHashSet nbrCells;
|
||||||
|
|
||||||
|
labelList& m = cellCells.values();
|
||||||
|
scalarList& w = cellCellWeights.values();
|
||||||
|
labelList& offsets = cellCells.offsets();
|
||||||
|
|
||||||
|
label startIndex = offsets[0];
|
||||||
|
|
||||||
|
const label nCellCells = cellCells.size();
|
||||||
|
|
||||||
|
for (label celli = 0; celli < nCellCells; ++celli)
|
||||||
|
{
|
||||||
|
const label self = globalAgglom.toGlobal(myProci, celli);
|
||||||
|
|
||||||
|
nbrCells.clear();
|
||||||
|
nbrCells.insert(self);
|
||||||
|
|
||||||
|
const label endIndex = offsets[celli+1];
|
||||||
|
|
||||||
|
for (label i = startIndex; i < endIndex; ++i)
|
||||||
|
{
|
||||||
|
if (nbrCells.insert(m[i]))
|
||||||
|
{
|
||||||
|
m[newIndex] = m[i];
|
||||||
|
w[newIndex] = w[i];
|
||||||
|
++newIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
startIndex = endIndex;
|
||||||
|
offsets[celli+1] = newIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
m.resize(newIndex);
|
||||||
|
w.resize(newIndex);
|
||||||
|
|
||||||
|
// Weights has identical offsets as cellCells
|
||||||
|
cellCellWeights.offsets() = cellCells.offsets();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
2
src/dummyThirdParty/MGridGen/Make/files
vendored
2
src/dummyThirdParty/MGridGen/Make/files
vendored
@ -1,3 +1,3 @@
|
|||||||
dummyMGridGen.C
|
dummyMGridGen.cxx
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/dummy/libMGridGen
|
LIB = $(FOAM_LIBBIN)/dummy/libMGridGen
|
||||||
|
|||||||
4
src/dummyThirdParty/MGridGen/mgridgen.h
vendored
4
src/dummyThirdParty/MGridGen/mgridgen.h
vendored
@ -31,14 +31,14 @@ Description
|
|||||||
Only implements the absolute minimum we are using.
|
Only implements the absolute minimum we are using.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
dummyMGridGen.C
|
dummyMGridGen.cxx
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef mgridgen_H
|
#ifndef mgridgen_H
|
||||||
#define mgridgen_H
|
#define mgridgen_H
|
||||||
|
|
||||||
#include "scalar.H"
|
#include "scalarFwd.H"
|
||||||
|
|
||||||
#ifndef idxtype
|
#ifndef idxtype
|
||||||
#define idxtype int
|
#define idxtype int
|
||||||
|
|||||||
2
src/dummyThirdParty/kahipDecomp/Make/files
vendored
2
src/dummyThirdParty/kahipDecomp/Make/files
vendored
@ -1,3 +1,3 @@
|
|||||||
dummyKahipDecomp.C
|
dummyKahipDecomp.cxx
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/dummy/libkahipDecomp
|
LIB = $(FOAM_LIBBIN)/dummy/libkahipDecomp
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -70,6 +70,12 @@ Foam::label Foam::kahipDecomp::decomposeSerial
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::kahipDecomp::kahipDecomp(const label numDomains)
|
||||||
|
:
|
||||||
|
metisLikeDecomp(numDomains)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::kahipDecomp::kahipDecomp
|
Foam::kahipDecomp::kahipDecomp
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
2
src/dummyThirdParty/metisDecomp/Make/files
vendored
2
src/dummyThirdParty/metisDecomp/Make/files
vendored
@ -1,3 +1,3 @@
|
|||||||
dummyMetisDecomp.C
|
dummyMetisDecomp.cxx
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/dummy/libmetisDecomp
|
LIB = $(FOAM_LIBBIN)/dummy/libmetisDecomp
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
dummyPtscotchDecomp.C
|
dummyPtscotchDecomp.cxx
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/dummy/libptscotchDecomp
|
LIB = $(FOAM_LIBBIN)/dummy/libptscotchDecomp
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -73,6 +73,13 @@ Foam::label Foam::ptscotchDecomp::decompose
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::ptscotchDecomp::ptscotchDecomp(const label numDomains)
|
||||||
|
:
|
||||||
|
decompositionMethod(numDomains),
|
||||||
|
coeffsDict_()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::ptscotchDecomp::ptscotchDecomp
|
Foam::ptscotchDecomp::ptscotchDecomp
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
@ -105,7 +112,21 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& agglom,
|
const labelList& agglom,
|
||||||
const pointField& agglomPoints,
|
const pointField& agglomPoints,
|
||||||
const scalarField& pointWeights
|
const scalarField& agglomWeights
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< notImplementedMessage << exit(FatalError);
|
||||||
|
|
||||||
|
return labelList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::ptscotchDecomp::decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField&,
|
||||||
|
const scalarField&
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
2
src/dummyThirdParty/scotchDecomp/Make/files
vendored
2
src/dummyThirdParty/scotchDecomp/Make/files
vendored
@ -1,3 +1,3 @@
|
|||||||
dummyScotchDecomp.C
|
dummyScotchDecomp.cxx
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/dummy/libscotchDecomp
|
LIB = $(FOAM_LIBBIN)/dummy/libscotchDecomp
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -74,6 +74,12 @@ Foam::label Foam::scotchDecomp::decomposeSerial
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::scotchDecomp::scotchDecomp(const label numDomains)
|
||||||
|
:
|
||||||
|
metisLikeDecomp(numDomains)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::scotchDecomp::scotchDecomp
|
Foam::scotchDecomp::scotchDecomp
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
@ -105,7 +111,21 @@ Foam::labelList Foam::scotchDecomp::decompose
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& agglom,
|
const labelList& agglom,
|
||||||
const pointField& agglomPoints,
|
const pointField& agglomPoints,
|
||||||
const scalarField& pointWeights
|
const scalarField& agglomWeights
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< notImplementedMessage << exit(FatalError);
|
||||||
|
|
||||||
|
return labelList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::scotchDecomp::decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField&,
|
||||||
|
const scalarField&
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
@ -118,8 +138,8 @@ Foam::labelList Foam::scotchDecomp::decompose
|
|||||||
Foam::labelList Foam::scotchDecomp::decompose
|
Foam::labelList Foam::scotchDecomp::decompose
|
||||||
(
|
(
|
||||||
const labelListList& globalCellCells,
|
const labelListList& globalCellCells,
|
||||||
const pointField& cellCentres,
|
const pointField&,
|
||||||
const scalarField& cWeights
|
const scalarField&
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
@ -28,6 +28,7 @@ License
|
|||||||
|
|
||||||
#include "decompositionMethod.H"
|
#include "decompositionMethod.H"
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
|
#include "globalMeshData.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
#include "regionSplit.H"
|
#include "regionSplit.H"
|
||||||
@ -331,6 +332,14 @@ const Foam::dictionary& Foam::decompositionMethod::findCoeffsDict
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::decompositionMethod::decompositionMethod(const label numDomains)
|
||||||
|
:
|
||||||
|
decompDict_(dictionary::null),
|
||||||
|
decompRegionDict_(dictionary::null),
|
||||||
|
nDomains_(numDomains)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::decompositionMethod::decompositionMethod
|
Foam::decompositionMethod::decompositionMethod
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
@ -390,18 +399,6 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::labelList Foam::decompositionMethod::decompose
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const pointField& points
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
scalarField weights(points.size(), scalar(1));
|
|
||||||
|
|
||||||
return decompose(mesh, points, weights);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::labelList Foam::decompositionMethod::decompose
|
Foam::labelList Foam::decompositionMethod::decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -411,7 +408,7 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
CompactListList<label> coarseCellCells;
|
CompactListList<label> coarseCellCells;
|
||||||
calcCellCells
|
globalMeshData::calcCellCells
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
fineToCoarse,
|
fineToCoarse,
|
||||||
@ -421,56 +418,18 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Decompose based on agglomerated points
|
// Decompose based on agglomerated points
|
||||||
labelList coarseDistribution
|
labelList decomp
|
||||||
(
|
(
|
||||||
decompose
|
decompose
|
||||||
(
|
(
|
||||||
coarseCellCells.unpack(),
|
coarseCellCells,
|
||||||
coarsePoints,
|
coarsePoints,
|
||||||
coarseWeights
|
coarseWeights
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Rework back into decomposition for original mesh_
|
// From coarse back to fine for original mesh
|
||||||
labelList fineDistribution(fineToCoarse.size());
|
return labelList(decomp, fineToCoarse);
|
||||||
|
|
||||||
forAll(fineDistribution, i)
|
|
||||||
{
|
|
||||||
fineDistribution[i] = coarseDistribution[fineToCoarse[i]];
|
|
||||||
}
|
|
||||||
|
|
||||||
return fineDistribution;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::labelList Foam::decompositionMethod::decompose
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const labelList& fineToCoarse,
|
|
||||||
const pointField& coarsePoints
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
scalarField weights(coarsePoints.size(), scalar(1));
|
|
||||||
|
|
||||||
return decompose
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
fineToCoarse,
|
|
||||||
coarsePoints,
|
|
||||||
weights
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::labelList Foam::decompositionMethod::decompose
|
|
||||||
(
|
|
||||||
const labelListList& globalCellCells,
|
|
||||||
const pointField& cc
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
scalarField weights(cc.size(), scalar(1));
|
|
||||||
|
|
||||||
return decompose(globalCellCells, cc, weights);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -483,186 +442,14 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
CompactListList<label>& cellCells
|
CompactListList<label>& cellCells
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const labelList& faceOwner = mesh.faceOwner();
|
globalMeshData::calcCellCells
|
||||||
const labelList& faceNeighbour = mesh.faceNeighbour();
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
|
||||||
|
|
||||||
|
|
||||||
// Create global cell numbers
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
const globalIndex globalAgglom(nLocalCoarse, UPstream::worldComm, parallel);
|
|
||||||
|
|
||||||
|
|
||||||
// Get agglomerate owner on other side of coupled faces
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
labelList globalNeighbour(mesh.nBoundaryFaces());
|
|
||||||
|
|
||||||
for (const polyPatch& pp : patches)
|
|
||||||
{
|
|
||||||
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
|
||||||
{
|
|
||||||
label facei = pp.start();
|
|
||||||
label bFacei = pp.start() - mesh.nInternalFaces();
|
|
||||||
|
|
||||||
forAll(pp, i)
|
|
||||||
{
|
|
||||||
globalNeighbour[bFacei] = globalAgglom.toGlobal
|
|
||||||
(
|
(
|
||||||
agglom[faceOwner[facei]]
|
mesh,
|
||||||
|
agglom,
|
||||||
|
nLocalCoarse,
|
||||||
|
parallel,
|
||||||
|
cellCells
|
||||||
);
|
);
|
||||||
|
|
||||||
++facei;
|
|
||||||
++bFacei;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the cell on the other side of coupled patches
|
|
||||||
syncTools::swapBoundaryFaceList(mesh, globalNeighbour);
|
|
||||||
|
|
||||||
|
|
||||||
// Count number of faces (internal + coupled)
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
// Number of faces per coarse cell
|
|
||||||
labelList nFacesPerCell(nLocalCoarse, Zero);
|
|
||||||
|
|
||||||
for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
|
|
||||||
{
|
|
||||||
const label own = agglom[faceOwner[facei]];
|
|
||||||
const label nei = agglom[faceNeighbour[facei]];
|
|
||||||
|
|
||||||
nFacesPerCell[own]++;
|
|
||||||
nFacesPerCell[nei]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const polyPatch& pp : patches)
|
|
||||||
{
|
|
||||||
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
|
||||||
{
|
|
||||||
label facei = pp.start();
|
|
||||||
label bFacei = pp.start()-mesh.nInternalFaces();
|
|
||||||
|
|
||||||
forAll(pp, i)
|
|
||||||
{
|
|
||||||
const label own = agglom[faceOwner[facei]];
|
|
||||||
const label globalNei = globalNeighbour[bFacei];
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!globalAgglom.isLocal(globalNei)
|
|
||||||
|| globalAgglom.toLocal(globalNei) != own
|
|
||||||
)
|
|
||||||
{
|
|
||||||
nFacesPerCell[own]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
++facei;
|
|
||||||
++bFacei;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Fill in offset and data
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
cellCells.setSize(nFacesPerCell);
|
|
||||||
|
|
||||||
nFacesPerCell = 0;
|
|
||||||
|
|
||||||
labelList& m = cellCells.m();
|
|
||||||
const labelList& offsets = cellCells.offsets();
|
|
||||||
|
|
||||||
// For internal faces is just offsetted owner and neighbour
|
|
||||||
for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
|
|
||||||
{
|
|
||||||
const label own = agglom[faceOwner[facei]];
|
|
||||||
const label nei = agglom[faceNeighbour[facei]];
|
|
||||||
|
|
||||||
m[offsets[own] + nFacesPerCell[own]++] = globalAgglom.toGlobal(nei);
|
|
||||||
m[offsets[nei] + nFacesPerCell[nei]++] = globalAgglom.toGlobal(own);
|
|
||||||
}
|
|
||||||
|
|
||||||
// For boundary faces is offsetted coupled neighbour
|
|
||||||
for (const polyPatch& pp : patches)
|
|
||||||
{
|
|
||||||
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
|
||||||
{
|
|
||||||
label facei = pp.start();
|
|
||||||
label bFacei = pp.start()-mesh.nInternalFaces();
|
|
||||||
|
|
||||||
forAll(pp, i)
|
|
||||||
{
|
|
||||||
const label own = agglom[faceOwner[facei]];
|
|
||||||
const label globalNei = globalNeighbour[bFacei];
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!globalAgglom.isLocal(globalNei)
|
|
||||||
|| globalAgglom.toLocal(globalNei) != own
|
|
||||||
)
|
|
||||||
{
|
|
||||||
m[offsets[own] + nFacesPerCell[own]++] = globalNei;
|
|
||||||
}
|
|
||||||
|
|
||||||
++facei;
|
|
||||||
++bFacei;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Check for duplicates connections between cells
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// Done as postprocessing step since we now have cellCells.
|
|
||||||
|
|
||||||
if (cellCells.size() == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
label newIndex = 0;
|
|
||||||
labelHashSet nbrCells;
|
|
||||||
|
|
||||||
label startIndex = cellCells.offsets()[0];
|
|
||||||
|
|
||||||
forAll(cellCells, celli)
|
|
||||||
{
|
|
||||||
nbrCells.clear();
|
|
||||||
nbrCells.insert(globalAgglom.toGlobal(celli));
|
|
||||||
|
|
||||||
const label endIndex = cellCells.offsets()[celli+1];
|
|
||||||
|
|
||||||
for (label i = startIndex; i < endIndex; ++i)
|
|
||||||
{
|
|
||||||
if (nbrCells.insert(cellCells.m()[i]))
|
|
||||||
{
|
|
||||||
cellCells.m()[newIndex++] = cellCells.m()[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
startIndex = endIndex;
|
|
||||||
cellCells.offsets()[celli+1] = newIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
cellCells.m().setSize(newIndex);
|
|
||||||
|
|
||||||
//forAll(cellCells, celli)
|
|
||||||
//{
|
|
||||||
// Pout<< "Original: Coarse cell " << celli << endl;
|
|
||||||
// forAll(mesh.cellCells()[celli], i)
|
|
||||||
// {
|
|
||||||
// Pout<< " nbr:" << mesh.cellCells()[celli][i] << endl;
|
|
||||||
// }
|
|
||||||
// Pout<< "Compacted: Coarse cell " << celli << endl;
|
|
||||||
// const labelUList cCells = cellCells[celli];
|
|
||||||
// forAll(cCells, i)
|
|
||||||
// {
|
|
||||||
// Pout<< " nbr:" << cCells[i] << endl;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -676,184 +463,15 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
CompactListList<scalar>& cellCellWeights
|
CompactListList<scalar>& cellCellWeights
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const labelList& faceOwner = mesh.faceOwner();
|
globalMeshData::calcCellCells
|
||||||
const labelList& faceNeighbour = mesh.faceNeighbour();
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
|
||||||
|
|
||||||
|
|
||||||
// Create global cell numbers
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
const globalIndex globalAgglom(nLocalCoarse, UPstream::worldComm, parallel);
|
|
||||||
|
|
||||||
|
|
||||||
// Get agglomerate owner on other side of coupled faces
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
labelList globalNeighbour(mesh.nBoundaryFaces());
|
|
||||||
|
|
||||||
for (const polyPatch& pp : patches)
|
|
||||||
{
|
|
||||||
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
|
||||||
{
|
|
||||||
label facei = pp.start();
|
|
||||||
label bFacei = pp.start() - mesh.nInternalFaces();
|
|
||||||
|
|
||||||
forAll(pp, i)
|
|
||||||
{
|
|
||||||
globalNeighbour[bFacei] = globalAgglom.toGlobal
|
|
||||||
(
|
(
|
||||||
agglom[faceOwner[facei]]
|
mesh,
|
||||||
|
agglom,
|
||||||
|
nLocalCoarse,
|
||||||
|
parallel,
|
||||||
|
cellCells,
|
||||||
|
cellCellWeights
|
||||||
);
|
);
|
||||||
|
|
||||||
++facei;
|
|
||||||
++bFacei;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the cell on the other side of coupled patches
|
|
||||||
syncTools::swapBoundaryFaceList(mesh, globalNeighbour);
|
|
||||||
|
|
||||||
|
|
||||||
// Count number of faces (internal + coupled)
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
// Number of faces per coarse cell
|
|
||||||
labelList nFacesPerCell(nLocalCoarse, Zero);
|
|
||||||
|
|
||||||
for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
|
|
||||||
{
|
|
||||||
const label own = agglom[faceOwner[facei]];
|
|
||||||
const label nei = agglom[faceNeighbour[facei]];
|
|
||||||
|
|
||||||
nFacesPerCell[own]++;
|
|
||||||
nFacesPerCell[nei]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const polyPatch& pp : patches)
|
|
||||||
{
|
|
||||||
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
|
||||||
{
|
|
||||||
label facei = pp.start();
|
|
||||||
label bFacei = pp.start() - mesh.nInternalFaces();
|
|
||||||
|
|
||||||
forAll(pp, i)
|
|
||||||
{
|
|
||||||
const label own = agglom[faceOwner[facei]];
|
|
||||||
const label globalNei = globalNeighbour[bFacei];
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!globalAgglom.isLocal(globalNei)
|
|
||||||
|| globalAgglom.toLocal(globalNei) != own
|
|
||||||
)
|
|
||||||
{
|
|
||||||
nFacesPerCell[own]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
++facei;
|
|
||||||
++bFacei;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Fill in offset and data
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
cellCells.setSize(nFacesPerCell);
|
|
||||||
cellCellWeights.setSize(nFacesPerCell);
|
|
||||||
|
|
||||||
nFacesPerCell = 0;
|
|
||||||
|
|
||||||
labelList& m = cellCells.m();
|
|
||||||
scalarList& w = cellCellWeights.m();
|
|
||||||
const labelList& offsets = cellCells.offsets();
|
|
||||||
|
|
||||||
// For internal faces is just offsetted owner and neighbour
|
|
||||||
for (label facei = 0; facei < mesh.nInternalFaces(); ++facei)
|
|
||||||
{
|
|
||||||
const label own = agglom[faceOwner[facei]];
|
|
||||||
const label nei = agglom[faceNeighbour[facei]];
|
|
||||||
|
|
||||||
const label ownIndex = offsets[own] + nFacesPerCell[own]++;
|
|
||||||
const label neiIndex = offsets[nei] + nFacesPerCell[nei]++;
|
|
||||||
|
|
||||||
m[ownIndex] = globalAgglom.toGlobal(nei);
|
|
||||||
w[ownIndex] = mag(mesh.faceAreas()[facei]);
|
|
||||||
m[neiIndex] = globalAgglom.toGlobal(own);
|
|
||||||
w[ownIndex] = mag(mesh.faceAreas()[facei]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// For boundary faces is offsetted coupled neighbour
|
|
||||||
for (const polyPatch& pp : patches)
|
|
||||||
{
|
|
||||||
if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
|
|
||||||
{
|
|
||||||
label facei = pp.start();
|
|
||||||
label bFacei = pp.start()-mesh.nInternalFaces();
|
|
||||||
|
|
||||||
forAll(pp, i)
|
|
||||||
{
|
|
||||||
const label own = agglom[faceOwner[facei]];
|
|
||||||
const label globalNei = globalNeighbour[bFacei];
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!globalAgglom.isLocal(globalNei)
|
|
||||||
|| globalAgglom.toLocal(globalNei) != own
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label ownIndex = offsets[own] + nFacesPerCell[own]++;
|
|
||||||
m[ownIndex] = globalNei;
|
|
||||||
w[ownIndex] = mag(mesh.faceAreas()[facei]);
|
|
||||||
}
|
|
||||||
|
|
||||||
++facei;
|
|
||||||
++bFacei;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Check for duplicates connections between cells
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// Done as postprocessing step since we now have cellCells.
|
|
||||||
|
|
||||||
if (cellCells.size() == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
label newIndex = 0;
|
|
||||||
labelHashSet nbrCells;
|
|
||||||
|
|
||||||
label startIndex = cellCells.offsets()[0];
|
|
||||||
|
|
||||||
forAll(cellCells, celli)
|
|
||||||
{
|
|
||||||
nbrCells.clear();
|
|
||||||
nbrCells.insert(globalAgglom.toGlobal(celli));
|
|
||||||
|
|
||||||
const label endIndex = cellCells.offsets()[celli+1];
|
|
||||||
|
|
||||||
for (label i = startIndex; i < endIndex; ++i)
|
|
||||||
{
|
|
||||||
if (nbrCells.insert(cellCells.m()[i]))
|
|
||||||
{
|
|
||||||
cellCells.m()[newIndex] = cellCells.m()[i];
|
|
||||||
cellCellWeights.m()[newIndex] = cellCellWeights.m()[i];
|
|
||||||
newIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
startIndex = endIndex;
|
|
||||||
cellCells.offsets()[celli+1] = newIndex;
|
|
||||||
cellCellWeights.offsets()[celli+1] = newIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
cellCells.m().setSize(newIndex);
|
|
||||||
cellCellWeights.m().setSize(newIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -882,11 +500,11 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
// Any weights specified?
|
// Any weights specified?
|
||||||
const bool hasWeights = returnReduceOr(cellWeights.size());
|
const bool hasWeights = returnReduceOr(cellWeights.size());
|
||||||
|
|
||||||
if (hasWeights && cellWeights.size() != mesh.nCells())
|
if (hasWeights && (cellWeights.size() != mesh.nCells()))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Number of weights " << cellWeights.size()
|
<< "Number of weights (" << cellWeights.size()
|
||||||
<< " differs from number of cells " << mesh.nCells()
|
<< ") != number of cells (" << mesh.nCells() << ")"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1219,7 +837,7 @@ void Foam::decompositionMethod::setConstraints
|
|||||||
List<labelPair>& explicitConnections
|
List<labelPair>& explicitConnections
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
blockedFace.setSize(mesh.nFaces());
|
blockedFace.resize_nocopy(mesh.nFaces());
|
||||||
blockedFace = true;
|
blockedFace = true;
|
||||||
|
|
||||||
specifiedProcessorFaces.clear();
|
specifiedProcessorFaces.clear();
|
||||||
@ -1329,14 +947,4 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::labelList Foam::decompositionMethod::decompose
|
|
||||||
(
|
|
||||||
const pointField& points
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
NotImplemented;
|
|
||||||
return labelList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,8 +35,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef decompositionMethod_H
|
#ifndef Foam_decompositionMethod_H
|
||||||
#define decompositionMethod_H
|
#define Foam_decompositionMethod_H
|
||||||
|
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "CompactListList.H"
|
#include "CompactListList.H"
|
||||||
@ -63,12 +63,6 @@ class decompositionMethod
|
|||||||
//- Set PtrList of constraints by reading decompDict_.
|
//- Set PtrList of constraints by reading decompDict_.
|
||||||
void readConstraints();
|
void readConstraints();
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
decompositionMethod(const decompositionMethod&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const decompositionMethod&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -84,7 +78,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Protected data
|
// Protected Data
|
||||||
|
|
||||||
//- Top-level decomposition dictionary (eg, decomposeParDict)
|
//- Top-level decomposition dictionary (eg, decomposeParDict)
|
||||||
const dictionary& decompDict_;
|
const dictionary& decompDict_;
|
||||||
@ -137,8 +131,24 @@ protected:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with specified number of domains,
|
||||||
|
//- no coefficients or constraints
|
||||||
|
explicit decompositionMethod(const label numDomains);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
decompositionMethod(const decompositionMethod&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const decompositionMethod&) = delete;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("decompositionMethod");
|
TypeName("decompositionMethod");
|
||||||
|
|
||||||
@ -207,51 +217,49 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Number of domains
|
//- Number of domains
|
||||||
inline label nDomains() const noexcept
|
label nDomains() const noexcept
|
||||||
{
|
{
|
||||||
return nDomains_;
|
return nDomains_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- True if the method is purely geometric,
|
||||||
|
//- often using cell centre points
|
||||||
|
virtual bool geometric() const { return false; }
|
||||||
|
|
||||||
//- Is method parallel aware?
|
//- Is method parallel aware?
|
||||||
// (i.e. does it synchronize domains across proc boundaries)
|
// (i.e. does it synchronize domains across proc boundaries)
|
||||||
virtual bool parallelAware() const = 0;
|
virtual bool parallelAware() const = 0;
|
||||||
|
|
||||||
|
// //- Is internally method parallel aware
|
||||||
|
// virtual bool parallelNative() const { return false; }
|
||||||
|
|
||||||
|
|
||||||
// No topology (implemented by geometric decomposers)
|
// No topology (implemented by geometric decomposers)
|
||||||
|
|
||||||
//- Return the wanted processor number for every coordinate.
|
//- Return the wanted processor number for every coordinate,
|
||||||
|
//- using uniform or specified point weights.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const scalarField& pointWeights
|
const scalarField& pointWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Decompose with uniform weights on the points
|
|
||||||
virtual labelList decompose(const pointField& points) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Topology provided by mesh
|
// Topology provided by mesh
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number,
|
||||||
|
//- using uniform or specified point weights.
|
||||||
// Use the mesh connectivity (if needed)
|
// Use the mesh connectivity (if needed)
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const scalarField& pointWeights
|
const scalarField& pointWeights = scalarField::null()
|
||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
//- Decompose with uniform weights on the points
|
//- Return for every coordinate the wanted processor number.
|
||||||
virtual labelList decompose
|
// Gets passed agglomeration map (from fine to coarse cells)
|
||||||
(
|
// and coarse cell
|
||||||
const polyMesh& mesh,
|
|
||||||
const pointField& points
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number. Gets
|
|
||||||
// passed agglomeration map (from fine to coarse cells) and coarse
|
|
||||||
// cell
|
|
||||||
// location. Can be overridden by decomposers that provide this
|
// location. Can be overridden by decomposers that provide this
|
||||||
// functionality natively. Coarse cells are local to the processor
|
// functionality natively. Coarse cells are local to the processor
|
||||||
// (if in parallel). If you want to have coarse cells spanning
|
// (if in parallel). If you want to have coarse cells spanning
|
||||||
@ -261,19 +269,25 @@ public:
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& cellToRegion,
|
const labelList& cellToRegion,
|
||||||
const pointField& regionPoints,
|
const pointField& regionPoints,
|
||||||
const scalarField& regionWeights
|
const scalarField& regionWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Like decompose but with uniform weights on the regions
|
|
||||||
|
// Topology provided explicitly
|
||||||
|
|
||||||
|
//- Return for every coordinate the wanted processor number.
|
||||||
|
// The connectivity is equal to mesh.cellCells() except for
|
||||||
|
// - in parallel the cell numbers are global cell numbers
|
||||||
|
// (starting
|
||||||
|
// from 0 at processor0 and then incrementing all through the
|
||||||
|
// processors)
|
||||||
|
// - the connections are across coupled patches
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const CompactListList<label>& globalCellCells,
|
||||||
const labelList& cellToRegion,
|
const pointField& cc,
|
||||||
const pointField& regionPoints
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const;
|
) const = 0;
|
||||||
|
|
||||||
|
|
||||||
// Topology provided explicitly addressing
|
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
// The connectivity is equal to mesh.cellCells() except for
|
// The connectivity is equal to mesh.cellCells() except for
|
||||||
@ -286,47 +300,12 @@ public:
|
|||||||
(
|
(
|
||||||
const labelListList& globalCellCells,
|
const labelListList& globalCellCells,
|
||||||
const pointField& cc,
|
const pointField& cc,
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
//- Like decompose but with uniform weights on the cells
|
|
||||||
virtual labelList decompose
|
|
||||||
(
|
|
||||||
const labelListList& globalCellCells,
|
|
||||||
const pointField& cc
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
|
|
||||||
//- Helper: determine (local or global) cellCells from mesh
|
|
||||||
// agglomeration. Agglomeration is local to the processor.
|
|
||||||
// local : connections are in local indices. Coupled across
|
|
||||||
// cyclics but not processor patches.
|
|
||||||
// global : connections are in global indices. Coupled across
|
|
||||||
// cyclics and processor patches.
|
|
||||||
static void calcCellCells
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const labelList& agglom,
|
|
||||||
const label nLocalCoarse,
|
|
||||||
const bool global,
|
|
||||||
CompactListList<label>& cellCells
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Helper: determine (local or global) cellCells and face weights
|
|
||||||
// from mesh agglomeration.
|
|
||||||
// Uses mag of faceArea as weights
|
|
||||||
static void calcCellCells
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const labelList& agglom,
|
|
||||||
const label nLocalCoarse,
|
|
||||||
const bool parallel,
|
|
||||||
CompactListList<label>& cellCells,
|
|
||||||
CompactListList<scalar>& cellCellWeights
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Helper: extract constraints:
|
//- Helper: extract constraints:
|
||||||
// blockedface: existing faces where owner and neighbour on same
|
// blockedface: existing faces where owner and neighbour on same
|
||||||
// proc
|
// proc
|
||||||
@ -390,6 +369,39 @@ public:
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Housekeeping
|
||||||
|
|
||||||
|
//- Determine (local or global) cellCells from mesh agglomeration.
|
||||||
|
// Agglomeration is local to the processor.
|
||||||
|
// local : connections are in local indices. Coupled across
|
||||||
|
// cyclics but not processor patches.
|
||||||
|
// global : connections are in global indices. Coupled across
|
||||||
|
// cyclics and processor patches.
|
||||||
|
FOAM_DEPRECATED_STRICT(2023-11, "globalMeshData::calcCellCells()")
|
||||||
|
static void calcCellCells
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const labelList& agglom,
|
||||||
|
const label nLocalCoarse,
|
||||||
|
const bool parallel, //!< Use global cell ids in parallel
|
||||||
|
CompactListList<label>& cellCells
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Determine (local or global) cellCells and face weights
|
||||||
|
//- from mesh agglomeration.
|
||||||
|
// Uses mag of faceArea as weights
|
||||||
|
FOAM_DEPRECATED_STRICT(2023-11, "globalMeshData::calcCellCells()")
|
||||||
|
static void calcCellCells
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const labelList& agglom,
|
||||||
|
const label nLocalCoarse,
|
||||||
|
const bool parallel, //!< Use global cell ids in parallel
|
||||||
|
CompactListList<label>& cellCells,
|
||||||
|
CompactListList<scalar>& cellCellWeights
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -149,6 +149,17 @@ void Foam::geomDecomp::checkDecompositionDirections
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::geomDecomp::geomDecomp(const Vector<label>& divisions)
|
||||||
|
:
|
||||||
|
decompositionMethod(divisions.x()*divisions.y()*divisions.z()),
|
||||||
|
delta_(0.001),
|
||||||
|
csys_(),
|
||||||
|
n_(divisions),
|
||||||
|
order_(0,1,2),
|
||||||
|
coeffsDict_(dictionary::null)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::geomDecomp::geomDecomp
|
Foam::geomDecomp::geomDecomp
|
||||||
(
|
(
|
||||||
const word& derivedType,
|
const word& derivedType,
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -44,8 +44,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef geomDecomp_H
|
#ifndef Foam_geomDecomp_H
|
||||||
#define geomDecomp_H
|
#define Foam_geomDecomp_H
|
||||||
|
|
||||||
#include "decompositionMethod.H"
|
#include "decompositionMethod.H"
|
||||||
#include "cartesianCS.H"
|
#include "cartesianCS.H"
|
||||||
@ -105,11 +105,14 @@ protected:
|
|||||||
//- Check that mesh directions are compatible with decomposition
|
//- Check that mesh directions are compatible with decomposition
|
||||||
void checkDecompositionDirections(const Vector<label>&) const;
|
void checkDecompositionDirections(const Vector<label>&) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with number of x/y/z division
|
||||||
|
//- (no coefficients or constraints)
|
||||||
|
explicit geomDecomp(const Vector<label>& divisions);
|
||||||
|
|
||||||
//- Construct for derived type name and decomposition dictionary
|
//- Construct for derived type name and decomposition dictionary
|
||||||
geomDecomp
|
geomDecomp
|
||||||
(
|
(
|
||||||
@ -131,15 +134,15 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Purely geometric methods
|
||||||
|
virtual bool geometric() const { return true; }
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const scalarField& pointWeights
|
const scalarField& pointWeights = scalarField::null()
|
||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
//- Decompose with uniform weights on the points
|
|
||||||
virtual labelList decompose(const pointField& points) const = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -674,6 +674,12 @@ Foam::label Foam::hierarchGeomDecomp::sortComponent
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::hierarchGeomDecomp::hierarchGeomDecomp(const Vector<label>& divisions)
|
||||||
|
:
|
||||||
|
geomDecomp(divisions)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::hierarchGeomDecomp::hierarchGeomDecomp
|
Foam::hierarchGeomDecomp::hierarchGeomDecomp
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
@ -686,53 +692,15 @@ Foam::hierarchGeomDecomp::hierarchGeomDecomp
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::labelList Foam::hierarchGeomDecomp::decompose
|
|
||||||
(
|
|
||||||
const pointField& points
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
// construct a list for the final result
|
|
||||||
labelList finalDecomp(points.size(), Zero);
|
|
||||||
|
|
||||||
// Start off with every point sorted onto itself.
|
|
||||||
labelList slice(identity(points.size()));
|
|
||||||
|
|
||||||
const pointField rotatedPoints(adjustPoints(points));
|
|
||||||
|
|
||||||
// Calculate tolerance of cell distribution. For large cases finding
|
|
||||||
// distribution to the cell exact would cause too many iterations so allow
|
|
||||||
// some slack.
|
|
||||||
const label allSize = returnReduce(points.size(), sumOp<label>());
|
|
||||||
const label sizeTol = max(1, label(1e-3*allSize/nDomains_));
|
|
||||||
|
|
||||||
// Sort recursive
|
|
||||||
const label nWarnings = sortComponent
|
|
||||||
(
|
|
||||||
sizeTol,
|
|
||||||
rotatedPoints,
|
|
||||||
slice,
|
|
||||||
0, // Sort first component in order_
|
|
||||||
1, // Offset for different x bins.
|
|
||||||
finalDecomp
|
|
||||||
);
|
|
||||||
|
|
||||||
if (nWarnings)
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "\nEncountered " << nWarnings << " occurrences where the desired"
|
|
||||||
" decomposition split could not be properly satisfied" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return finalDecomp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::labelList Foam::hierarchGeomDecomp::decompose
|
Foam::labelList Foam::hierarchGeomDecomp::decompose
|
||||||
(
|
(
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const scalarField& weights
|
const scalarField& weights
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
// Uniform weighting if weights are empty or poorly sized
|
||||||
|
const bool hasWeights = returnReduceAnd(points.size() == weights.size());
|
||||||
|
|
||||||
// Construct a list for the final result
|
// Construct a list for the final result
|
||||||
labelList finalDecomp(points.size(), Zero);
|
labelList finalDecomp(points.size(), Zero);
|
||||||
|
|
||||||
@ -748,7 +716,10 @@ Foam::labelList Foam::hierarchGeomDecomp::decompose
|
|||||||
const label sizeTol = max(1, label(1e-3*allSize/nDomains_));
|
const label sizeTol = max(1, label(1e-3*allSize/nDomains_));
|
||||||
|
|
||||||
// Sort recursive
|
// Sort recursive
|
||||||
const label nWarnings = sortComponent
|
label nWarnings = 0;
|
||||||
|
if (hasWeights)
|
||||||
|
{
|
||||||
|
nWarnings = sortComponent
|
||||||
(
|
(
|
||||||
sizeTol,
|
sizeTol,
|
||||||
weights,
|
weights,
|
||||||
@ -758,6 +729,19 @@ Foam::labelList Foam::hierarchGeomDecomp::decompose
|
|||||||
1, // Offset for different x bins.
|
1, // Offset for different x bins.
|
||||||
finalDecomp
|
finalDecomp
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nWarnings = sortComponent
|
||||||
|
(
|
||||||
|
sizeTol,
|
||||||
|
rotatedPoints,
|
||||||
|
slice,
|
||||||
|
0, // Sort first component in order_
|
||||||
|
1, // Offset for different x bins.
|
||||||
|
finalDecomp
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (nWarnings)
|
if (nWarnings)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -62,8 +62,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef hierarchGeomDecomp_H
|
#ifndef Foam_hierarchGeomDecomp_H
|
||||||
#define hierarchGeomDecomp_H
|
#define Foam_hierarchGeomDecomp_H
|
||||||
|
|
||||||
#include "geomDecomp.H"
|
#include "geomDecomp.H"
|
||||||
|
|
||||||
@ -169,12 +169,17 @@ public:
|
|||||||
//- No copy assignment
|
//- No copy assignment
|
||||||
void operator=(const hierarchGeomDecomp&) = delete;
|
void operator=(const hierarchGeomDecomp&) = delete;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("hierarchical");
|
TypeName("hierarchical");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with number of x/y/z division
|
||||||
|
//- (no coefficients or constraints)
|
||||||
|
explicit hierarchGeomDecomp(const Vector<label>& divisions);
|
||||||
|
|
||||||
//- Construct given decomposition dictionary and optional region name
|
//- Construct given decomposition dictionary and optional region name
|
||||||
explicit hierarchGeomDecomp
|
explicit hierarchGeomDecomp
|
||||||
(
|
(
|
||||||
@ -196,42 +201,36 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
|
//- using uniform or specified point weights.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const pointField&,
|
const pointField& points,
|
||||||
const scalarField& weights
|
const scalarField& weights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Decompose with uniform weights.
|
|
||||||
// Code for weighted decomposition is a bit complex,
|
|
||||||
// so kept separate for now.
|
|
||||||
virtual labelList decompose(const pointField&) const;
|
|
||||||
|
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
// Use the mesh connectivity (if needed).
|
// Use the mesh connectivity (if needed).
|
||||||
|
// With uniform or specified point weights.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const pointField& cc,
|
const pointField& cc,
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
checkDecompositionDirections(mesh.geometricD());
|
checkDecompositionDirections(mesh.geometricD());
|
||||||
return decompose(cc, cWeights);
|
return decompose(cc, cWeights);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Decompose with uniform weights.
|
//- Explicitly provided connectivity
|
||||||
// Code for weighted decomposition is a bit complex,
|
|
||||||
// so kept separate for now.
|
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const CompactListList<label>& globalCellCells, //!< unused
|
||||||
const pointField& cc
|
const pointField& cc,
|
||||||
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
checkDecompositionDirections(mesh.geometricD());
|
return decompose(cc, cWeights);
|
||||||
return decompose(cc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
@ -243,22 +242,13 @@ public:
|
|||||||
// - the connections are across coupled patches
|
// - the connections are across coupled patches
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const labelListList& globalCellCells, // unused
|
const labelListList& globalCellCells, //!< unused
|
||||||
const pointField& cc,
|
const pointField& cc,
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return decompose(cc, cWeights);
|
return decompose(cc, cWeights);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual labelList decompose
|
|
||||||
(
|
|
||||||
const labelListList& globalCellCells, // unused
|
|
||||||
const pointField& cc
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return decompose(cc);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -78,7 +78,9 @@ Foam::labelList Foam::manualDecomp::decompose
|
|||||||
dataFile_,
|
dataFile_,
|
||||||
mesh.facesInstance(),
|
mesh.facesInstance(),
|
||||||
mesh.thisDb(),
|
mesh.thisDb(),
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
IOobject::NO_REGISTER
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -41,8 +41,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef manualDecomp_H
|
#ifndef Foam_manualDecomp_H
|
||||||
#define manualDecomp_H
|
#define Foam_manualDecomp_H
|
||||||
|
|
||||||
#include "decompositionMethod.H"
|
#include "decompositionMethod.H"
|
||||||
|
|
||||||
@ -61,8 +61,9 @@ class manualDecomp
|
|||||||
|
|
||||||
fileName dataFile_;
|
fileName dataFile_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
// Private Member Functions
|
// Generated Methods
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
manualDecomp(const manualDecomp&) = delete;
|
manualDecomp(const manualDecomp&) = delete;
|
||||||
@ -71,8 +72,6 @@ class manualDecomp
|
|||||||
void operator=(const manualDecomp&) = delete;
|
void operator=(const manualDecomp&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("manual");
|
TypeName("manual");
|
||||||
|
|
||||||
@ -106,16 +105,29 @@ public:
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const pointField& cc,
|
const pointField& cc,
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Return for every coordinate the wanted processor number.
|
||||||
|
// Explicitly provided connectivity - does not use mesh_.
|
||||||
|
virtual labelList decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField& cc,
|
||||||
|
const scalarField& cWeights = scalarField::null()
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
NotImplemented;
|
||||||
|
return labelList();
|
||||||
|
}
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
// Explicitly provided connectivity - does not use mesh_.
|
// Explicitly provided connectivity - does not use mesh_.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const labelListList& globalCellCells,
|
const labelListList& globalCellCells,
|
||||||
const pointField& cc,
|
const pointField& cc,
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "metisLikeDecomp.H"
|
#include "metisLikeDecomp.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
|
#include "globalMeshData.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -39,8 +40,9 @@ Foam::label Foam::metisLikeDecomp::decomposeGeneral
|
|||||||
labelList& decomp
|
labelList& decomp
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (!Pstream::parRun())
|
if (!UPstream::parRun())
|
||||||
{
|
{
|
||||||
|
// Treat zero-sized weights as uniform weighting
|
||||||
return decomposeSerial
|
return decomposeSerial
|
||||||
(
|
(
|
||||||
adjncy,
|
adjncy,
|
||||||
@ -75,10 +77,10 @@ Foam::label Foam::metisLikeDecomp::decomposeGeneral
|
|||||||
|
|
||||||
|
|
||||||
List<label> allXadj;
|
List<label> allXadj;
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
allXadj.resize(globalCells.totalSize()+1);
|
allXadj.resize(globalCells.totalSize()+1);
|
||||||
allXadj.last() = globalAdjncy.totalSize(); // Final end offset
|
allXadj.back() = globalAdjncy.totalSize(); // Final end offset
|
||||||
|
|
||||||
// My values - no renumbering required
|
// My values - no renumbering required
|
||||||
SubList<label>(allXadj, globalCells.localSize(0)) =
|
SubList<label>(allXadj, globalCells.localSize(0)) =
|
||||||
@ -137,7 +139,7 @@ Foam::label Foam::metisLikeDecomp::decomposeGeneral
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Local to global renumbering
|
// Local to global renumbering
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
for (const int proci : globalCells.subProcs())
|
for (const int proci : globalCells.subProcs())
|
||||||
{
|
{
|
||||||
@ -147,10 +149,12 @@ Foam::label Foam::metisLikeDecomp::decomposeGeneral
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore zero-sized weights ... and poorly sized ones too
|
// Uniform weighting if weights are empty or poorly sized
|
||||||
|
|
||||||
List<scalar> allWeights;
|
List<scalar> allWeights;
|
||||||
if (returnReduceAnd(cWeights.size() == globalCells.localSize()))
|
if (returnReduceAnd(cWeights.size() == globalCells.localSize()))
|
||||||
{
|
{
|
||||||
|
// ie, hasWeights
|
||||||
allWeights = globalCells.gather(cWeights);
|
allWeights = globalCells.gather(cWeights);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +162,7 @@ Foam::label Foam::metisLikeDecomp::decomposeGeneral
|
|||||||
// Global decomposition
|
// Global decomposition
|
||||||
labelList allDecomp;
|
labelList allDecomp;
|
||||||
|
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
decomposeSerial
|
decomposeSerial
|
||||||
(
|
(
|
||||||
@ -183,6 +187,13 @@ Foam::label Foam::metisLikeDecomp::decomposeGeneral
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::metisLikeDecomp::metisLikeDecomp(const label numDomains)
|
||||||
|
:
|
||||||
|
decompositionMethod(numDomains),
|
||||||
|
coeffsDict_(dictionary::null)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::metisLikeDecomp::metisLikeDecomp
|
Foam::metisLikeDecomp::metisLikeDecomp
|
||||||
(
|
(
|
||||||
const word& derivedType,
|
const word& derivedType,
|
||||||
@ -205,18 +216,16 @@ Foam::labelList Foam::metisLikeDecomp::decompose
|
|||||||
const scalarField& pointWeights
|
const scalarField& pointWeights
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (points.size() != mesh.nCells())
|
if (!points.empty() && (points.size() != mesh.nCells()))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Can only use this decomposition method for entire mesh" << nl
|
<< "Number of cell centres (" << points.size()
|
||||||
<< "and supply one coordinate (cellCentre) for every cell." << nl
|
<< ") != number of cells (" << mesh.nCells() << ")"
|
||||||
<< "The number of coordinates " << points.size() << nl
|
|
||||||
<< "The number of cells in the mesh " << mesh.nCells() << nl
|
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
calcCellCells
|
globalMeshData::calcCellCells
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
identity(mesh.nCells()),
|
identity(mesh.nCells()),
|
||||||
@ -250,8 +259,8 @@ Foam::labelList Foam::metisLikeDecomp::decompose
|
|||||||
if (agglom.size() != mesh.nCells())
|
if (agglom.size() != mesh.nCells())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Size of cell-to-coarse map " << agglom.size()
|
<< "Agglomeration size (" << agglom.size()
|
||||||
<< " differs from number of cells in mesh " << mesh.nCells()
|
<< ") != number of cells (" << mesh.nCells() << ")"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +269,7 @@ Foam::labelList Foam::metisLikeDecomp::decompose
|
|||||||
// xadj(celli) : start of information in adjncy for celli
|
// xadj(celli) : start of information in adjncy for celli
|
||||||
|
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
calcCellCells
|
globalMeshData::calcCellCells
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
agglom,
|
agglom,
|
||||||
@ -279,16 +288,42 @@ Foam::labelList Foam::metisLikeDecomp::decompose
|
|||||||
decomp
|
decomp
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// From coarse back to fine for original mesh
|
||||||
|
return labelList(decomp, agglom);
|
||||||
|
}
|
||||||
|
|
||||||
// Rework back into decomposition for original mesh
|
|
||||||
labelList fineDistribution(agglom.size());
|
|
||||||
|
|
||||||
forAll(fineDistribution, i)
|
Foam::labelList Foam::metisLikeDecomp::decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField& cellCentres,
|
||||||
|
const scalarField& cellWeights
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (!cellCentres.empty() && (cellCentres.size() != globalCellCells.size()))
|
||||||
{
|
{
|
||||||
fineDistribution[i] = decomp[agglom[i]];
|
FatalErrorInFunction
|
||||||
|
<< "Number of cell centres (" << cellCentres.size()
|
||||||
|
<< ") != number of cells (" << globalCellCells.size() << ")"
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fineDistribution;
|
// CompactListList is already
|
||||||
|
// Metis CSR (Compressed Storage Format) storage
|
||||||
|
// adjncy : contains neighbours (= edges in graph)
|
||||||
|
// xadj(celli) : start of information in adjncy for celli
|
||||||
|
|
||||||
|
// Decompose using default weights
|
||||||
|
labelList decomp;
|
||||||
|
decomposeGeneral
|
||||||
|
(
|
||||||
|
globalCellCells.values(),
|
||||||
|
globalCellCells.offsets(),
|
||||||
|
cellWeights,
|
||||||
|
decomp
|
||||||
|
);
|
||||||
|
|
||||||
|
return decomp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -299,12 +334,12 @@ Foam::labelList Foam::metisLikeDecomp::decompose
|
|||||||
const scalarField& cellWeights
|
const scalarField& cellWeights
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (cellCentres.size() != globalCellCells.size())
|
if (!cellCentres.empty() && (cellCentres.size() != globalCellCells.size()))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Inconsistent number of cells (" << globalCellCells.size()
|
<< "Number of cell centres (" << cellCentres.size()
|
||||||
<< ") and number of cell centres (" << cellCentres.size()
|
<< ") != number of cells (" << globalCellCells.size() << ")"
|
||||||
<< ")." << exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make Metis CSR (Compressed Storage Format) storage
|
// Make Metis CSR (Compressed Storage Format) storage
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,8 +37,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef metisLikeDecomp_H
|
#ifndef Foam_metisLikeDecomp_H
|
||||||
#define metisLikeDecomp_H
|
#define Foam_metisLikeDecomp_H
|
||||||
|
|
||||||
#include "decompositionMethod.H"
|
#include "decompositionMethod.H"
|
||||||
|
|
||||||
@ -91,6 +91,9 @@ protected:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with number of domains (no coefficients or constraints)
|
||||||
|
explicit metisLikeDecomp(const label numDomains);
|
||||||
|
|
||||||
//- Construct for derived type name and decomposition dictionary.
|
//- Construct for derived type name and decomposition dictionary.
|
||||||
metisLikeDecomp
|
metisLikeDecomp
|
||||||
(
|
(
|
||||||
@ -134,8 +137,8 @@ public:
|
|||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const pointField& points,
|
const pointField& points = pointField::null(),
|
||||||
const scalarField& pointWeights
|
const scalarField& pointWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
@ -147,8 +150,23 @@ public:
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& agglom,
|
const labelList& agglom,
|
||||||
const pointField& regionPoints,
|
const pointField& agglomPoints,
|
||||||
const scalarField& regionWeights
|
const scalarField& agglomWeights = scalarField::null()
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return for every coordinate the wanted processor number.
|
||||||
|
// Explicitly provided mesh connectivity.
|
||||||
|
// The connectivity is equal to mesh.cellCells() except for
|
||||||
|
// - in parallel the cell numbers are global cell numbers (starting
|
||||||
|
// from 0 at processor0 and then incrementing all through the
|
||||||
|
// processors)
|
||||||
|
// - the connections are across coupled patches
|
||||||
|
// See note on weights above.
|
||||||
|
virtual labelList decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField& cellCentres = pointField::null(),
|
||||||
|
const scalarField& cellWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
@ -162,8 +180,8 @@ public:
|
|||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const labelListList& globalCellCells,
|
const labelListList& globalCellCells,
|
||||||
const pointField& cellCentres,
|
const pointField& cellCentres = pointField::null(),
|
||||||
const scalarField& cellWeights
|
const scalarField& cellWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,6 +30,7 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
|
#include "globalMeshData.H"
|
||||||
#include "mapDistribute.H"
|
#include "mapDistribute.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -194,8 +195,7 @@ void Foam::multiLevelDecomp::setMethods()
|
|||||||
|
|
||||||
label nLevels = 0;
|
label nLevels = 0;
|
||||||
|
|
||||||
methods_.clear();
|
methods_.resize_null(methodsDict_.size());
|
||||||
methods_.setSize(methodsDict_.size());
|
|
||||||
for (const entry& dEntry : methodsDict_)
|
for (const entry& dEntry : methodsDict_)
|
||||||
{
|
{
|
||||||
// Dictionary entries only
|
// Dictionary entries only
|
||||||
@ -211,7 +211,7 @@ void Foam::multiLevelDecomp::setMethods()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
methods_.setSize(nLevels);
|
methods_.resize(nLevels);
|
||||||
|
|
||||||
// Verify that nTotal is correct based on what each method delivers
|
// Verify that nTotal is correct based on what each method delivers
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ void Foam::multiLevelDecomp::subsetGlobalCellCells
|
|||||||
// Now subCellCells contains indices into oldToNew which are the
|
// Now subCellCells contains indices into oldToNew which are the
|
||||||
// new locations of the neighbouring cells.
|
// new locations of the neighbouring cells.
|
||||||
|
|
||||||
cutConnections.setSize(nDomains);
|
cutConnections.resize_nocopy(nDomains);
|
||||||
cutConnections = 0;
|
cutConnections = 0;
|
||||||
|
|
||||||
forAll(subCellCells, subCelli)
|
forAll(subCellCells, subCelli)
|
||||||
@ -399,7 +399,12 @@ void Foam::multiLevelDecomp::decompose
|
|||||||
|
|
||||||
// Subset point-wise data.
|
// Subset point-wise data.
|
||||||
pointField subPoints(points, domainPoints);
|
pointField subPoints(points, domainPoints);
|
||||||
scalarField subWeights(pointWeights, domainPoints);
|
scalarField subWeights;
|
||||||
|
if (pointWeights.size() == points.size())
|
||||||
|
{
|
||||||
|
subWeights = scalarField(pointWeights, domainPoints);
|
||||||
|
}
|
||||||
|
|
||||||
labelList subPointMap(labelUIndList(pointMap, domainPoints));
|
labelList subPointMap(labelUIndList(pointMap, domainPoints));
|
||||||
// Subset point-point addressing (adapt global numbering)
|
// Subset point-point addressing (adapt global numbering)
|
||||||
labelListList subPointPoints;
|
labelListList subPointPoints;
|
||||||
@ -607,9 +612,16 @@ Foam::labelList Foam::multiLevelDecomp::decompose
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
calcCellCells(mesh, identity(cc.size()), cc.size(), true, cellCells);
|
globalMeshData::calcCellCells
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
identity(cc.size()),
|
||||||
|
cc.size(),
|
||||||
|
true,
|
||||||
|
cellCells
|
||||||
|
);
|
||||||
|
|
||||||
labelList finalDecomp(cc.size(), Zero);
|
labelList finalDecomp(cc.size(), Foam::zero{});
|
||||||
labelList cellMap(identity(cc.size()));
|
labelList cellMap(identity(cc.size()));
|
||||||
|
|
||||||
decompose
|
decompose
|
||||||
@ -617,9 +629,9 @@ Foam::labelList Foam::multiLevelDecomp::decompose
|
|||||||
cellCells.unpack(),
|
cellCells.unpack(),
|
||||||
cc,
|
cc,
|
||||||
cWeights,
|
cWeights,
|
||||||
cellMap, // map back to original cells
|
cellMap, // map back to original cell points
|
||||||
0,
|
0, // currLevel
|
||||||
0,
|
0, // leafOffset
|
||||||
|
|
||||||
finalDecomp
|
finalDecomp
|
||||||
);
|
);
|
||||||
@ -630,22 +642,48 @@ Foam::labelList Foam::multiLevelDecomp::decompose
|
|||||||
|
|
||||||
Foam::labelList Foam::multiLevelDecomp::decompose
|
Foam::labelList Foam::multiLevelDecomp::decompose
|
||||||
(
|
(
|
||||||
const labelListList& globalPointPoints,
|
const CompactListList<label>& globalCellCells,
|
||||||
const pointField& points,
|
const pointField& cc,
|
||||||
const scalarField& pointWeights
|
const scalarField& cWeights
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
labelList finalDecomp(points.size(), Zero);
|
labelList finalDecomp(cc.size(), Foam::zero{});
|
||||||
labelList pointMap(identity(points.size()));
|
labelList cellMap(identity(cc.size()));
|
||||||
|
|
||||||
decompose
|
decompose
|
||||||
(
|
(
|
||||||
globalPointPoints,
|
globalCellCells.unpack(),
|
||||||
points,
|
cc,
|
||||||
pointWeights,
|
cWeights,
|
||||||
pointMap, // map back to original points
|
cellMap, // map back to original cell points
|
||||||
0,
|
0, // currLevel
|
||||||
0,
|
0, // leafOffset
|
||||||
|
|
||||||
|
finalDecomp
|
||||||
|
);
|
||||||
|
|
||||||
|
return finalDecomp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::multiLevelDecomp::decompose
|
||||||
|
(
|
||||||
|
const labelListList& globalCellCells,
|
||||||
|
const pointField& cc,
|
||||||
|
const scalarField& cWeights
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
labelList finalDecomp(cc.size(), Foam::zero{});
|
||||||
|
labelList cellMap(identity(cc.size()));
|
||||||
|
|
||||||
|
decompose
|
||||||
|
(
|
||||||
|
globalCellCells,
|
||||||
|
cc,
|
||||||
|
cWeights,
|
||||||
|
cellMap, // map back to original cell points
|
||||||
|
0, // currLevel
|
||||||
|
0, // leafOffset
|
||||||
|
|
||||||
finalDecomp
|
finalDecomp
|
||||||
);
|
);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,8 +35,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef multiLevelDecomp_H
|
#ifndef Foam_multiLevelDecomp_H
|
||||||
#define multiLevelDecomp_H
|
#define Foam_multiLevelDecomp_H
|
||||||
|
|
||||||
#include "decompositionMethod.H"
|
#include "decompositionMethod.H"
|
||||||
|
|
||||||
@ -99,6 +99,10 @@ class multiLevelDecomp
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
multiLevelDecomp(const multiLevelDecomp&) = delete;
|
multiLevelDecomp(const multiLevelDecomp&) = delete;
|
||||||
|
|
||||||
@ -106,8 +110,6 @@ class multiLevelDecomp
|
|||||||
void operator=(const multiLevelDecomp&) = delete;
|
void operator=(const multiLevelDecomp&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("multiLevel");
|
TypeName("multiLevel");
|
||||||
|
|
||||||
@ -128,8 +130,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Is method parallel aware?
|
//- Is parallel aware when all sub-methods are also parallel-aware
|
||||||
// i.e. does it synchronize domains across proc boundaries
|
|
||||||
virtual bool parallelAware() const;
|
virtual bool parallelAware() const;
|
||||||
|
|
||||||
//- Inherit decompose from decompositionMethod
|
//- Inherit decompose from decompositionMethod
|
||||||
@ -141,7 +142,16 @@ public:
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const scalarField& pointWeights
|
const scalarField& pointWeights = scalarField::null()
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return for every coordinate the wanted processor number.
|
||||||
|
// Explicitly provided connectivity - does not use mesh_.
|
||||||
|
virtual labelList decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField& cc,
|
||||||
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
@ -150,7 +160,7 @@ public:
|
|||||||
(
|
(
|
||||||
const labelListList& globalCellCells,
|
const labelListList& globalCellCells,
|
||||||
const pointField& cc,
|
const pointField& cc,
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012 OpenFOAM Foundation
|
Copyright (C) 2012 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -46,6 +46,12 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::noDecomp::noDecomp(const label numDomains)
|
||||||
|
:
|
||||||
|
decompositionMethod(numDomains)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::noDecomp::noDecomp
|
Foam::noDecomp::noDecomp
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
@ -56,4 +62,49 @@ Foam::noDecomp::noDecomp
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::labelList Foam::noDecomp::decompose
|
||||||
|
(
|
||||||
|
const pointField& points,
|
||||||
|
const scalarField&
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return labelList(points.size(), UPstream::myProcNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::noDecomp::decompose
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const pointField&,
|
||||||
|
const scalarField&
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return labelList(mesh.nCells(), UPstream::myProcNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::noDecomp::decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField&,
|
||||||
|
const scalarField&
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return labelList(globalCellCells.size(), UPstream::myProcNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::noDecomp::decompose
|
||||||
|
(
|
||||||
|
const labelListList& globalCellCells,
|
||||||
|
const pointField&,
|
||||||
|
const scalarField&
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return labelList(globalCellCells.size(), UPstream::myProcNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2015 OpenFOAM Foundation
|
Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,8 +37,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef noDecomp_H
|
#ifndef Foam_noDecomp_H
|
||||||
#define noDecomp_H
|
#define Foam_noDecomp_H
|
||||||
|
|
||||||
#include "decompositionMethod.H"
|
#include "decompositionMethod.H"
|
||||||
|
|
||||||
@ -53,7 +53,9 @@ class noDecomp
|
|||||||
:
|
:
|
||||||
public decompositionMethod
|
public decompositionMethod
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
public:
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
noDecomp(const noDecomp&) = delete;
|
noDecomp(const noDecomp&) = delete;
|
||||||
@ -62,14 +64,15 @@ class noDecomp
|
|||||||
void operator=(const noDecomp&) = delete;
|
void operator=(const noDecomp&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeNameNoDebug("none");
|
TypeNameNoDebug("none");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with number of domains (ignored)
|
||||||
|
explicit noDecomp(const label numDomains);
|
||||||
|
|
||||||
//- Construct given decomposition dictionary and optional region name
|
//- Construct given decomposition dictionary and optional region name
|
||||||
explicit noDecomp
|
explicit noDecomp
|
||||||
(
|
(
|
||||||
@ -91,33 +94,35 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
// Use the mesh connectivity (if needed)
|
virtual labelList decompose
|
||||||
|
(
|
||||||
|
const pointField& points,
|
||||||
|
const scalarField& pointWeights_unused = scalarField::null()
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return for every cell the current local processor rank.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const pointField& cc,
|
const pointField& cc_unused = pointField::null(),
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights_unused = scalarField::null()
|
||||||
) const
|
) const;
|
||||||
{
|
|
||||||
return labelList(cc.size(), Pstream::myProcNo());
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every cell the current local processor rank.
|
||||||
// Explicitly provided connectivity - does not use mesh_.
|
virtual labelList decompose
|
||||||
// The connectivity is equal to mesh.cellCells() except for
|
(
|
||||||
// - in parallel the cell numbers are global cell numbers (starting
|
const CompactListList<label>& globalCellCells,
|
||||||
// from 0 at processor0 and then incrementing all through the
|
const pointField& cc_unused = pointField::null(),
|
||||||
// processors)
|
const scalarField& cWeights_unused = scalarField::null()
|
||||||
// - the connections are across coupled patches
|
) const;
|
||||||
|
|
||||||
|
//- Return for every cell the current local processor rank.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const labelListList& globalCellCells,
|
const labelListList& globalCellCells,
|
||||||
const pointField& cc,
|
const pointField& cc_unused = pointField::null(),
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights_unused = scalarField::null()
|
||||||
) const
|
) const;
|
||||||
{
|
|
||||||
return labelList(globalCellCells.size(), Pstream::myProcNo());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -82,6 +82,13 @@ Foam::labelList Foam::randomDecomp::randomMap(const label nCells) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::randomDecomp::randomDecomp(const label numDomains)
|
||||||
|
:
|
||||||
|
decompositionMethod(numDomains),
|
||||||
|
agglom_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::randomDecomp::randomDecomp
|
Foam::randomDecomp::randomDecomp
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
@ -90,7 +97,7 @@ Foam::randomDecomp::randomDecomp
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
decompositionMethod(decompDict, regionName),
|
decompositionMethod(decompDict, regionName),
|
||||||
agglom_(1)
|
agglom_(0)
|
||||||
{
|
{
|
||||||
const dictionary& coeffs = findCoeffsDict(typeName + "Coeffs", select);
|
const dictionary& coeffs = findCoeffsDict(typeName + "Coeffs", select);
|
||||||
|
|
||||||
@ -104,16 +111,7 @@ Foam::randomDecomp::randomDecomp
|
|||||||
Foam::labelList Foam::randomDecomp::decompose
|
Foam::labelList Foam::randomDecomp::decompose
|
||||||
(
|
(
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const scalarField& pointWeights
|
const scalarField&
|
||||||
) const
|
|
||||||
{
|
|
||||||
return randomMap(points.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::labelList Foam::randomDecomp::decompose
|
|
||||||
(
|
|
||||||
const pointField& points
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return randomMap(points.size());
|
return randomMap(points.size());
|
||||||
@ -127,7 +125,18 @@ Foam::labelList Foam::randomDecomp::decompose
|
|||||||
const scalarField&
|
const scalarField&
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return randomMap(mesh.nCells()); // or cc.size()
|
return randomMap(mesh.nCells());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::randomDecomp::decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField&,
|
||||||
|
const scalarField&
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return randomMap(globalCellCells.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -138,7 +147,7 @@ Foam::labelList Foam::randomDecomp::decompose
|
|||||||
const scalarField&
|
const scalarField&
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return randomMap(globalCellCells.size()); // or cc.size()
|
return randomMap(globalCellCells.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,7 +36,7 @@ Description
|
|||||||
Coefficients:
|
Coefficients:
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
agglom | Number of cells to agglomerate | no | 1
|
agglom | Number of cells to agglomerate | no | 0
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -62,7 +62,7 @@ class randomDecomp
|
|||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Number of cells to agglomerate per random value (default: 1)
|
//- Number of cells to agglomerate per random value (default: 0)
|
||||||
label agglom_;
|
label agglom_;
|
||||||
|
|
||||||
|
|
||||||
@ -71,14 +71,16 @@ class randomDecomp
|
|||||||
//- Random distribution on the 0-nCells interval
|
//- Random distribution on the 0-nCells interval
|
||||||
labelList randomMap(const label nCells) const;
|
labelList randomMap(const label nCells) const;
|
||||||
|
|
||||||
//- No copy construct
|
public:
|
||||||
void operator=(const randomDecomp&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
// Generated Methods
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
randomDecomp(const randomDecomp&) = delete;
|
randomDecomp(const randomDecomp&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const randomDecomp&) = delete;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeNameNoDebug("random");
|
TypeNameNoDebug("random");
|
||||||
@ -86,6 +88,9 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with number of domains (no coefficients or constraints)
|
||||||
|
explicit randomDecomp(const label numDomains);
|
||||||
|
|
||||||
//- Construct for decomposition dictionary and optional region name
|
//- Construct for decomposition dictionary and optional region name
|
||||||
explicit randomDecomp
|
explicit randomDecomp
|
||||||
(
|
(
|
||||||
@ -107,25 +112,28 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// No topology (implemented by geometric decomposers)
|
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const scalarField& pointWeights
|
const scalarField& pointWeights_unused = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Decompose with uniform weights on the points
|
|
||||||
virtual labelList decompose(const pointField& points) const;
|
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const pointField& cc,
|
const pointField& cc_unused = pointField::null(),
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights_unused = scalarField::null()
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return for every coordinate the wanted processor number.
|
||||||
|
// Explicitly provided connectivity - does not use mesh_.
|
||||||
|
virtual labelList decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField& cc_unused = pointField::null(),
|
||||||
|
const scalarField& cWeights_unused = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
@ -133,8 +141,8 @@ public:
|
|||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const labelListList& globalCellCells,
|
const labelListList& globalCellCells,
|
||||||
const pointField& cc,
|
const pointField& cc_unused = pointField::null(),
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights_unused = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -76,7 +76,7 @@ struct vectorLessOp
|
|||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// assignToProcessorGroup : given nCells cells and nProcGroup processor
|
// assignToProcessorGroup : given nCells cells and nProcGroup processor
|
||||||
// groups to share them, how do we share them out? Answer : each group
|
// groups to share them, how do we share them out? Answer : each group
|
||||||
@ -84,15 +84,18 @@ struct vectorLessOp
|
|||||||
// extra to make up the numbers. This should produce almost
|
// extra to make up the numbers. This should produce almost
|
||||||
// perfect load balancing
|
// perfect load balancing
|
||||||
|
|
||||||
void Foam::simpleGeomDecomp::assignToProcessorGroup
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
static void assignToProcessorGroup
|
||||||
(
|
(
|
||||||
labelList& processorGroup,
|
labelList& processorGroup,
|
||||||
const label nProcGroup
|
const label nProcGroup
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
label jump = processorGroup.size()/nProcGroup;
|
const label jump = processorGroup.size()/nProcGroup;
|
||||||
label jumpb = jump + 1;
|
const label jumpb = jump + 1;
|
||||||
label fstProcessorGroup = processorGroup.size() - jump*nProcGroup;
|
const label fstProcessorGroup = processorGroup.size() - jump*nProcGroup;
|
||||||
|
|
||||||
label ind = 0;
|
label ind = 0;
|
||||||
label j = 0;
|
label j = 0;
|
||||||
@ -118,7 +121,7 @@ void Foam::simpleGeomDecomp::assignToProcessorGroup
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::simpleGeomDecomp::assignToProcessorGroup
|
static void assignToProcessorGroup
|
||||||
(
|
(
|
||||||
labelList& processorGroup,
|
labelList& processorGroup,
|
||||||
const label nProcGroup,
|
const label nProcGroup,
|
||||||
@ -139,6 +142,7 @@ void Foam::simpleGeomDecomp::assignToProcessorGroup
|
|||||||
|
|
||||||
const scalar jump = summedWeights/nProcGroup;
|
const scalar jump = summedWeights/nProcGroup;
|
||||||
const label nProcGroupM1 = nProcGroup - 1;
|
const label nProcGroupM1 = nProcGroup - 1;
|
||||||
|
|
||||||
scalar sumWeights = 0;
|
scalar sumWeights = 0;
|
||||||
label ind = 0;
|
label ind = 0;
|
||||||
label j = 0;
|
label j = 0;
|
||||||
@ -160,6 +164,10 @@ void Foam::simpleGeomDecomp::assignToProcessorGroup
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::labelList Foam::simpleGeomDecomp::decomposeOneProc
|
Foam::labelList Foam::simpleGeomDecomp::decomposeOneProc
|
||||||
(
|
(
|
||||||
@ -231,6 +239,11 @@ Foam::labelList Foam::simpleGeomDecomp::decomposeOneProc
|
|||||||
const scalarField& weights
|
const scalarField& weights
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
if (weights.empty())
|
||||||
|
{
|
||||||
|
return decomposeOneProc(points);
|
||||||
|
}
|
||||||
|
|
||||||
// construct a list for the final result
|
// construct a list for the final result
|
||||||
labelList finalDecomp(points.size());
|
labelList finalDecomp(points.size());
|
||||||
|
|
||||||
@ -314,6 +327,12 @@ Foam::labelList Foam::simpleGeomDecomp::decomposeOneProc
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::simpleGeomDecomp::simpleGeomDecomp(const Vector<label>& divisions)
|
||||||
|
:
|
||||||
|
geomDecomp(divisions)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::simpleGeomDecomp::simpleGeomDecomp
|
Foam::simpleGeomDecomp::simpleGeomDecomp
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
@ -326,59 +345,51 @@ Foam::simpleGeomDecomp::simpleGeomDecomp
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::labelList Foam::simpleGeomDecomp::decompose
|
|
||||||
(
|
|
||||||
const pointField& points
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (!Pstream::parRun())
|
|
||||||
{
|
|
||||||
return decomposeOneProc(points);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const globalIndex globalNumbers(points.size());
|
|
||||||
|
|
||||||
pointField allPoints(globalNumbers.gather(points));
|
|
||||||
|
|
||||||
labelList allDecomp;
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
allDecomp = decomposeOneProc(allPoints);
|
|
||||||
allPoints.clear(); // Not needed anymore
|
|
||||||
}
|
|
||||||
|
|
||||||
return globalNumbers.scatter(allDecomp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::labelList Foam::simpleGeomDecomp::decompose
|
Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||||
(
|
(
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const scalarField& weights
|
const scalarField& weights
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (returnReduceOr(points.size() != weights.size()))
|
// Uniform weighting if weights are empty or poorly sized
|
||||||
|
const bool hasWeights = returnReduceAnd(points.size() == weights.size());
|
||||||
|
|
||||||
|
if (!UPstream::parRun())
|
||||||
{
|
{
|
||||||
// Ignore zero-sized weights ... and poorly sized ones too
|
if (hasWeights)
|
||||||
return decompose(points);
|
|
||||||
}
|
|
||||||
else if (!Pstream::parRun())
|
|
||||||
{
|
{
|
||||||
return decomposeOneProc(points, weights);
|
return decomposeOneProc(points, weights);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
return decomposeOneProc(points);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Parallel
|
||||||
const globalIndex globalNumbers(points.size());
|
const globalIndex globalNumbers(points.size());
|
||||||
|
|
||||||
pointField allPoints(globalNumbers.gather(points));
|
|
||||||
scalarField allWeights(globalNumbers.gather(weights));
|
|
||||||
|
|
||||||
labelList allDecomp;
|
labelList allDecomp;
|
||||||
if (Pstream::master())
|
pointField allPoints(globalNumbers.gather(points));
|
||||||
|
scalarField allWeights;
|
||||||
|
|
||||||
|
if (hasWeights)
|
||||||
|
{
|
||||||
|
// Non-uniform weighting
|
||||||
|
allWeights = globalNumbers.gather(weights);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UPstream::master())
|
||||||
|
{
|
||||||
|
if (hasWeights)
|
||||||
{
|
{
|
||||||
allDecomp = decomposeOneProc(allPoints, allWeights);
|
allDecomp = decomposeOneProc(allPoints, allWeights);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
allDecomp = decomposeOneProc(allPoints);
|
||||||
|
}
|
||||||
allPoints.clear(); // Not needed anymore
|
allPoints.clear(); // Not needed anymore
|
||||||
allWeights.clear(); // ...
|
allWeights.clear(); // ...
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -44,8 +44,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef simpleGeomDecomp_H
|
#ifndef Foam_simpleGeomDecomp_H
|
||||||
#define simpleGeomDecomp_H
|
#define Foam_simpleGeomDecomp_H
|
||||||
|
|
||||||
#include "geomDecomp.H"
|
#include "geomDecomp.H"
|
||||||
|
|
||||||
@ -62,21 +62,6 @@ class simpleGeomDecomp
|
|||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
static void assignToProcessorGroup
|
|
||||||
(
|
|
||||||
labelList& processorGroup,
|
|
||||||
const label nProcGroup
|
|
||||||
);
|
|
||||||
|
|
||||||
static void assignToProcessorGroup
|
|
||||||
(
|
|
||||||
labelList& processorGroup,
|
|
||||||
const label nProcGroup,
|
|
||||||
const labelList& indices,
|
|
||||||
const scalarField& weights,
|
|
||||||
const scalar summedWeights
|
|
||||||
);
|
|
||||||
|
|
||||||
labelList decomposeOneProc(const pointField& points) const;
|
labelList decomposeOneProc(const pointField& points) const;
|
||||||
|
|
||||||
labelList decomposeOneProc
|
labelList decomposeOneProc
|
||||||
@ -88,11 +73,14 @@ class simpleGeomDecomp
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
void operator=(const simpleGeomDecomp&) = delete;
|
simpleGeomDecomp(const simpleGeomDecomp&) = delete;
|
||||||
|
|
||||||
//- No copy assignment
|
//- No copy assignment
|
||||||
simpleGeomDecomp(const simpleGeomDecomp&) = delete;
|
void operator=(const simpleGeomDecomp&) = delete;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("simple");
|
TypeName("simple");
|
||||||
@ -100,6 +88,10 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with number of x/y/z division
|
||||||
|
//- (no coefficients or constraints)
|
||||||
|
explicit simpleGeomDecomp(const Vector<label>& divisions);
|
||||||
|
|
||||||
//- Construct given decomposition dictionary and optional region name
|
//- Construct given decomposition dictionary and optional region name
|
||||||
explicit simpleGeomDecomp
|
explicit simpleGeomDecomp
|
||||||
(
|
(
|
||||||
@ -114,51 +106,49 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Simple sends all points to the master for decomposition.
|
//- Sends all points to the master for decomposition.
|
||||||
virtual bool parallelAware() const
|
virtual bool parallelAware() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Decompose with uniform weights.
|
|
||||||
virtual labelList decompose(const pointField& points) const;
|
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
|
//- using uniform or specified point weights.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const scalarField& weights
|
const scalarField& weights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Decompose with uniform weights.
|
//- Decompose with uniform or specified point weights.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh, //!< To check mesh dimensions
|
||||||
const pointField& points
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
checkDecompositionDirections(mesh.geometricD());
|
|
||||||
return decompose(points);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
|
||||||
virtual labelList decompose
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const scalarField& weights
|
const scalarField& pointWeights = scalarField::null()
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
checkDecompositionDirections(mesh.geometricD());
|
checkDecompositionDirections(mesh.geometricD());
|
||||||
return decompose(points, weights);
|
return decompose(points, pointWeights);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Explicitly provided connectivity
|
//- Explicitly provided connectivity
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const labelListList& globalCellCells, // unused
|
const CompactListList<label>& globalCellCells, //!< unused
|
||||||
const pointField& cc,
|
const pointField& cc,
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights = scalarField::null()
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return decompose(cc, cWeights);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Explicitly provided connectivity
|
||||||
|
virtual labelList decompose
|
||||||
|
(
|
||||||
|
const labelListList& globalCellCells, //!< unused
|
||||||
|
const pointField& cc,
|
||||||
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return decompose(cc, cWeights);
|
return decompose(cc, cWeights);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -102,7 +102,11 @@ Foam::labelList Foam::structuredDecomp::decompose
|
|||||||
);
|
);
|
||||||
const fvMesh& subMesh = subsetter.subMesh();
|
const fvMesh& subMesh = subsetter.subMesh();
|
||||||
pointField subCc(cc, subsetter.cellMap());
|
pointField subCc(cc, subsetter.cellMap());
|
||||||
scalarField subWeights(cWeights, subsetter.cellMap());
|
scalarField subWeights;
|
||||||
|
if (cWeights.size() == cc.size())
|
||||||
|
{
|
||||||
|
subWeights = scalarField(cWeights, subsetter.cellMap());
|
||||||
|
}
|
||||||
|
|
||||||
// Decompose the layer of cells
|
// Decompose the layer of cells
|
||||||
labelList subDecomp(method_().decompose(subMesh, subCc, subWeights));
|
labelList subDecomp(method_().decompose(subMesh, subCc, subWeights));
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,8 +35,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef structuredDecomp_H
|
#ifndef Foam_structuredDecomp_H
|
||||||
#define structuredDecomp_H
|
#define Foam_structuredDecomp_H
|
||||||
|
|
||||||
#include "decompositionMethod.H"
|
#include "decompositionMethod.H"
|
||||||
#include "wordRes.H"
|
#include "wordRes.H"
|
||||||
@ -61,7 +61,9 @@ class structuredDecomp
|
|||||||
autoPtr<decompositionMethod> method_;
|
autoPtr<decompositionMethod> method_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
public:
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
structuredDecomp(const structuredDecomp&) = delete;
|
structuredDecomp(const structuredDecomp&) = delete;
|
||||||
@ -70,8 +72,6 @@ class structuredDecomp
|
|||||||
void operator=(const structuredDecomp&) = delete;
|
void operator=(const structuredDecomp&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("structured");
|
TypeName("structured");
|
||||||
|
|
||||||
@ -102,16 +102,29 @@ public:
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const pointField& points,
|
const pointField& points,
|
||||||
const scalarField& pointWeights
|
const scalarField& pointWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Return for every coordinate the wanted processor number.
|
||||||
|
// Explicitly provided connectivity - does not use mesh_.
|
||||||
|
virtual labelList decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField& cc,
|
||||||
|
const scalarField& cWeights = scalarField::null()
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
NotImplemented;
|
||||||
|
return labelList();
|
||||||
|
}
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
// Explicitly provided connectivity - does not use mesh_.
|
// Explicitly provided connectivity - does not use mesh_.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const labelListList& globalCellCells,
|
const labelListList& globalCellCells,
|
||||||
const pointField& cc,
|
const pointField& cc,
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -108,7 +108,7 @@ Foam::label Foam::kahipDecomp::decomposeSerial
|
|||||||
ConstPrecisionAdaptor<int, label, List> xadj_param(xadj);
|
ConstPrecisionAdaptor<int, label, List> xadj_param(xadj);
|
||||||
|
|
||||||
// Output: cell -> processor addressing
|
// Output: cell -> processor addressing
|
||||||
decomp.resize(numCells);
|
decomp.resize_nocopy(numCells);
|
||||||
decomp = 0;
|
decomp = 0;
|
||||||
PrecisionAdaptor<int, label, List> decomp_param(decomp, false);
|
PrecisionAdaptor<int, label, List> decomp_param(decomp, false);
|
||||||
|
|
||||||
@ -149,8 +149,8 @@ Foam::label Foam::kahipDecomp::decomposeSerial
|
|||||||
else if (hasWeights && (cWeights.size() != numCells))
|
else if (hasWeights && (cWeights.size() != numCells))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Number of cell weights " << cWeights.size()
|
<< "Number of weights (" << cWeights.size()
|
||||||
<< " does not equal number of cells " << numCells
|
<< ") != number of cells (" << numCells << ")"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ Foam::label Foam::kahipDecomp::decomposeSerial
|
|||||||
if (hasWeights)
|
if (hasWeights)
|
||||||
{
|
{
|
||||||
// Convert to integers.
|
// Convert to integers.
|
||||||
cellWeights.resize(cWeights.size());
|
cellWeights.resize_nocopy(cWeights.size());
|
||||||
forAll(cellWeights, i)
|
forAll(cellWeights, i)
|
||||||
{
|
{
|
||||||
cellWeights[i] = static_cast<int>
|
cellWeights[i] = static_cast<int>
|
||||||
@ -299,6 +299,12 @@ Foam::label Foam::kahipDecomp::decomposeSerial
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::kahipDecomp::kahipDecomp(const label numDomains)
|
||||||
|
:
|
||||||
|
metisLikeDecomp(numDomains)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::kahipDecomp::kahipDecomp
|
Foam::kahipDecomp::kahipDecomp
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -59,8 +59,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef kahipDecomp_H
|
#ifndef Foam_kahipDecomp_H
|
||||||
#define kahipDecomp_H
|
#define Foam_kahipDecomp_H
|
||||||
|
|
||||||
#include "metisLikeDecomp.H"
|
#include "metisLikeDecomp.H"
|
||||||
#include "Enum.H"
|
#include "Enum.H"
|
||||||
@ -90,13 +90,6 @@ protected:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
kahipDecomp(const kahipDecomp&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const kahipDecomp&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- The predefined KaHIP configuration types
|
//- The predefined KaHIP configuration types
|
||||||
@ -115,12 +108,24 @@ public:
|
|||||||
static const Enum<configs> configNames;
|
static const Enum<configs> configNames;
|
||||||
|
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
kahipDecomp(const kahipDecomp&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const kahipDecomp&) = delete;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("kahip");
|
TypeName("kahip");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with number of domains (no coefficients or constraints)
|
||||||
|
explicit kahipDecomp(const label numDomains);
|
||||||
|
|
||||||
//- Construct given decomposition dictionary and optional region name
|
//- Construct given decomposition dictionary and optional region name
|
||||||
explicit kahipDecomp
|
explicit kahipDecomp
|
||||||
(
|
(
|
||||||
@ -135,6 +140,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Method is parallel aware
|
||||||
virtual bool parallelAware() const
|
virtual bool parallelAware() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -101,29 +101,31 @@ Foam::label Foam::metisDecomp::decomposeSerial
|
|||||||
// Face weights (so on the edges of the dual)
|
// Face weights (so on the edges of the dual)
|
||||||
List<idx_t> faceWeights;
|
List<idx_t> faceWeights;
|
||||||
|
|
||||||
// Check for externally provided cellweights and if so initialise weights
|
bool hasWeights = !cWeights.empty();
|
||||||
// Note: min, not gMin since routine runs on master only.
|
|
||||||
const scalar minWeights = min(cWeights);
|
// Note: min, not gMin since routine runs on master only.
|
||||||
|
const scalar minWeights = hasWeights ? min(cWeights) : scalar(1);
|
||||||
|
|
||||||
if (!cWeights.empty())
|
|
||||||
{
|
|
||||||
if (minWeights <= 0)
|
if (minWeights <= 0)
|
||||||
{
|
{
|
||||||
|
hasWeights = false;
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Illegal minimum weight " << minWeights
|
<< "Illegal minimum weight " << minWeights
|
||||||
|
<< " ... ignoring"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
else if (hasWeights && (cWeights.size() != numCells))
|
||||||
if (cWeights.size() != numCells)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Number of cell weights " << cWeights.size()
|
<< "Number of weights (" << cWeights.size()
|
||||||
<< " does not equal number of cells " << numCells
|
<< ") != number of cells (" << numCells << ")"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasWeights)
|
||||||
|
{
|
||||||
// Convert to integers.
|
// Convert to integers.
|
||||||
cellWeights.setSize(cWeights.size());
|
cellWeights.resize_nocopy(cWeights.size());
|
||||||
forAll(cellWeights, i)
|
forAll(cellWeights, i)
|
||||||
{
|
{
|
||||||
cellWeights[i] = idx_t(cWeights[i]/minWeights);
|
cellWeights[i] = idx_t(cWeights[i]/minWeights);
|
||||||
@ -261,6 +263,12 @@ Foam::label Foam::metisDecomp::decomposeSerial
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::metisDecomp::metisDecomp(const label numDomains)
|
||||||
|
:
|
||||||
|
metisLikeDecomp(numDomains)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::metisDecomp::metisDecomp
|
Foam::metisDecomp::metisDecomp
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -60,8 +60,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef metisDecomp_H
|
#ifndef Foam_metisDecomp_H
|
||||||
#define metisDecomp_H
|
#define Foam_metisDecomp_H
|
||||||
|
|
||||||
#include "metisLikeDecomp.H"
|
#include "metisLikeDecomp.H"
|
||||||
|
|
||||||
@ -90,6 +90,10 @@ protected:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
metisDecomp(const metisDecomp&) = delete;
|
metisDecomp(const metisDecomp&) = delete;
|
||||||
|
|
||||||
@ -97,14 +101,15 @@ protected:
|
|||||||
void operator=(const metisDecomp&) = delete;
|
void operator=(const metisDecomp&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("metis");
|
TypeName("metis");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with number of domains (no coefficients or constraints)
|
||||||
|
explicit metisDecomp(const label numDomains);
|
||||||
|
|
||||||
//- Construct given decomposition dictionary and optional region name
|
//- Construct given decomposition dictionary and optional region name
|
||||||
explicit metisDecomp
|
explicit metisDecomp
|
||||||
(
|
(
|
||||||
@ -119,6 +124,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Knows about coupled boundaries
|
||||||
virtual bool parallelAware() const
|
virtual bool parallelAware() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -29,6 +29,7 @@ License
|
|||||||
#include "ptscotchDecomp.H"
|
#include "ptscotchDecomp.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "floatScalar.H"
|
#include "floatScalar.H"
|
||||||
|
#include "globalMeshData.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "PrecisionAdaptor.H"
|
#include "PrecisionAdaptor.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
@ -123,7 +124,7 @@ Foam::label Foam::ptscotchDecomp::decompose
|
|||||||
ConstPrecisionAdaptor<SCOTCH_Num, label, List> xadj_param(xadj);
|
ConstPrecisionAdaptor<SCOTCH_Num, label, List> xadj_param(xadj);
|
||||||
|
|
||||||
// Output: cell -> processor addressing
|
// Output: cell -> processor addressing
|
||||||
decomp.resize(numCells);
|
decomp.resize_nocopy(numCells);
|
||||||
decomp = 0;
|
decomp = 0;
|
||||||
PrecisionAdaptor<SCOTCH_Num, label, List> decomp_param(decomp, false);
|
PrecisionAdaptor<SCOTCH_Num, label, List> decomp_param(decomp, false);
|
||||||
|
|
||||||
@ -497,6 +498,13 @@ Foam::label Foam::ptscotchDecomp::decompose
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::ptscotchDecomp::ptscotchDecomp(const label numDomains)
|
||||||
|
:
|
||||||
|
decompositionMethod(numDomains),
|
||||||
|
coeffsDict_(dictionary::null)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::ptscotchDecomp::ptscotchDecomp
|
Foam::ptscotchDecomp::ptscotchDecomp
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
@ -520,23 +528,20 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
|||||||
// Where to write graph
|
// Where to write graph
|
||||||
graphPath_ = getGraphPathBase(mesh);
|
graphPath_ = getGraphPathBase(mesh);
|
||||||
|
|
||||||
if (points.size() != mesh.nCells())
|
if (!points.empty() && (points.size() != mesh.nCells()))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Can only use this decomposition method for entire mesh" << nl
|
<< "Number of cell centres (" << points.size()
|
||||||
<< "and supply one coordinate (cellCentre) for every cell." << nl
|
<< ") != number of cells (" << mesh.nCells() << ")"
|
||||||
<< "The number of coordinates " << points.size() << nl
|
|
||||||
<< "The number of cells in the mesh " << mesh.nCells() << nl
|
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Make Metis CSR (Compressed Storage Format) storage
|
// Make Metis CSR (Compressed Storage Format) storage
|
||||||
// adjncy : contains neighbours (= edges in graph)
|
// adjncy : contains neighbours (= edges in graph)
|
||||||
// xadj(celli) : start of information in adjncy for celli
|
// xadj(celli) : start of information in adjncy for celli
|
||||||
|
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
calcCellCells
|
globalMeshData::calcCellCells
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
identity(mesh.nCells()),
|
identity(mesh.nCells()),
|
||||||
@ -564,7 +569,7 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& agglom,
|
const labelList& agglom,
|
||||||
const pointField& agglomPoints,
|
const pointField& agglomPoints,
|
||||||
const scalarField& pointWeights
|
const scalarField& agglomWeights
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Where to write graph
|
// Where to write graph
|
||||||
@ -573,8 +578,8 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
|||||||
if (agglom.size() != mesh.nCells())
|
if (agglom.size() != mesh.nCells())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Size of cell-to-coarse map " << agglom.size()
|
<< "Agglomeration size (" << agglom.size()
|
||||||
<< " differs from number of cells in mesh " << mesh.nCells()
|
<< ") != number of cells (" << mesh.nCells() << ")"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,7 +588,7 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
|||||||
// adjncy : contains neighbours (= edges in graph)
|
// adjncy : contains neighbours (= edges in graph)
|
||||||
// xadj(celli) : start of information in adjncy for celli
|
// xadj(celli) : start of information in adjncy for celli
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
calcCellCells
|
globalMeshData::calcCellCells
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
agglom,
|
agglom,
|
||||||
@ -598,19 +603,49 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
|||||||
(
|
(
|
||||||
cellCells.values(),
|
cellCells.values(),
|
||||||
cellCells.offsets(),
|
cellCells.offsets(),
|
||||||
pointWeights,
|
agglomWeights,
|
||||||
decomp
|
decomp
|
||||||
);
|
);
|
||||||
|
|
||||||
// Rework back into decomposition for original mesh
|
// From coarse back to fine for original mesh
|
||||||
labelList fineDistribution(agglom.size());
|
return labelList(decomp, agglom);
|
||||||
|
}
|
||||||
|
|
||||||
forAll(fineDistribution, i)
|
|
||||||
|
Foam::labelList Foam::ptscotchDecomp::decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField& cellCentres,
|
||||||
|
const scalarField& cWeights
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Where to write graph
|
||||||
|
graphPath_ = "ptscotch";
|
||||||
|
|
||||||
|
if (!cellCentres.empty() && (cellCentres.size() != globalCellCells.size()))
|
||||||
{
|
{
|
||||||
fineDistribution[i] = decomp[agglom[i]];
|
FatalErrorInFunction
|
||||||
|
<< "Number of cell centres (" << cellCentres.size()
|
||||||
|
<< ") != number of cells (" << globalCellCells.size() << ")"
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fineDistribution;
|
// CompactListList is already
|
||||||
|
// Metis CSR (Compressed Storage Format) storage
|
||||||
|
// adjncy : contains neighbours (= edges in graph)
|
||||||
|
// xadj(celli) : start of information in adjncy for celli
|
||||||
|
|
||||||
|
// Decompose using default weights
|
||||||
|
labelList decomp;
|
||||||
|
decompose
|
||||||
|
(
|
||||||
|
globalCellCells.values(),
|
||||||
|
globalCellCells.offsets(),
|
||||||
|
cWeights,
|
||||||
|
decomp
|
||||||
|
);
|
||||||
|
|
||||||
|
return decomp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -624,22 +659,21 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
|||||||
// Where to write graph
|
// Where to write graph
|
||||||
graphPath_ = "ptscotch";
|
graphPath_ = "ptscotch";
|
||||||
|
|
||||||
if (cellCentres.size() != globalCellCells.size())
|
if (!cellCentres.empty() && (cellCentres.size() != globalCellCells.size()))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Inconsistent number of cells (" << globalCellCells.size()
|
<< "Number of cell centres (" << cellCentres.size()
|
||||||
<< ") and number of cell centres (" << cellCentres.size()
|
<< ") != number of cells (" << globalCellCells.size() << ")"
|
||||||
<< ")." << exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Make Metis CSR (Compressed Storage Format) storage
|
// Make Metis CSR (Compressed Storage Format) storage
|
||||||
// adjncy : contains neighbours (= edges in graph)
|
// adjncy : contains neighbours (= edges in graph)
|
||||||
// xadj(celli) : start of information in adjncy for celli
|
// xadj(celli) : start of information in adjncy for celli
|
||||||
|
|
||||||
auto cellCells(CompactListList<label>::pack(globalCellCells));
|
auto cellCells(CompactListList<label>::pack(globalCellCells));
|
||||||
|
|
||||||
// Decompose using weights
|
// Decompose using default weights
|
||||||
labelList decomp;
|
labelList decomp;
|
||||||
decompose
|
decompose
|
||||||
(
|
(
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -54,8 +54,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef ptscotchDecomp_H
|
#ifndef Foam_ptscotchDecomp_H
|
||||||
#define ptscotchDecomp_H
|
#define Foam_ptscotchDecomp_H
|
||||||
|
|
||||||
#include "decompositionMethod.H"
|
#include "decompositionMethod.H"
|
||||||
|
|
||||||
@ -90,6 +90,10 @@ class ptscotchDecomp
|
|||||||
labelList& decomp
|
labelList& decomp
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
ptscotchDecomp(const ptscotchDecomp&) = delete;
|
ptscotchDecomp(const ptscotchDecomp&) = delete;
|
||||||
|
|
||||||
@ -97,14 +101,15 @@ class ptscotchDecomp
|
|||||||
void operator=(const ptscotchDecomp&) = delete;
|
void operator=(const ptscotchDecomp&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("ptscotch");
|
TypeName("ptscotch");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with number of domains (no coefficients or constraints)
|
||||||
|
explicit ptscotchDecomp(const label numDomains);
|
||||||
|
|
||||||
//- Construct given decomposition dictionary and optional region name
|
//- Construct given decomposition dictionary and optional region name
|
||||||
explicit ptscotchDecomp
|
explicit ptscotchDecomp
|
||||||
(
|
(
|
||||||
@ -119,6 +124,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Knows about coupled boundaries
|
||||||
virtual bool parallelAware() const
|
virtual bool parallelAware() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -133,8 +139,8 @@ public:
|
|||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const pointField& points,
|
const pointField& points = pointField::null(),
|
||||||
const scalarField& pointWeights
|
const scalarField& pointWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
@ -146,8 +152,16 @@ public:
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& agglom,
|
const labelList& agglom,
|
||||||
const pointField& regionPoints,
|
const pointField& agglomPoints,
|
||||||
const scalarField& regionWeights
|
const scalarField& agglomWeights = scalarField::null()
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return for every coordinate the wanted processor number.
|
||||||
|
virtual labelList decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField& cc = pointField::null(),
|
||||||
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
@ -161,8 +175,8 @@ public:
|
|||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const labelListList& globalCellCells,
|
const labelListList& globalCellCells,
|
||||||
const pointField& cc,
|
const pointField& cc = pointField::null(),
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2021,2023 OpenCFD Ltd.
|
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -120,7 +120,7 @@ Foam::label Foam::scotchDecomp::decomposeSerial
|
|||||||
ConstPrecisionAdaptor<SCOTCH_Num, label, List> xadj_param(xadj);
|
ConstPrecisionAdaptor<SCOTCH_Num, label, List> xadj_param(xadj);
|
||||||
|
|
||||||
// Output: cell -> processor addressing
|
// Output: cell -> processor addressing
|
||||||
decomp.resize(numCells);
|
decomp.resize_nocopy(numCells);
|
||||||
decomp = 0;
|
decomp = 0;
|
||||||
PrecisionAdaptor<SCOTCH_Num, label, List> decomp_param(decomp, false);
|
PrecisionAdaptor<SCOTCH_Num, label, List> decomp_param(decomp, false);
|
||||||
|
|
||||||
@ -512,6 +512,12 @@ Foam::label Foam::scotchDecomp::decomposeSerial
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::scotchDecomp::scotchDecomp(const label numDomains)
|
||||||
|
:
|
||||||
|
metisLikeDecomp(numDomains)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::scotchDecomp::scotchDecomp
|
Foam::scotchDecomp::scotchDecomp
|
||||||
(
|
(
|
||||||
const dictionary& decompDict,
|
const dictionary& decompDict,
|
||||||
@ -548,7 +554,7 @@ Foam::labelList Foam::scotchDecomp::decompose
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& agglom,
|
const labelList& agglom,
|
||||||
const pointField& agglomPoints,
|
const pointField& agglomPoints,
|
||||||
const scalarField& pointWeights
|
const scalarField& agglomWeights
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Where to write graph
|
// Where to write graph
|
||||||
@ -559,7 +565,26 @@ Foam::labelList Foam::scotchDecomp::decompose
|
|||||||
mesh,
|
mesh,
|
||||||
agglom,
|
agglom,
|
||||||
agglomPoints,
|
agglomPoints,
|
||||||
pointWeights
|
agglomWeights
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::labelList Foam::scotchDecomp::decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField& cellCentres,
|
||||||
|
const scalarField& cWeights
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Where to write graph
|
||||||
|
graphPath_ = "scotch.grf";
|
||||||
|
|
||||||
|
return metisLikeDecomp::decompose
|
||||||
|
(
|
||||||
|
globalCellCells,
|
||||||
|
cellCentres,
|
||||||
|
cWeights
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2021,2023 OpenCFD Ltd.
|
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -249,8 +249,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef scotchDecomp_H
|
#ifndef Foam_scotchDecomp_H
|
||||||
#define scotchDecomp_H
|
#define Foam_scotchDecomp_H
|
||||||
|
|
||||||
#include "metisLikeDecomp.H"
|
#include "metisLikeDecomp.H"
|
||||||
|
|
||||||
@ -284,6 +284,9 @@ protected:
|
|||||||
labelList& decomp
|
labelList& decomp
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
scotchDecomp(const scotchDecomp&) = delete;
|
scotchDecomp(const scotchDecomp&) = delete;
|
||||||
@ -292,14 +295,15 @@ protected:
|
|||||||
void operator=(const scotchDecomp&) = delete;
|
void operator=(const scotchDecomp&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("scotch");
|
TypeName("scotch");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct with number of domains (no coefficients or constraints)
|
||||||
|
explicit scotchDecomp(const label numDomains);
|
||||||
|
|
||||||
//- Construct given decomposition dictionary and optional region name
|
//- Construct given decomposition dictionary and optional region name
|
||||||
explicit scotchDecomp
|
explicit scotchDecomp
|
||||||
(
|
(
|
||||||
@ -327,25 +331,33 @@ public:
|
|||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const pointField& points,
|
const pointField& points = pointField::null(),
|
||||||
const scalarField& pointWeights
|
const scalarField& pointWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return for every coordinate the wanted processor number.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const labelList& agglom,
|
const labelList& agglom, //!< agglomeration: fine-to-coarse
|
||||||
const pointField& regionPoints,
|
const pointField& agglomPoints,
|
||||||
const scalarField& regionWeights
|
const scalarField& agglomWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return for every coordinate the wanted processor number.
|
//- Return the wanted processor number for every cell.
|
||||||
|
virtual labelList decompose
|
||||||
|
(
|
||||||
|
const CompactListList<label>& globalCellCells,
|
||||||
|
const pointField& cc = pointField::null(),
|
||||||
|
const scalarField& cWeights = scalarField::null()
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return the wanted processor number for every cell.
|
||||||
virtual labelList decompose
|
virtual labelList decompose
|
||||||
(
|
(
|
||||||
const labelListList& globalCellCells,
|
const labelListList& globalCellCells,
|
||||||
const pointField& cc,
|
const pointField& cc = pointField::null(),
|
||||||
const scalarField& cWeights
|
const scalarField& cWeights = scalarField::null()
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -2,11 +2,9 @@ EXE_INC = \
|
|||||||
$(c++LESSWARN) \
|
$(c++LESSWARN) \
|
||||||
-I$(BOOST_INC_DIR) \
|
-I$(BOOST_INC_DIR) \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
|
|
||||||
-I$(LIB_SRC)/renumber/renumberMethods/lnInclude
|
-I$(LIB_SRC)/renumber/renumberMethods/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-L$(BOOST_LIB_DIR) -lboost_system \
|
-L$(BOOST_LIB_DIR) -lboost_system \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldecompositionMethods \
|
|
||||||
-lrenumberMethods
|
-lrenumberMethods
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,7 +30,7 @@ License
|
|||||||
|
|
||||||
#include "SloanRenumber.H"
|
#include "SloanRenumber.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "decompositionMethod.H"
|
#include "globalMeshData.H"
|
||||||
#include "processorPolyPatch.H"
|
#include "processorPolyPatch.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,7 +29,7 @@ License
|
|||||||
#include "CuthillMcKeeRenumber.H"
|
#include "CuthillMcKeeRenumber.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "bandCompression.H"
|
#include "bandCompression.H"
|
||||||
#include "decompositionMethod.H"
|
#include "globalMeshData.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ Foam::labelList Foam::CuthillMcKeeRenumber::renumber
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
decompositionMethod::calcCellCells
|
globalMeshData::calcCellCells
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
identity(mesh.nCells()),
|
identity(mesh.nCells()),
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude
|
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lmeshTools \
|
-lmeshTools
|
||||||
-ldecompositionMethods
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,7 +27,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "renumberMethod.H"
|
#include "renumberMethod.H"
|
||||||
#include "decompositionMethod.H"
|
#include "globalMeshData.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ Foam::labelList Foam::renumberMethod::renumber
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
decompositionMethod::calcCellCells
|
globalMeshData::calcCellCells
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
identity(mesh.nCells()),
|
identity(mesh.nCells()),
|
||||||
@ -117,7 +117,7 @@ Foam::labelList Foam::renumberMethod::renumber
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
CompactListList<label> coarseCellCells;
|
CompactListList<label> coarseCellCells;
|
||||||
decompositionMethod::calcCellCells
|
globalMeshData::calcCellCells
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
fineToCoarse,
|
fineToCoarse,
|
||||||
@ -132,15 +132,8 @@ Foam::labelList Foam::renumberMethod::renumber
|
|||||||
renumber(coarseCellCells, coarsePoints)
|
renumber(coarseCellCells, coarsePoints)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Rework back into renumbering for original mesh_
|
// From coarse back to fine for original mesh
|
||||||
labelList fineDistribution(fineToCoarse.size());
|
return labelList(coarseDistribution, fineToCoarse);
|
||||||
|
|
||||||
forAll(fineDistribution, i)
|
|
||||||
{
|
|
||||||
fineDistribution[i] = coarseDistribution[fineToCoarse[i]];
|
|
||||||
}
|
|
||||||
|
|
||||||
return fineDistribution;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,8 +27,8 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "springRenumber.H"
|
#include "springRenumber.H"
|
||||||
|
#include "globalMeshData.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "decompositionMethod.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ Foam::labelList Foam::springRenumber::renumber
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
CompactListList<label> cellCells;
|
CompactListList<label> cellCells;
|
||||||
decompositionMethod::calcCellCells
|
globalMeshData::calcCellCells
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
identity(mesh.nCells()),
|
identity(mesh.nCells()),
|
||||||
|
|||||||
Reference in New Issue
Block a user