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-plus
Commits
fb1ed2e4
Commit
fb1ed2e4
authored
Jun 04, 2016
by
Henry Weller
Browse files
ORourkeCollision: use a CompactListList to avoid memory allocation overhead
parent
ca45cf16
Changes
1
Show whitespace changes
Inline
Side-by-side
src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C
View file @
fb1ed2e4
...
...
@@ -24,8 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include
"ORourkeCollision.H"
#include
"mathematicalConstants.H"
#include
"SLGThermo.H"
#include
"CompactListList.H"
#include
"mathematicalConstants.H"
using
namespace
Foam
::
constant
::
mathematical
;
...
...
@@ -34,12 +35,23 @@ using namespace Foam::constant::mathematical;
template
<
class
CloudType
>
void
Foam
::
ORourkeCollision
<
CloudType
>::
collide
(
const
scalar
dt
)
{
// Create a list of parcels in each cell
List
<
DynamicList
<
parcelType
*>>
pInCell
(
this
->
owner
().
mesh
().
nCells
());
// Create the occupancy list for the cells
labelList
occupancy
(
this
->
owner
().
mesh
().
nCells
(),
0
);
forAllIter
(
typename
CloudType
,
this
->
owner
(),
iter
)
{
occupancy
[
iter
().
cell
()]
++
;
}
// Initialize the sizes of the lists of parcels in each cell
CompactListList
<
parcelType
*>
pInCell
(
occupancy
);
// Reset the occupancy to use as a counter
occupancy
=
0
;
// Set the parcel pointer lists for each cell
forAllIter
(
typename
CloudType
,
this
->
owner
(),
iter
)
{
pInCell
[
iter
().
cell
()
].
append
(
&
iter
()
)
;
pInCell
(
iter
().
cell
()
,
occupancy
[
iter
().
cell
()]
++
)
=
&
iter
();
}
for
(
label
celli
=
0
;
celli
<
this
->
owner
().
mesh
().
nCells
();
celli
++
)
...
...
Write
Preview
Supports
Markdown
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