/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023-2025 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::MultiRegionRefs
Description
Class to wrap a UPtrList of of region-associated objects (meshes, solvers,
domainDecompositions, ...). Access will return a wrapped reference and will
set the Info prefix to the region name. The prefix will remain until the
wrapped reference goes out of scope.
\*---------------------------------------------------------------------------*/
#ifndef MultiRegionRefs_H
#define MultiRegionRefs_H
#include "IOstreams.H"
#include "regionName.H"
#include "UPtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template
class MultiRegionRefs;
/*---------------------------------------------------------------------------*\
Class RegionRef Declaration
\*---------------------------------------------------------------------------*/
template
class RegionRef
{
private:
// Private Data
//- The multi-region container
const MultiRegionRefs& mrr_;
//- Previous prefix to restore on destruction
const word previousPrefix_;
//- The region index
label regioni_;
//- Reference to the region object
Region& region_;
public:
// Constructors
//- Construct form components
template
RegionRef
(
const MultiRegionRefs& mrr,
const word& previousPrefix,
const label regioni,
Region& region
);
//- Disallow copy construct
RegionRef(const RegionRef& rp) = delete;
//- Move construct
RegionRef(RegionRef&& rp);
//- Destructor
~RegionRef();
// Member operators
//- Cast to reference
operator Region&() const;
//- Obtain the reference
Region& operator()() const;
};
/*---------------------------------------------------------------------------*\
Class MultiRegionRefs Declaration
\*---------------------------------------------------------------------------*/
template
class MultiRegionRefs
{
// Private Data
//- List of region pointers
UPtrList& regions_;
//- Previous prefix to restore on destruction
const word previousPrefix_;
//- Table to facilitate access by name
HashTable