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
a64dfb52
Commit
a64dfb52
authored
Jun 19, 2009
by
mattijs
Browse files
findFaces without allocation
parent
0dcd3735
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/lagrangian/basic/Cloud/Cloud.H
View file @
a64dfb52
...
...
@@ -78,6 +78,9 @@ class Cloud
const
unallocLabelList
&
owner_
;
const
unallocLabelList
&
neighbour_
;
//- Temporary storage for addressing. Used in findFaces.
mutable
DynamicList
<
label
>
labels_
;
// Private member functions
...
...
src/lagrangian/basic/Particle/Particle.C
View file @
a64dfb52
...
...
@@ -36,16 +36,17 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template
<
class
ParticleType
>
Foam
::
labelList
Foam
::
Particle
<
ParticleType
>::
findFaces
void
Foam
::
Particle
<
ParticleType
>::
findFaces
(
const
vector
&
position
const
vector
&
position
,
DynamicList
<
label
>&
faceList
)
const
{
const
polyMesh
&
mesh
=
cloud_
.
polyMesh_
;
const
labelList
&
faces
=
mesh
.
cells
()[
celli_
];
const
vector
&
C
=
mesh
.
cellCentres
()[
celli_
];
DynamicList
<
label
>
faceList
(
10
);
faceList
.
clear
(
);
forAll
(
faces
,
i
)
{
label
facei
=
faces
[
i
];
...
...
@@ -56,26 +57,23 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
faceList
.
append
(
facei
);
}
}
faceList
.
shrink
();
return
faceList
;
}
template
<
class
ParticleType
>
Foam
::
labelList
Foam
::
Particle
<
ParticleType
>::
findFaces
void
Foam
::
Particle
<
ParticleType
>::
findFaces
(
const
vector
&
position
,
const
label
celli
,
const
scalar
stepFraction
const
scalar
stepFraction
,
DynamicList
<
label
>&
faceList
)
const
{
const
polyMesh
&
mesh
=
cloud_
.
polyMesh_
;
const
labelList
&
faces
=
mesh
.
cells
()[
celli
];
const
vector
&
C
=
mesh
.
cellCentres
()[
celli
];
DynamicList
<
label
>
faceList
(
10
);
faceList
.
clear
(
);
forAll
(
faces
,
i
)
{
label
facei
=
faces
[
i
];
...
...
@@ -86,10 +84,6 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
faceList
.
append
(
facei
);
}
}
faceList
.
shrink
();
return
faceList
;
}
...
...
@@ -237,7 +231,8 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
{
const
polyMesh
&
mesh
=
cloud_
.
polyMesh_
;
labelList
faces
=
findFaces
(
endPosition
);
DynamicList
<
label
>&
faces
=
cloud_
.
labels_
;
findFaces
(
endPosition
,
faces
);
facei_
=
-
1
;
scalar
trackFraction
=
0
.
0
;
...
...
src/lagrangian/basic/Particle/Particle.H
View file @
a64dfb52
...
...
@@ -151,18 +151,20 @@ protected:
const
label
facei
)
const
;
//-
Return
the faces between position and cell centre
labelList
findFaces
//-
Find
the faces between position and cell centre
void
findFaces
(
const
vector
&
position
const
vector
&
position
,
DynamicList
<
label
>&
faceList
)
const
;
//-
Return
the faces between position and cell centre
labelList
findFaces
//-
Find
the faces between position and cell centre
void
findFaces
(
const
vector
&
position
,
const
label
celli
,
const
scalar
stepFraction
const
scalar
stepFraction
,
DynamicList
<
label
>&
faceList
)
const
;
...
...
src/lagrangian/basic/Particle/ParticleI.H
View file @
a64dfb52
...
...
@@ -236,7 +236,8 @@ inline scalar Particle<ParticleType>::lambda
template
<
class
ParticleType
>
inline
bool
Particle
<
ParticleType
>::
inCell
()
const
{
labelList
faces
=
findFaces
(
position_
);
DynamicList
<
label
>&
faces
=
cloud_
.
labels_
;
findFaces
(
position_
,
faces
);
return
(
!
faces
.
size
());
}
...
...
@@ -250,7 +251,8 @@ inline bool Particle<ParticleType>::inCell
const
scalar
stepFraction
)
const
{
labelList
faces
=
findFaces
(
position
,
celli
,
stepFraction
);
DynamicList
<
label
>&
faces
=
cloud_
.
labels_
;
findFaces
(
position
,
celli
,
stepFraction
,
faces
);
return
(
!
faces
.
size
());
}
...
...
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