IOPosition: Extended to use with primitive lists of particles

This commit is contained in:
Will Bainbridge
2023-01-03 08:46:47 +00:00
parent d02f516426
commit afc5c00104
3 changed files with 27 additions and 6 deletions

View File

@ -128,6 +128,7 @@ public:
typedef ParticleType particleType;
typedef typename IDLList<ParticleType>::value_type value_type;
typedef typename IDLList<ParticleType>::iterator iterator;
typedef typename IDLList<ParticleType>::const_iterator const_iterator;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,10 +24,23 @@ License
\*---------------------------------------------------------------------------*/
#include "IOPosition.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::IOPosition<CloudType>::IOPosition
(
const IOobject& io,
const polyMesh& mesh,
const CloudType& c
)
:
regIOobject(io),
mesh_(mesh),
cloud_(c)
{}
template<class CloudType>
Foam::IOPosition<CloudType>::IOPosition(const CloudType& c)
:
@ -42,6 +55,7 @@ Foam::IOPosition<CloudType>::IOPosition(const CloudType& c)
IOobject::NO_WRITE
)
),
mesh_(c.pMesh()),
cloud_(c)
{}
@ -90,7 +104,7 @@ void Foam::IOPosition<CloudType>::readData(Istream& is, CloudType& c)
for (label i=0; i<s; i++)
{
// Read position only
c.append(new typename CloudType::particleType(is, false));
c.append(new typename CloudType::value_type(is, false));
}
// Read end of contents
@ -119,7 +133,7 @@ void Foam::IOPosition<CloudType>::readData(Istream& is, CloudType& c)
is.putBack(lastToken);
// Read position only
c.append(new typename CloudType::particleType(is, false));
c.append(new typename CloudType::value_type(is, false));
is >> lastToken;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,7 +35,7 @@ SourceFiles
#ifndef IOPosition_H
#define IOPosition_H
#include "regIOobject.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,6 +62,9 @@ class IOPosition
// Private Data
//- Reference to the mesh
const polyMesh& mesh_;
//- Reference to the cloud
const CloudType& cloud_;
@ -80,6 +83,9 @@ public:
// Constructors
//- Construct from components
IOPosition(const IOobject&, const polyMesh&, const CloudType&);
//- Construct from cloud
IOPosition(const CloudType&);