ENH: simplify construction of zero-sized Clouds

- use Foam::zero as a dispatch tag

FIX: return moleculeCloud::constProps() List by reference not copy

STYLE: range-for when iterating cloud parcels

STYLE: more consistent typedefs / declarations for Clouds
This commit is contained in:
Mark Olesen
2023-12-13 11:07:13 +01:00
parent 0352a224b7
commit c9a9309b8c
46 changed files with 377 additions and 502 deletions

View File

@ -61,13 +61,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
DebugInFunction << "nPatchFaces: " << globalWalls.totalSize() << endl;
// Construct cloud
Cloud<findCellParticle> cloud
(
mesh_,
cloud::defaultName,
IDLList<findCellParticle>()
);
// Start with empty cloud
Cloud<findCellParticle> cloud(mesh_, Foam::zero{}, cloud::defaultName);
// Add particles to track to sample locations
nPatchFaces = 0;

View File

@ -47,13 +47,8 @@ namespace functionObjects
void Foam::functionObjects::streamLine::track()
{
IDLList<streamLineParticle> initialParticles;
streamLineParticleCloud particles
(
mesh_,
cloudName_,
initialParticles
);
// Start with empty cloud
streamLineParticleCloud particles(mesh_, Foam::zero{}, cloudName_);
const sampledSet& seedPoints = sampledSetPoints();

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,15 +54,4 @@ Foam::streamLineParticleCloud::streamLineParticleCloud
}
Foam::streamLineParticleCloud::streamLineParticleCloud
(
const polyMesh& mesh,
const word& cloudName,
const IDLList<streamLineParticle>& particles
)
:
Cloud<streamLineParticle>(mesh, cloudName, particles)
{}
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2022 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,22 +56,19 @@ class streamLineParticleCloud
{
public:
//- Type of parcel the cloud was instantiated for
//- Type of parcel within the cloud
typedef streamLineParticle parcelType;
//- No copy construct
streamLineParticleCloud(const streamLineParticleCloud&) = delete;
// Generated Methods
//- No copy construct
streamLineParticleCloud(const streamLineParticleCloud&) = delete;
//- No copy assignment
void operator=(const streamLineParticleCloud&) = delete;
//- No copy assignment
void operator=(const streamLineParticleCloud&) = delete;
// Constructors
//- Construct given mesh
//- Read construct
explicit streamLineParticleCloud
(
const polyMesh& mesh,
@ -79,13 +76,16 @@ public:
bool readFields = true
);
//- Construct from mesh, cloud name, and a list of particles
//- Construct without particles
streamLineParticleCloud
(
const polyMesh& mesh,
const word& cloudName,
const IDLList<streamLineParticle>& particles
);
const Foam::zero,
const word& cloudName = cloud::defaultName
)
:
Cloud<streamLineParticle>(mesh, Foam::zero{}, cloudName)
{}
};

View File

@ -142,12 +142,11 @@ void Foam::functionObjects::wallBoundedStreamLine::track()
// Find nearest wall particle for the seedPoints
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IDLList<wallBoundedStreamLineParticle> initialParticles;
wallBoundedStreamLineParticleCloud particles
(
mesh_,
cloudName_,
initialParticles
Foam::zero{},
cloudName_
);
{

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -52,15 +53,4 @@ Foam::wallBoundedStreamLineParticleCloud::wallBoundedStreamLineParticleCloud
}
Foam::wallBoundedStreamLineParticleCloud::wallBoundedStreamLineParticleCloud
(
const polyMesh& mesh,
const word& cloudName,
const IDLList<wallBoundedStreamLineParticle>& particles
)
:
Cloud<wallBoundedStreamLineParticle>(mesh, cloudName, particles)
{}
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,7 +28,7 @@ Class
Foam::wallBoundedStreamLineParticleCloud
Description
A Cloud of streamLine particles
A Cloud of wall-bounded streamLine particles
SourceFiles
streamLineCloud.C
@ -56,10 +56,9 @@ class wallBoundedStreamLineParticleCloud
{
public:
//- Type of parcel the cloud was instantiated for
//- Type of parcel within the cloud
typedef wallBoundedStreamLineParticle parcelType;
// Generated Methods
//- No copy construct
@ -74,7 +73,7 @@ public:
// Constructors
//- Construct given mesh
//- Read construct
explicit wallBoundedStreamLineParticleCloud
(
const polyMesh& mesh,
@ -82,13 +81,16 @@ public:
bool readFields = true
);
//- Construct from mesh, cloud name, and a list of particles
//- Construct without particles
wallBoundedStreamLineParticleCloud
(
const polyMesh& mesh,
const word& cloudName,
const IDLList<wallBoundedStreamLineParticle>& particles
);
const Foam::zero,
const word& cloudName = cloud::defaultName
)
:
Cloud<wallBoundedStreamLineParticle>(mesh, Foam::zero{}, cloudName)
{}
};