ENH: decomposePar: decomposing cellSets, faceSets, pointSets

This commit is contained in:
mattijs
2013-06-14 12:46:32 +01:00
parent 0240347e10
commit ba45a48caf
3 changed files with 94 additions and 4 deletions

View File

@ -55,6 +55,9 @@ Usage
\param -fields \n
Use existing geometry decomposition and convert fields only.
\param -sets \n
Decompose cellSets, faceSets, pointSets.
\param -force \n
Remove any existing \a processor subdirectories before decomposing the
geometry.
@ -127,6 +130,11 @@ int main(int argc, char *argv[])
"use existing geometry decomposition and convert fields only"
);
argList::addBoolOption
(
"sets",
"decompose cellSets, faceSets, pointSets"
);
argList::addBoolOption
(
"force",
"remove existing processor*/ subdirs before decomposing the geometry"
@ -146,6 +154,7 @@ int main(int argc, char *argv[])
bool writeCellDist = args.optionFound("cellDist");
bool copyUniform = args.optionFound("copyUniform");
bool decomposeFieldsOnly = args.optionFound("fields");
bool decomposeSets = args.optionFound("sets");
bool forceOverwrite = args.optionFound("force");
bool ifRequiredDecomposition = args.optionFound("ifRequired");
@ -312,7 +321,7 @@ int main(int argc, char *argv[])
{
mesh.decomposeMesh();
mesh.writeDecomposition();
mesh.writeDecomposition(decomposeSets);
if (writeCellDist)
{

View File

@ -34,6 +34,10 @@ License
#include "globalMeshData.H"
#include "DynamicList.H"
#include "fvFieldDecomposer.H"
#include "IOobjectList.H"
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -123,7 +127,7 @@ Foam::domainDecomposition::~domainDecomposition()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::domainDecomposition::writeDecomposition()
bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
{
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 totProcFaces = 0;
label maxProcPatches = 0;
@ -732,6 +767,52 @@ bool Foam::domainDecomposition::writeDecomposition()
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
if (facesInstancePointsPtr_.valid())
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -172,7 +172,7 @@ public:
void decomposeMesh();
//- Write decomposition
bool writeDecomposition();
bool writeDecomposition(const bool decomposeSets);
//- Cell-processor decomposition labels
const labelList& cellToProc() const