mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -227,19 +227,21 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
|
||||
pBufs.finishedSends();
|
||||
|
||||
|
||||
// The cloud name
|
||||
const word cloudName = lpi.name();
|
||||
|
||||
{
|
||||
// Temporarily rename original cloud so we can construct a new one
|
||||
// (to distribute the positions) without getting a duplicate
|
||||
// registration warning
|
||||
const word cloudName = lpi.name();
|
||||
lpi.rename(cloudName + "_old");
|
||||
|
||||
// New cloud on tgtMesh
|
||||
// New empty cloud on tgtMesh
|
||||
passivePositionParticleCloud lagrangianPositions
|
||||
(
|
||||
tgtMesh_,
|
||||
cloudName,
|
||||
IDLList<passivePositionParticle>()
|
||||
Foam::zero{},
|
||||
cloudName
|
||||
);
|
||||
|
||||
// Retrieve from receive buffers
|
||||
@ -310,11 +312,11 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
|
||||
// ).objectPath()
|
||||
// );
|
||||
//}
|
||||
|
||||
// Restore cloud name
|
||||
lpi.rename(cloudName);
|
||||
}
|
||||
|
||||
// Restore cloud name
|
||||
lpi.rename(cloudName);
|
||||
|
||||
|
||||
// The constructMap is in linear (processor) order
|
||||
return autoPtr<mapDistributeBase>::New
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,6 +34,7 @@ namespace Foam
|
||||
defineTemplateTypeNameAndDebug(Cloud<passivePositionParticle>, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::passivePositionParticleCloud::passivePositionParticleCloud
|
||||
@ -52,15 +53,4 @@ Foam::passivePositionParticleCloud::passivePositionParticleCloud
|
||||
}
|
||||
|
||||
|
||||
Foam::passivePositionParticleCloud::passivePositionParticleCloud
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& cloudName,
|
||||
const IDLList<passivePositionParticle>& particles
|
||||
)
|
||||
:
|
||||
Cloud<passivePositionParticle>(mesh, cloudName, particles)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,8 +34,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef passivePositionParticleCloud_H
|
||||
#define passivePositionParticleCloud_H
|
||||
#ifndef Foam_passivePositionParticleCloud_H
|
||||
#define Foam_passivePositionParticleCloud_H
|
||||
|
||||
#include "Cloud.H"
|
||||
#include "passivePositionParticle.H"
|
||||
@ -53,23 +53,21 @@ class passivePositionParticleCloud
|
||||
:
|
||||
public Cloud<passivePositionParticle>
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- No copy construct
|
||||
passivePositionParticleCloud
|
||||
(
|
||||
const passivePositionParticleCloud&
|
||||
) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const passivePositionParticleCloud&) = delete;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Type of parcel within the cloud
|
||||
typedef passivePositionParticle parcelType;
|
||||
|
||||
//- No copy construct
|
||||
passivePositionParticleCloud(const passivePositionParticleCloud&) = delete;
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const passivePositionParticleCloud&) = delete;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given mesh
|
||||
//- Read construct
|
||||
explicit passivePositionParticleCloud
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -77,13 +75,16 @@ public:
|
||||
bool readFields = true
|
||||
);
|
||||
|
||||
//- Construct from mesh, cloud name, and a list of particles
|
||||
//- Construct without particles
|
||||
passivePositionParticleCloud
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& cloudName,
|
||||
const IDLList<passivePositionParticle>& particles
|
||||
);
|
||||
const Foam::zero,
|
||||
const word& cloudName = cloud::defaultName
|
||||
)
|
||||
:
|
||||
Cloud<passivePositionParticle>(mesh, Foam::zero{}, cloudName)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,8 +36,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef unmappedPassivePositionParticleCloud_H
|
||||
#define unmappedPassivePositionParticleCloud_H
|
||||
#ifndef Foam_unmappedPassivePositionParticleCloud_H
|
||||
#define Foam_unmappedPassivePositionParticleCloud_H
|
||||
|
||||
#include "passivePositionParticleCloud.H"
|
||||
|
||||
@ -54,12 +54,11 @@ class unmappedPassivePositionParticleCloud
|
||||
:
|
||||
public passivePositionParticleCloud
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given mesh
|
||||
//- Read construct
|
||||
explicit unmappedPassivePositionParticleCloud
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -70,15 +69,15 @@ public:
|
||||
passivePositionParticleCloud(mesh, cloudName, readFields)
|
||||
{}
|
||||
|
||||
//- Construct from mesh, cloud name, and a list of particles
|
||||
//- Construct without particles
|
||||
unmappedPassivePositionParticleCloud
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& cloudName,
|
||||
const IDLList<passivePositionParticle>& particles
|
||||
const Foam::zero,
|
||||
const word& cloudName = cloud::defaultName
|
||||
)
|
||||
:
|
||||
passivePositionParticleCloud(mesh, cloudName, particles)
|
||||
passivePositionParticleCloud(mesh, Foam::zero{}, cloudName)
|
||||
{}
|
||||
|
||||
|
||||
@ -89,7 +88,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Switch off remapping of cells of particles when
|
||||
// mesh topology changes
|
||||
//- mesh topology changes
|
||||
virtual void autoMap(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user