ENH: structuredDecomp: use patchSet

This commit is contained in:
mattijs
2012-03-26 12:15:32 +01:00
parent 5ff955752d
commit d7fb2360e5
2 changed files with 14 additions and 23 deletions

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,11 +49,11 @@ namespace Foam
Foam::structuredDecomp::structuredDecomp(const dictionary& decompositionDict) Foam::structuredDecomp::structuredDecomp(const dictionary& decompositionDict)
: :
decompositionMethod(decompositionDict), decompositionMethod(decompositionDict),
methodDict_(decompositionDict_.subDict(typeName + "Coeffs")) methodDict_(decompositionDict_.subDict(typeName + "Coeffs")),
patches_(methodDict_.lookup("patches"))
{ {
methodDict_.set("numberOfSubdomains", nDomains()); methodDict_.set("numberOfSubdomains", nDomains());
method_ = decompositionMethod::New(methodDict_); method_ = decompositionMethod::New(methodDict_);
patches_ = wordList(methodDict_.lookup("patches"));
} }
@ -72,29 +72,20 @@ Foam::labelList Foam::structuredDecomp::decompose
const scalarField& cWeights const scalarField& cWeights
) )
{ {
labelList patchIDs(patches_.size());
const polyBoundaryMesh& pbm = mesh.boundaryMesh(); const polyBoundaryMesh& pbm = mesh.boundaryMesh();
const labelHashSet patchIDs(pbm.patchSet(patches_));
label nFaces = 0; label nFaces = 0;
forAll(patches_, i) forAllConstIter(labelHashSet, patchIDs, iter)
{ {
patchIDs[i] = pbm.findPatchID(patches_[i]); nFaces += pbm[iter.key()].size();
if (patchIDs[i] == -1)
{
FatalErrorIn("structuredDecomp::decompose(..)")
<< "Cannot find patch " << patches_[i] << endl
<< "Valid patches are " << pbm.names()
<< exit(FatalError);
}
nFaces += pbm[patchIDs[i]].size();
} }
// Extract a submesh. // Extract a submesh.
labelHashSet patchCells(2*nFaces); labelHashSet patchCells(2*nFaces);
forAll(patchIDs, i) forAllConstIter(labelHashSet, patchIDs, iter)
{ {
const labelUList& fc = pbm[patchIDs[i]].faceCells(); const labelUList& fc = pbm[iter.key()].faceCells();
forAll(fc, i) forAll(fc, i)
{ {
patchCells.insert(fc[i]); patchCells.insert(fc[i]);
@ -127,9 +118,9 @@ Foam::labelList Foam::structuredDecomp::decompose
labelList patchFaces(nFaces); labelList patchFaces(nFaces);
List<topoDistanceData> patchData(nFaces); List<topoDistanceData> patchData(nFaces);
nFaces = 0; nFaces = 0;
forAll(patchIDs, i) forAllConstIter(labelHashSet, patchIDs, iter)
{ {
const polyPatch& pp = pbm[patchIDs[i]]; const polyPatch& pp = pbm[iter.key()];
const labelUList& fc = pp.faceCells(); const labelUList& fc = pp.faceCells();
forAll(fc, i) forAll(fc, i)
{ {

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Class
Foam::structuredDecomp Foam::structuredDecomp
Description Description
Decomposition given using consecutive application of decomposers. Decomposition by walking out decomposition of patch cells mesh.
SourceFiles SourceFiles
structuredDecomp.C structuredDecomp.C
@ -52,9 +52,9 @@ class structuredDecomp
dictionary methodDict_; dictionary methodDict_;
autoPtr<decompositionMethod> method_; wordReList patches_;
wordList patches_; autoPtr<decompositionMethod> method_;
// Private Member Functions // Private Member Functions