mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
findFaces without allocation
This commit is contained in:
@ -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
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user