Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
e226745a
Commit
e226745a
authored
15 years ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
nonblocking transfer of particles
parent
d0e866f2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lagrangian/basic/Cloud/Cloud.C
+68
-84
68 additions, 84 deletions
src/lagrangian/basic/Cloud/Cloud.C
with
68 additions
and
84 deletions
src/lagrangian/basic/Cloud/Cloud.C
+
68
−
84
View file @
e226745a
...
...
@@ -105,20 +105,15 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td)
const
globalMeshData
&
pData
=
polyMesh_
.
globalData
();
const
labelList
&
processorPatches
=
pData
.
processorPatches
();
const
labelList
&
processorPatchIndices
=
pData
.
processorPatchIndices
();
const
labelList
&
processorPatchNeighbours
=
pData
.
processorPatchNeighbours
();
// Initialise the s
e
tpFraction moved for the particles
// Initialise the st
e
pFraction moved for the particles
forAllIter
(
typename
Cloud
<
ParticleType
>
,
*
this
,
pIter
)
{
pIter
().
stepFraction
()
=
0
;
}
// Assume there will be particles to transfer
bool
transfered
=
true
;
// While there are particles to transfer
while
(
tr
ansfered
)
while
(
tr
ue
)
{
// List of lists of particles to be transfered for all the processor
// patches
...
...
@@ -158,105 +153,94 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td)
}
}
if
(
Pstream
::
parRun
())
if
(
!
Pstream
::
parRun
())
{
// List of the numbers of particles to be transfered across the
// processor patches
labelList
nsTransPs
(
transferList
.
size
());
forAll
(
transferList
,
i
)
{
nsTransPs
[
i
]
=
transferList
[
i
].
size
();
}
break
;
}
// List of the numbers of particles to be transfered across the
// processor patches for all the processors
labelListList
allNTrans
(
Pstream
::
nProcs
());
allNTrans
[
Pstream
::
myProcNo
()]
=
nsTransPs
;
combineReduce
(
allNTrans
,
UPstream
::
listEq
());
transfered
=
false
;
// Allocate transfer buffers
PstreamBuffers
pBufs
(
Pstream
::
nonBlocking
);
forAll
(
allNTrans
,
i
)
// Stream into send buffers
forAll
(
transferList
,
i
)
{
if
(
transferList
[
i
].
size
())
{
forAll
(
allNTrans
[
i
],
j
)
{
if
(
allNTrans
[
i
][
j
])
{
transfered
=
true
;
break
;
}
}
}
UOPstream
particleStream
(
refCast
<
const
processorPolyPatch
>
(
pMesh
().
boundaryMesh
()[
processorPatches
[
i
]]
).
neighbProcNo
(),
pBufs
);
if
(
!
transfered
)
{
break
;
particleStream
<<
transferList
[
i
];
}
}
// Set up transfers when in non-blocking mode. Returns sizes (in bytes)
// to be sent/received.
labelListList
allNTrans
(
Pstream
::
nProcs
());
pBufs
.
finishedSends
(
allNTrans
);
forAll
(
transferList
,
i
)
bool
transfered
=
false
;
forAll
(
allNTrans
,
i
)
{
forAll
(
allNTrans
[
i
],
j
)
{
if
(
transferList
[
i
].
size
()
)
if
(
allNTrans
[
i
][
j
]
)
{
OPstream
particleStream
(
Pstream
::
blocking
,
refCast
<
const
processorPolyPatch
>
(
pMesh
().
boundaryMesh
()[
processorPatches
[
i
]]
).
neighbProcNo
()
);
particleStream
<<
transferList
[
i
];
transfered
=
true
;
break
;
}
}
}
forAll
(
processorPatches
,
i
)
{
label
patchi
=
processorPatches
[
i
];
if
(
!
transfered
)
{
break
;
}
const
processorPolyPatch
&
procPatch
=
refCast
<
const
processorPolyPatch
>
(
pMesh
().
boundaryMesh
()[
patchi
]);
label
neighbProci
=
procPatch
.
neighbProcNo
()
-
Pstream
::
masterNo
();
// Retrieve from receive buffers
forAll
(
processorPatches
,
i
)
{
label
patchi
=
processorPatches
[
i
];
label
neighbProcPatchi
=
processorPatchNeighbours
[
patchi
];
const
processorPolyPatch
&
procPatch
=
refCast
<
const
processorPolyPatch
>
(
pMesh
().
boundaryMesh
()[
patchi
]);
label
n
RecPs
=
allNTrans
[
neighbProci
][
neighbProc
Patchi
]
;
label
n
eighbProci
=
procPatch
.
neighbProc
No
()
;
if
(
nRecPs
)
{
IPstream
particleStream
(
Pstream
::
blocking
,
procPatch
.
neighbProcNo
()
);
IDLList
<
ParticleType
>
newParticles
(
particleStream
,
typename
ParticleType
::
iNew
(
*
this
)
);
label
nRecPs
=
allNTrans
[
neighbProci
][
Pstream
::
myProcNo
()];
forAllIter
(
typename
Cloud
<
ParticleType
>
,
newParticles
,
newpIter
)
{
ParticleType
&
newp
=
newpIter
();
newp
.
correctAfterParallelTransfer
(
patchi
,
td
);
addParticle
(
newParticles
.
remove
(
&
newp
));
}
if
(
nRecPs
)
{
UIPstream
particleStream
(
neighbProci
,
pBufs
);
IDLList
<
ParticleType
>
newParticles
(
particleStream
,
typename
ParticleType
::
iNew
(
*
this
)
);
forAllIter
(
typename
Cloud
<
ParticleType
>
,
newParticles
,
newpIter
)
{
ParticleType
&
newp
=
newpIter
();
newp
.
correctAfterParallelTransfer
(
patchi
,
td
);
addParticle
(
newParticles
.
remove
(
&
newp
));
}
}
}
else
{
transfered
=
false
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment