mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: decomposePar: decomposing cellSets, faceSets, pointSets
This commit is contained in:
@ -55,6 +55,9 @@ Usage
|
|||||||
\param -fields \n
|
\param -fields \n
|
||||||
Use existing geometry decomposition and convert fields only.
|
Use existing geometry decomposition and convert fields only.
|
||||||
|
|
||||||
|
\param -sets \n
|
||||||
|
Decompose cellSets, faceSets, pointSets.
|
||||||
|
|
||||||
\param -force \n
|
\param -force \n
|
||||||
Remove any existing \a processor subdirectories before decomposing the
|
Remove any existing \a processor subdirectories before decomposing the
|
||||||
geometry.
|
geometry.
|
||||||
@ -127,6 +130,11 @@ int main(int argc, char *argv[])
|
|||||||
"use existing geometry decomposition and convert fields only"
|
"use existing geometry decomposition and convert fields only"
|
||||||
);
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"sets",
|
||||||
|
"decompose cellSets, faceSets, pointSets"
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"force",
|
"force",
|
||||||
"remove existing processor*/ subdirs before decomposing the geometry"
|
"remove existing processor*/ subdirs before decomposing the geometry"
|
||||||
@ -146,6 +154,7 @@ int main(int argc, char *argv[])
|
|||||||
bool writeCellDist = args.optionFound("cellDist");
|
bool writeCellDist = args.optionFound("cellDist");
|
||||||
bool copyUniform = args.optionFound("copyUniform");
|
bool copyUniform = args.optionFound("copyUniform");
|
||||||
bool decomposeFieldsOnly = args.optionFound("fields");
|
bool decomposeFieldsOnly = args.optionFound("fields");
|
||||||
|
bool decomposeSets = args.optionFound("sets");
|
||||||
bool forceOverwrite = args.optionFound("force");
|
bool forceOverwrite = args.optionFound("force");
|
||||||
bool ifRequiredDecomposition = args.optionFound("ifRequired");
|
bool ifRequiredDecomposition = args.optionFound("ifRequired");
|
||||||
|
|
||||||
@ -312,7 +321,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
mesh.decomposeMesh();
|
mesh.decomposeMesh();
|
||||||
|
|
||||||
mesh.writeDecomposition();
|
mesh.writeDecomposition(decomposeSets);
|
||||||
|
|
||||||
if (writeCellDist)
|
if (writeCellDist)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,6 +34,10 @@ License
|
|||||||
#include "globalMeshData.H"
|
#include "globalMeshData.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "fvFieldDecomposer.H"
|
#include "fvFieldDecomposer.H"
|
||||||
|
#include "IOobjectList.H"
|
||||||
|
#include "cellSet.H"
|
||||||
|
#include "faceSet.H"
|
||||||
|
#include "pointSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -123,7 +127,7 @@ Foam::domainDecomposition::~domainDecomposition()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::domainDecomposition::writeDecomposition()
|
bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
|
||||||
{
|
{
|
||||||
Info<< "\nConstructing processor meshes" << endl;
|
Info<< "\nConstructing processor meshes" << endl;
|
||||||
|
|
||||||
@ -160,6 +164,37 @@ bool Foam::domainDecomposition::writeDecomposition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PtrList<const cellSet> cellSets;
|
||||||
|
PtrList<const faceSet> faceSets;
|
||||||
|
PtrList<const pointSet> pointSets;
|
||||||
|
if (decomposeSets)
|
||||||
|
{
|
||||||
|
// Read sets
|
||||||
|
IOobjectList objects(*this, facesInstance(), "polyMesh/sets");
|
||||||
|
{
|
||||||
|
IOobjectList cSets(objects.lookupClass(cellSet::typeName));
|
||||||
|
forAllConstIter(IOobjectList, cSets, iter)
|
||||||
|
{
|
||||||
|
cellSets.append(new cellSet(*iter()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
IOobjectList fSets(objects.lookupClass(faceSet::typeName));
|
||||||
|
forAllConstIter(IOobjectList, fSets, iter)
|
||||||
|
{
|
||||||
|
faceSets.append(new faceSet(*iter()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
IOobjectList pSets(objects.lookupClass(pointSet::typeName));
|
||||||
|
forAllConstIter(IOobjectList, pSets, iter)
|
||||||
|
{
|
||||||
|
pointSets.append(new pointSet(*iter()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
label maxProcCells = 0;
|
label maxProcCells = 0;
|
||||||
label totProcFaces = 0;
|
label totProcFaces = 0;
|
||||||
label maxProcPatches = 0;
|
label maxProcPatches = 0;
|
||||||
@ -732,6 +767,52 @@ bool Foam::domainDecomposition::writeDecomposition()
|
|||||||
|
|
||||||
procMesh.write();
|
procMesh.write();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (decomposeSets)
|
||||||
|
{
|
||||||
|
forAll(cellSets, i)
|
||||||
|
{
|
||||||
|
const cellSet& cs = cellSets[i];
|
||||||
|
cellSet set(procMesh, cs.name(), cs.size()/nProcs_);
|
||||||
|
forAll(curCellLabels, i)
|
||||||
|
{
|
||||||
|
if (cs.found(curCellLabels[i]))
|
||||||
|
{
|
||||||
|
set.insert(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set.write();
|
||||||
|
}
|
||||||
|
forAll(faceSets, i)
|
||||||
|
{
|
||||||
|
const faceSet& cs = faceSets[i];
|
||||||
|
faceSet set(procMesh, cs.name(), cs.size()/nProcs_);
|
||||||
|
forAll(curFaceLabels, i)
|
||||||
|
{
|
||||||
|
if (cs.found(mag(curFaceLabels[i])-1))
|
||||||
|
{
|
||||||
|
set.insert(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set.write();
|
||||||
|
}
|
||||||
|
forAll(pointSets, i)
|
||||||
|
{
|
||||||
|
const pointSet& cs = pointSets[i];
|
||||||
|
pointSet set(procMesh, cs.name(), cs.size()/nProcs_);
|
||||||
|
forAll(curPointLabels, i)
|
||||||
|
{
|
||||||
|
if (cs.found(curPointLabels[i]))
|
||||||
|
{
|
||||||
|
set.insert(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write points if pointsInstance differing from facesInstance
|
// Write points if pointsInstance differing from facesInstance
|
||||||
if (facesInstancePointsPtr_.valid())
|
if (facesInstancePointsPtr_.valid())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -172,7 +172,7 @@ public:
|
|||||||
void decomposeMesh();
|
void decomposeMesh();
|
||||||
|
|
||||||
//- Write decomposition
|
//- Write decomposition
|
||||||
bool writeDecomposition();
|
bool writeDecomposition(const bool decomposeSets);
|
||||||
|
|
||||||
//- Cell-processor decomposition labels
|
//- Cell-processor decomposition labels
|
||||||
const labelList& cellToProc() const
|
const labelList& cellToProc() const
|
||||||
|
|||||||
Reference in New Issue
Block a user