Skip to content
GitLab
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
51c32360
Commit
51c32360
authored
Aug 01, 2018
by
Mark OLESEN
Browse files
ENH: use bitSet operations in syncTools
- concise and more efficient
parent
49d9589d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C
View file @
51c32360
...
...
@@ -65,7 +65,7 @@ void Foam::syncTools::swapBoundaryCellPositions
Foam
::
bitSet
Foam
::
syncTools
::
getMasterPoints
(
const
polyMesh
&
mesh
)
{
bitSet
isMaster
(
mesh
.
nPoints
());
bitSet
donePoint
(
mesh
.
nPoints
());
bitSet
unvisited
(
mesh
.
nPoints
()
,
true
);
const
globalMeshData
&
globalData
=
mesh
.
globalData
();
const
labelList
&
meshPoints
=
globalData
.
coupledPatch
().
meshPoints
();
...
...
@@ -73,34 +73,19 @@ Foam::bitSet Foam::syncTools::getMasterPoints(const polyMesh& mesh)
const
labelListList
&
transformedSlaves
=
globalData
.
globalPointTransformedSlaves
();
forAll
(
meshPoints
,
coupledPoint
i
)
forAll
(
meshPoints
,
i
)
{
const
label
meshPointi
=
meshPoints
[
coupledPointi
];
if
(
(
slaves
[
coupledPointi
].
size
()
+
transformedSlaves
[
coupledPointi
].
size
()
)
>
0
)
const
label
meshPointi
=
meshPoints
[
i
];
if
(
!
slaves
[
i
].
empty
()
||
!
transformedSlaves
[
i
].
empty
())
{
isMaster
.
set
(
meshPointi
);
}
donePoint
.
set
(
meshPointi
);
unvisited
.
un
set
(
meshPointi
);
}
// Do all other points
// ~~~~~~~~~~~~~~~~~~~
forAll
(
donePoint
,
pointi
)
{
if
(
!
donePoint
.
test
(
pointi
))
{
isMaster
.
set
(
pointi
);
}
}
// Add in all unvisited points
isMaster
|=
unvisited
;
return
isMaster
;
}
...
...
@@ -109,7 +94,7 @@ Foam::bitSet Foam::syncTools::getMasterPoints(const polyMesh& mesh)
Foam
::
bitSet
Foam
::
syncTools
::
getMasterEdges
(
const
polyMesh
&
mesh
)
{
bitSet
isMaster
(
mesh
.
nEdges
());
bitSet
doneEdge
(
mesh
.
nEdges
());
bitSet
unvisited
(
mesh
.
nEdges
()
,
true
);
const
globalMeshData
&
globalData
=
mesh
.
globalData
();
const
labelList
&
meshEdges
=
globalData
.
coupledPatchMeshEdges
();
...
...
@@ -117,35 +102,20 @@ Foam::bitSet Foam::syncTools::getMasterEdges(const polyMesh& mesh)
const
labelListList
&
transformedSlaves
=
globalData
.
globalEdgeTransformedSlaves
();
forAll
(
meshEdges
,
coupledEdgeI
)
forAll
(
meshEdges
,
i
)
{
const
label
meshEdgeI
=
meshEdges
[
coupledEdgeI
];
if
(
(
slaves
[
coupledEdgeI
].
size
()
+
transformedSlaves
[
coupledEdgeI
].
size
()
)
>
0
)
{
isMaster
.
set
(
meshEdgeI
);
}
doneEdge
.
set
(
meshEdgeI
);
}
const
label
meshEdgei
=
meshEdges
[
i
];
// Do all other edges
// ~~~~~~~~~~~~~~~~~~
forAll
(
doneEdge
,
edgeI
)
{
if
(
!
doneEdge
.
test
(
edgeI
))
if
(
!
slaves
[
i
].
empty
()
||
!
transformedSlaves
[
i
].
empty
())
{
isMaster
.
set
(
e
dge
I
);
isMaster
.
set
(
meshE
dge
i
);
}
unvisited
.
unset
(
meshEdgei
);
}
// Add in all unvisited edges
isMaster
|=
unvisited
;
return
isMaster
;
}
...
...
@@ -160,15 +130,9 @@ Foam::bitSet Foam::syncTools::getMasterFaces(const polyMesh& mesh)
{
if
(
pp
.
coupled
())
{
const
coupledPolyPatch
&
cpp
=
refCast
<
const
coupledPolyPatch
>
(
pp
);
if
(
!
cpp
.
owner
())
if
(
!
refCast
<
const
coupledPolyPatch
>
(
pp
).
owner
())
{
forAll
(
pp
,
i
)
{
isMaster
.
unset
(
cpp
.
start
()
+
i
);
}
isMaster
.
unset
(
pp
.
range
());
}
}
}
...
...
@@ -192,18 +156,12 @@ Foam::bitSet Foam::syncTools::getInternalOrMasterFaces
{
if
(
!
refCast
<
const
coupledPolyPatch
>
(
pp
).
owner
())
{
forAll
(
pp
,
i
)
{
isMaster
.
unset
(
pp
.
start
()
+
i
);
}
isMaster
.
unset
(
pp
.
range
());
}
}
else
{
forAll
(
pp
,
i
)
{
isMaster
.
unset
(
pp
.
start
()
+
i
);
}
isMaster
.
unset
(
pp
.
range
());
}
}
...
...
@@ -224,10 +182,7 @@ Foam::bitSet Foam::syncTools::getInternalOrCoupledFaces
{
if
(
!
pp
.
coupled
())
{
forAll
(
pp
,
i
)
{
isMaster
.
unset
(
pp
.
start
()
+
i
);
}
isMaster
.
unset
(
pp
.
range
());
}
}
...
...
src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H
View file @
51c32360
...
...
@@ -587,26 +587,27 @@ public:
const
unsigned
int
nullValue
);
// Other
//- Get per point whether it is uncoupled or a master of a
// coupled set of points
static
bitSet
getMasterPoints
(
const
polyMesh
&
);
static
bitSet
getMasterPoints
(
const
polyMesh
&
mesh
);
//- Get per edge whether it is uncoupled or a master of a
// coupled set of edges
static
bitSet
getMasterEdges
(
const
polyMesh
&
);
static
bitSet
getMasterEdges
(
const
polyMesh
&
mesh
);
//- Get per face whether it is uncoupled or a master of a
// coupled set of faces
static
bitSet
getMasterFaces
(
const
polyMesh
&
);
static
bitSet
getMasterFaces
(
const
polyMesh
&
mesh
);
//- Get per face whether it is internal or a master of a
// coupled set of faces
static
bitSet
getInternalOrMasterFaces
(
const
polyMesh
&
);
static
bitSet
getInternalOrMasterFaces
(
const
polyMesh
&
mesh
);
//- Get per face whether it is internal or coupled
static
bitSet
getInternalOrCoupledFaces
(
const
polyMesh
&
);
static
bitSet
getInternalOrCoupledFaces
(
const
polyMesh
&
mesh
);
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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