Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
782bd24f
Commit
782bd24f
authored
Jan 14, 2009
by
mattijs
Browse files
unsynchronised looping
parent
f69806b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
View file @
782bd24f
...
...
@@ -488,17 +488,18 @@ labelList getNonRegionCells(const labelList& cellRegion, const label regionI)
}
// Get per region-region interface the sizes.
//
If sumParallel does merge
.
EdgeMap
<
label
>
getInterfaceSizes
// Get per region-region interface the sizes.
If sumParallel sums sizes.
//
Returns interfaces as straight list for looping in identical order
.
void
getInterfaceSizes
(
const
polyMesh
&
mesh
,
const
labelList
&
cellRegion
,
const
bool
sumParallel
const
bool
sumParallel
,
edgeList
&
interfaces
,
EdgeMap
<
label
>&
interfaceSizes
)
{
EdgeMap
<
label
>
interfaceSizes
;
forAll
(
mesh
.
faceNeighbour
(),
faceI
)
{
label
ownRegion
=
cellRegion
[
mesh
.
faceOwner
()[
faceI
]];
...
...
@@ -585,7 +586,12 @@ EdgeMap<label> getInterfaceSizes
}
}
return
interfaceSizes
;
// Make sure all processors have interfaces in same order
interfaces
=
interfaceSizes
.
toc
();
if
(
sumParallel
)
{
Pstream
::
scatter
(
interfaces
);
}
}
...
...
@@ -705,11 +711,7 @@ autoPtr<mapPolyMesh> createRegionMesh
if
(
otherRegion
!=
-
1
)
{
edge
interface
(
min
(
regionI
,
otherRegion
),
max
(
regionI
,
otherRegion
)
);
edge
interface
(
regionI
,
otherRegion
);
// Find the patch.
if
(
regionI
<
otherRegion
)
...
...
@@ -848,6 +850,7 @@ void createAndWriteRegion
const
polyBoundaryMesh
&
newPatches
=
newMesh
().
boundaryMesh
();
newPatches
.
checkParallelSync
(
true
);
// Delete empty patches
// ~~~~~~~~~~~~~~~~~~~~
...
...
@@ -863,13 +866,12 @@ void createAndWriteRegion
{
const
polyPatch
&
pp
=
newPatches
[
patchI
];
if
(
!
isA
<
processorPolyPatch
>
(
pp
)
&&
returnReduce
(
pp
.
size
(),
sumOp
<
label
>
())
>
0
)
if
(
!
isA
<
processorPolyPatch
>
(
pp
))
{
oldToNew
[
patchI
]
=
newI
++
;
if
(
returnReduce
(
pp
.
size
(),
sumOp
<
label
>
())
>
0
)
{
oldToNew
[
patchI
]
=
newI
++
;
}
}
}
...
...
@@ -983,10 +985,15 @@ void createAndWriteRegion
}
// Create for every region-region interface with non-zero size two patches.
// First one is for minimumregion to maximumregion.
// Note that patches get created in same order on all processors (if parallel)
// since looping over synchronised 'interfaces'.
EdgeMap
<
label
>
addRegionPatches
(
fvMesh
&
mesh
,
const
regionSplit
&
cellRegion
,
const
edgeList
&
interfaces
,
const
EdgeMap
<
label
>&
interfaceSizes
,
const
wordList
&
regionNames
)
...
...
@@ -998,15 +1005,12 @@ EdgeMap<label> addRegionPatches
EdgeMap
<
label
>
interfaceToPatch
(
cellRegion
.
nRegions
());
// Keep start of added patches for later.
label
minAddedPatchI
=
labelMax
;
forAllConstIter
(
EdgeMap
<
label
>
,
interfaceSizes
,
iter
)
forAll
(
interfaces
,
interI
)
{
if
(
iter
()
>
0
)
{
const
edge
&
e
=
iter
.
key
();
const
edge
&
e
=
interfaces
[
interI
];
if
(
interfaceSizes
[
e
]
>
0
)
{
label
patchI
=
addPatch
(
mesh
,
...
...
@@ -1025,12 +1029,9 @@ EdgeMap<label> addRegionPatches
<<
" "
<<
mesh
.
boundaryMesh
()[
patchI
].
name
()
<<
endl
;
interfaceToPatch
.
insert
(
iter
.
key
(),
patchI
);
minAddedPatchI
=
min
(
minAddedPatchI
,
patchI
);
interfaceToPatch
.
insert
(
e
,
patchI
);
}
}
//Info<< "minAddedPatchI:" << minAddedPatchI << endl;
return
interfaceToPatch
;
}
...
...
@@ -1348,24 +1349,26 @@ int main(int argc, char *argv[])
// Sizes of interface between regions. From pair of regions to number of
// faces.
EdgeMap
<
label
>
interfaceSizes
edgeList
interfaces
;
EdgeMap
<
label
>
interfaceSizes
;
getInterfaceSizes
(
getInterfaceSizes
(
mesh
,
cellRegion
,
true
// sum in parallel?
)
mesh
,
cellRegion
,
true
,
// sum in parallel?
interfaces
,
interfaceSizes
);
Info
<<
"Region
\t
Region
\t
Faces"
<<
nl
<<
"------
\t
------
\t
-----"
<<
endl
;
forAll
ConstIter
(
EdgeMap
<
label
>
,
interface
Size
s
,
iter
)
forAll
(
interfaces
,
i
n
ter
I
)
{
const
edge
&
e
=
iter
.
key
()
;
const
edge
&
e
=
i
n
ter
faces
[
interI
]
;
Info
<<
e
[
0
]
<<
'\t'
<<
e
[
1
]
<<
'\t'
<<
iter
()
<<
nl
;
Info
<<
e
[
0
]
<<
'\t'
<<
e
[
1
]
<<
'\t'
<<
i
n
ter
faceSizes
[
e
]
<<
nl
;
}
Info
<<
endl
;
...
...
@@ -1511,6 +1514,7 @@ int main(int argc, char *argv[])
(
mesh
,
cellRegion
,
interfaces
,
interfaceSizes
,
regionNames
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment