/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2026 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
Class
Foam::CloudStateFieldRef
Description
Wrapper for a reference to a dynamic Lagrangian field. It provides
convenient access consistent with that of the derived fields so that
expressions involving both kinds of field are readable. It also ensures
that old-time fields are maintained for a sub-mesh for the duration of the
inner correction iterations.
See also
Foam::CloudStateField
Foam::CloudDerivedField
SourceFiles
CloudStateFieldRef.C
\*---------------------------------------------------------------------------*/
#ifndef CloudStateFieldRef_H
#define CloudStateFieldRef_H
#include "LagrangianModelRef.H"
#include "LagrangianFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class CloudStateFieldRef Declaration
\*---------------------------------------------------------------------------*/
template
class CloudStateFieldRef
{
private:
// Private Data
//- The field reference
LagrangianDynamicField& ref_;
//- The cached Lagrangian sub-all-field
mutable autoPtr> psiAllPtr_;
//- The cached Lagrangian sub-field
mutable autoPtr> psiSubSubPtr_;
//- The index of the sub-mesh
mutable uint64_t psiSubSubMeshIndex_;
public:
// Constructors
//- Construct from a field reference
CloudStateFieldRef(LagrangianDynamicField&);
// Member Functions
//- Access the field's name
const word& name() const;
//- Access the field's mesh
const LagrangianMesh& mesh() const;
//- Access the field's dimensions
const dimensionSet& dimensions() const;
//- Access a part of the field
const LagrangianSubSubField& ref(const LagrangianSubMesh&) const;
//- Access a part of the field
LagrangianSubSubField& ref(const LagrangianSubMesh&);
// Member Operators
//- Cast to the field
operator const LagrangianDynamicField&() const;
//- Cast to the field
operator LagrangianDynamicField&();
//- Access the entire field
const LagrangianDynamicField& operator()
(
const LagrangianMesh&
) const;
//- Access a part of the field
const LagrangianSubSubField& operator()
(
const LagrangianSubMesh& subMesh
) const;
//- Compute and return part of the field associated with a model
tmp> operator()
(
const LagrangianModelRef& model,
const LagrangianSubMesh& subMesh
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "CloudStateFieldRef.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //