Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
dafbfb5c
Commit
dafbfb5c
authored
Jun 04, 2010
by
mattijs
Browse files
ENH: multiLevel decomposition method.
parent
c9f9d384
Changes
30
Hide whitespace changes
Inline
Side-by-side
applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
View file @
dafbfb5c
...
...
@@ -334,8 +334,7 @@ int main(int argc, char *argv[])
(
decompositionMethod
::
New
(
decomposeDict
,
mesh
decomposeDict
)
);
decompositionMethod
&
decomposer
=
decomposerPtr
();
...
...
applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
View file @
dafbfb5c
...
...
@@ -489,11 +489,17 @@ int main(int argc, char *argv[])
);
autoPtr
<
decompositionMethod
>
decomposePtr
=
decompositionMethod
::
New
(
decomposeDict
,
mesh
decomposeDict
);
labelList
cellToRegion
(
decomposePtr
().
decompose
(
mesh
.
cellCentres
()));
labelList
cellToRegion
(
decomposePtr
().
decompose
(
mesh
,
mesh
.
cellCentres
()
)
);
// For debugging: write out region
{
...
...
applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
View file @
dafbfb5c
...
...
@@ -381,7 +381,8 @@ void subsetVolFields
const
fvMesh
&
mesh
,
const
fvMesh
&
subMesh
,
const
labelList
&
cellMap
,
const
labelList
&
faceMap
const
labelList
&
faceMap
,
const
labelHashSet
&
addedPatches
)
{
const
labelList
patchMap
(
identity
(
mesh
.
boundaryMesh
().
size
()));
...
...
@@ -412,14 +413,7 @@ void subsetVolFields
// get initialised.
forAll
(
tSubFld
().
boundaryField
(),
patchI
)
{
const
fvPatchField
<
typename
GeoField
::
value_type
>&
pfld
=
tSubFld
().
boundaryField
()[
patchI
];
if
(
isA
<
calculatedFvPatchField
<
typename
GeoField
::
value_type
>
>
(
pfld
)
)
if
(
addedPatches
.
found
(
patchI
))
{
tSubFld
().
boundaryField
()[
patchI
]
==
pTraits
<
typename
GeoField
::
value_type
>::
zero
;
...
...
@@ -440,7 +434,8 @@ void subsetSurfaceFields
(
const
fvMesh
&
mesh
,
const
fvMesh
&
subMesh
,
const
labelList
&
faceMap
const
labelList
&
faceMap
,
const
labelHashSet
&
addedPatches
)
{
const
labelList
patchMap
(
identity
(
mesh
.
boundaryMesh
().
size
()));
...
...
@@ -470,14 +465,7 @@ void subsetSurfaceFields
// get initialised.
forAll
(
tSubFld
().
boundaryField
(),
patchI
)
{
const
fvsPatchField
<
typename
GeoField
::
value_type
>&
pfld
=
tSubFld
().
boundaryField
()[
patchI
];
if
(
isA
<
calculatedFvsPatchField
<
typename
GeoField
::
value_type
>
>
(
pfld
)
)
if
(
addedPatches
.
found
(
patchI
))
{
tSubFld
().
boundaryField
()[
patchI
]
==
pTraits
<
typename
GeoField
::
value_type
>::
zero
;
...
...
@@ -852,6 +840,15 @@ void createAndWriteRegion
newMesh
);
// Make map of all added patches
labelHashSet
addedPatches
(
2
*
interfaceToPatch
.
size
());
forAllConstIter
(
EdgeMap
<
label
>
,
interfaceToPatch
,
iter
)
{
addedPatches
.
insert
(
iter
());
addedPatches
.
insert
(
iter
()
+
1
);
}
Info
<<
"Mapping fields"
<<
endl
;
// Map existing fields
...
...
@@ -863,66 +860,76 @@ void createAndWriteRegion
mesh
,
newMesh
(),
map
().
cellMap
(),
map
().
faceMap
()
map
().
faceMap
(),
addedPatches
);
subsetVolFields
<
volVectorField
>
(
mesh
,
newMesh
(),
map
().
cellMap
(),
map
().
faceMap
()
map
().
faceMap
(),
addedPatches
);
subsetVolFields
<
volSphericalTensorField
>
(
mesh
,
newMesh
(),
map
().
cellMap
(),
map
().
faceMap
()
map
().
faceMap
(),
addedPatches
);
subsetVolFields
<
volSymmTensorField
>
(
mesh
,
newMesh
(),
map
().
cellMap
(),
map
().
faceMap
()
map
().
faceMap
(),
addedPatches
);
subsetVolFields
<
volTensorField
>
(
mesh
,
newMesh
(),
map
().
cellMap
(),
map
().
faceMap
()
map
().
faceMap
(),
addedPatches
);
subsetSurfaceFields
<
surfaceScalarField
>
(
mesh
,
newMesh
(),
map
().
faceMap
()
map
().
faceMap
(),
addedPatches
);
subsetSurfaceFields
<
surfaceVectorField
>
(
mesh
,
newMesh
(),
map
().
faceMap
()
map
().
faceMap
(),
addedPatches
);
subsetSurfaceFields
<
surfaceSphericalTensorField
>
(
mesh
,
newMesh
(),
map
().
faceMap
()
map
().
faceMap
(),
addedPatches
);
subsetSurfaceFields
<
surfaceSymmTensorField
>
(
mesh
,
newMesh
(),
map
().
faceMap
()
map
().
faceMap
(),
addedPatches
);
subsetSurfaceFields
<
surfaceTensorField
>
(
mesh
,
newMesh
(),
map
().
faceMap
()
map
().
faceMap
(),
addedPatches
);
...
...
applications/utilities/parallelProcessing/decomposePar/decomposeParDict
View file @
dafbfb5c
...
...
@@ -19,6 +19,7 @@ FoamFile
numberOfSubdomains 4;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
...
...
@@ -28,15 +29,40 @@ numberOfSubdomains 4;
//preservePatches (cyclic_half0 cyclic_half1);
method scotch;
//
method scotch;
// method hierarchical;
// method simple;
// method metis;
// method manual;
method multiLevel;
multiLevelCoeffs
{
level0
{
numberOfSubdomains 2;
method simple;
simpleCoeffs
{
n (2 1 1);
delta 0.001;
}
}
level1
{
numberOfSubdomains 2;
method scotch;
}
}
// Desired output
simpleCoeffs
{
n (2
2
1);
n (2
1
1);
delta 0.001;
}
...
...
applications/utilities/parallelProcessing/decomposePar/domainDecompositionDistribute.C
View file @
dafbfb5c
...
...
@@ -109,13 +109,12 @@ void Foam::domainDecomposition::distributeCells()
autoPtr
<
decompositionMethod
>
decomposePtr
=
decompositionMethod
::
New
(
decompositionDict_
,
*
this
decompositionDict_
);
if
(
sameProcFaces
.
empty
())
{
cellToProc_
=
decomposePtr
().
decompose
(
cellCentres
());
cellToProc_
=
decomposePtr
().
decompose
(
*
this
,
cellCentres
());
}
else
{
...
...
@@ -174,7 +173,12 @@ void Foam::domainDecomposition::distributeCells()
// Do decomposition on agglomeration
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cellToProc_
=
decomposePtr
().
decompose
(
globalRegion
,
regionCentres
);
cellToProc_
=
decomposePtr
().
decompose
(
*
this
,
globalRegion
,
regionCentres
);
}
Info
<<
"
\n
Finished decomposition in "
...
...
applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C
View file @
dafbfb5c
...
...
@@ -594,8 +594,7 @@ int main(int argc, char *argv[])
(
decompositionMethod
::
New
(
decompositionDict
,
mesh
decompositionDict
)
);
...
...
@@ -612,7 +611,7 @@ int main(int argc, char *argv[])
<<
endl
;
}
finalDecomp
=
decomposer
().
decompose
(
mesh
.
cellCentres
());
finalDecomp
=
decomposer
().
decompose
(
mesh
,
mesh
.
cellCentres
());
}
// Dump decomposition to volScalarField
...
...
src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C
View file @
dafbfb5c
...
...
@@ -46,7 +46,7 @@ namespace Foam
(
decompositionMethod
,
metisDecomp
,
dictionary
Mesh
dictionary
);
}
...
...
@@ -80,12 +80,10 @@ Foam::label Foam::metisDecomp::decompose
Foam
::
metisDecomp
::
metisDecomp
(
const
dictionary
&
decompositionDict
,
const
polyMesh
&
mesh
const
dictionary
&
decompositionDict
)
:
decompositionMethod
(
decompositionDict
),
mesh_
(
mesh
)
decompositionMethod
(
decompositionDict
)
{}
...
...
@@ -93,6 +91,7 @@ Foam::metisDecomp::metisDecomp
Foam
::
labelList
Foam
::
metisDecomp
::
decompose
(
const
polyMesh
&
mesh
,
const
pointField
&
points
,
const
scalarField
&
pointWeights
)
...
...
@@ -112,6 +111,7 @@ Foam::labelList Foam::metisDecomp::decompose
Foam
::
labelList
Foam
::
metisDecomp
::
decompose
(
const
polyMesh
&
mesh
,
const
labelList
&
agglom
,
const
pointField
&
agglomPoints
,
const
scalarField
&
agglomWeights
...
...
src/dummyThirdParty/ptscotchDecomp/dummyPtscotchDecomp.C
View file @
dafbfb5c
...
...
@@ -48,7 +48,7 @@ namespace Foam
(
decompositionMethod
,
ptscotchDecomp
,
dictionary
Mesh
dictionary
);
}
...
...
@@ -85,12 +85,10 @@ Foam::label Foam::ptscotchDecomp::decompose
Foam
::
ptscotchDecomp
::
ptscotchDecomp
(
const
dictionary
&
decompositionDict
,
const
polyMesh
&
mesh
const
dictionary
&
decompositionDict
)
:
decompositionMethod
(
decompositionDict
),
mesh_
(
mesh
)
decompositionMethod
(
decompositionDict
)
{}
...
...
@@ -98,6 +96,7 @@ Foam::ptscotchDecomp::ptscotchDecomp
Foam
::
labelList
Foam
::
ptscotchDecomp
::
decompose
(
const
polyMesh
&
mesh
,
const
pointField
&
points
,
const
scalarField
&
pointWeights
)
...
...
@@ -117,6 +116,7 @@ Foam::labelList Foam::ptscotchDecomp::decompose
Foam
::
labelList
Foam
::
ptscotchDecomp
::
decompose
(
const
polyMesh
&
mesh
,
const
labelList
&
agglom
,
const
pointField
&
agglomPoints
,
const
scalarField
&
pointWeights
...
...
src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C
View file @
dafbfb5c
...
...
@@ -47,7 +47,7 @@ namespace Foam
(
decompositionMethod
,
scotchDecomp
,
dictionary
Mesh
dictionary
);
}
...
...
@@ -59,6 +59,7 @@ void Foam::scotchDecomp::check(const int retVal, const char* str)
Foam
::
label
Foam
::
scotchDecomp
::
decompose
(
const
fileName
&
meshPath
,
const
List
<
int
>&
adjncy
,
const
List
<
int
>&
xadj
,
const
scalarField
&
cWeights
,
...
...
@@ -68,13 +69,14 @@ Foam::label Foam::scotchDecomp::decompose
{
FatalErrorIn
(
"label scotchDecomp::decompose"
"("
"const List<int>&, "
"const List<int>&, "
"const scalarField&, "
"List<int>&"
")"
"label scotchDecomp::decompose
\n
"
"(
\n
"
"const fileName& meshPath,
\n
"
"const List<int>&,
\n
"
"const List<int>&,
\n
"
"const scalarField&,
\n
"
"List<int>&
\n
"
")
\n
"
)
<<
notImplementedMessage
<<
exit
(
FatalError
);
return
-
1
;
...
...
@@ -85,12 +87,10 @@ Foam::label Foam::scotchDecomp::decompose
Foam
::
scotchDecomp
::
scotchDecomp
(
const
dictionary
&
decompositionDict
,
const
polyMesh
&
mesh
const
dictionary
&
decompositionDict
)
:
decompositionMethod
(
decompositionDict
),
mesh_
(
mesh
)
decompositionMethod
(
decompositionDict
)
{}
...
...
@@ -98,6 +98,7 @@ Foam::scotchDecomp::scotchDecomp
Foam
::
labelList
Foam
::
scotchDecomp
::
decompose
(
const
polyMesh
&
mesh
,
const
pointField
&
points
,
const
scalarField
&
pointWeights
)
...
...
@@ -117,6 +118,7 @@ Foam::labelList Foam::scotchDecomp::decompose
Foam
::
labelList
Foam
::
scotchDecomp
::
decompose
(
const
polyMesh
&
mesh
,
const
labelList
&
agglom
,
const
pointField
&
agglomPoints
,
const
scalarField
&
pointWeights
...
...
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C
View file @
dafbfb5c
...
...
@@ -415,11 +415,7 @@ Foam::autoHexMeshDriver::autoHexMeshDriver
{
// Decomposition
decomposerPtr_
=
decompositionMethod
::
New
(
decomposeDict
,
mesh_
);
decomposerPtr_
=
decompositionMethod
::
New
(
decomposeDict
);
decompositionMethod
&
decomposer
=
decomposerPtr_
();
...
...
src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
View file @
dafbfb5c
...
...
@@ -1214,6 +1214,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance
// Normal decomposition
distribution
=
decomposer
.
decompose
(
mesh_
,
mesh_
.
cellCentres
(),
cellWeights
);
...
...
@@ -1224,6 +1225,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance
// Normal decomposition
distribution
=
decomposer
.
decompose
(
mesh_
,
mesh_
.
cellCentres
(),
cellWeights
);
...
...
src/meshTools/searchableSurface/distributedTriSurfaceMesh.C
View file @
dafbfb5c
...
...
@@ -34,6 +34,7 @@ License
#include
"IFstream.H"
#include
"decompositionMethod.H"
#include
"geomDecomp.H"
#include
"vectorList.H"
#include
"PackedBoolList.H"
...
...
@@ -855,6 +856,19 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
<<
" does not decompose in parallel."
<<
" Please choose one that does."
<<
exit
(
FatalError
);
}
if
(
!
isA
<
geomDecomp
>
(
decomposer_
()))
{
FatalErrorIn
(
"distributedTriSurfaceMesh::independentlyDistributedBbs"
"(const triSurface&)"
)
<<
"The decomposition method "
<<
decomposer_
().
typeName
<<
" is not a geometric decomposition method."
<<
endl
<<
"Only geometric decomposition methods are currently"
<<
" supported."
<<
exit
(
FatalError
);
}
}
// Do decomposition according to triangle centre
...
...
@@ -864,8 +878,11 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
triCentres
[
triI
]
=
s
[
triI
].
centre
(
s
.
points
());
}
geomDecomp
&
decomposer
=
refCast
<
geomDecomp
>
(
decomposer_
());
// Do the actual decomposition
labelList
distribution
(
decomposer
_
->
decompose
(
triCentres
));
labelList
distribution
(
decomposer
.
decompose
(
triCentres
));
// Find bounding box for all triangles on new distribution.
...
...
src/parallel/decompose/decompositionMethods/Make/files
View file @
dafbfb5c
...
...
@@ -3,5 +3,6 @@ geomDecomp/geomDecomp.C
simpleGeomDecomp/simpleGeomDecomp.C
hierarchGeomDecomp/hierarchGeomDecomp.C
manualDecomp/manualDecomp.C
multiLevelDecomp/multiLevelDecomp.C
LIB = $(FOAM_LIBBIN)/libdecompositionMethods
src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C
View file @
dafbfb5c
...
...
@@ -37,7 +37,6 @@ namespace Foam
{
defineTypeNameAndDebug
(
decompositionMethod
,
0
);
defineRunTimeSelectionTable
(
decompositionMethod
,
dictionary
);
defineRunTimeSelectionTable
(
decompositionMethod
,
dictionaryMesh
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
...
...
@@ -71,57 +70,45 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
}
Foam
::
autoPtr
<
Foam
::
decompositionMethod
>
Foam
::
decompositionMethod
::
New
(
const
dictionary
&
decompositionDict
,
const
polyMesh
&
mesh
)
{
const
word
methodType
(
decompositionDict
.
lookup
(
"method"
));
Info
<<
"Selecting decompositionMethod "
<<
methodType
<<
endl
;
dictionaryMeshConstructorTable
::
iterator
cstrIter
=
dictionaryMeshConstructorTablePtr_
->
find
(
methodType
);
if
(
cstrIter
==
dictionaryMeshConstructorTablePtr_
->
end
())
{
FatalErrorIn
(
"decompositionMethod::New"
"(const dictionary& decompositionDict, "
"const polyMesh& mesh)"
)
<<
"Unknown decompositionMethod "
<<
methodType
<<
nl
<<
nl
<<
"Valid decompositionMethods are : "
<<
endl
<<
dictionaryMeshConstructorTablePtr_
->
sortedToc
()
<<
exit
(
FatalError
);
}
return
autoPtr
<
decompositionMethod
>
(
cstrIter
()(
decompositionDict
,
mesh
));
}
Foam
::
labelList
Foam
::
decompositionMethod
::
decompose
(
const
polyMesh
&
mesh
,
const
pointField
&
points
)
{
scalarField
weights
(
0
);
scalarField
weights
(
points
.
size
(),
1
.
0
);
return
decompose
(
points
,
weights
);
return
decompose
(
mesh
,
points
,
weights
);
}
Foam
::
labelList
Foam
::
decompositionMethod
::
decompose
(
const
polyMesh
&
mesh
,
const
labelList
&
fineToCoarse
,
const
pointField
&
coarsePoints
,
const
scalarField
&
coarseWeights
)
{
CompactListList
<
label
>
coarseCellCells
;
calcCellCells
(
mesh
,
fineToCoarse
,
coarsePoints
.
size
(),
coarseCellCells
);
// Decompose based on agglomerated points
labelList
coarseDistribution
(
decompose
(
coarsePoints
,
coarseWeights
));
labelList
coarseDistribution
(
decompose
(
coarseCellCells
(),
coarsePoints
,
coarseWeights
)
);
// Rework back into decomposition for original mesh_
labelList
fineDistribution
(
fineToCoarse
.
size
());
...
...
@@ -137,22 +124,20 @@ Foam::labelList Foam::decompositionMethod::decompose
Foam
::
labelList
Foam
::
decompositionMethod
::
decompose
(
const
polyMesh
&
mesh
,
const
labelList
&
fineToCoarse
,
const
pointField
&