mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: lazy evaluation of subRegion in regionFunctionObject (#1202)
- delay dereferencing of optional subRegion entries until an objectRegistry is required. This improves usabilty when reference objects do not yet exist at the time of construction.
This commit is contained in:
committed by
Andrew Heather
parent
4e7ba1800a
commit
d1bc0d6e56
@ -29,8 +29,17 @@ Class
|
||||
Description
|
||||
Specialization of Foam::functionObject for a region and providing a
|
||||
reference to the region Foam::objectRegistry.
|
||||
Also provides support for referencing a sub-region, which is typically
|
||||
needed when dealing with surfMesh and their fields.
|
||||
|
||||
Also provides support for referencing an alternative objectRegistry
|
||||
that can hold fields. This may be used, for example, to access
|
||||
stored surfaces and fields.
|
||||
|
||||
Dictionary controls
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
region | Name of the mesh region | no | region0
|
||||
subRegion | Name for alternative objectRegistry | no | ""
|
||||
\endtable
|
||||
|
||||
See also
|
||||
Foam::functionObjects::stateFunctionObject
|
||||
@ -69,25 +78,19 @@ protected:
|
||||
|
||||
// Protected Member Data
|
||||
|
||||
//- Name for alternative object registry
|
||||
word subRegistryName_;
|
||||
|
||||
//- Reference to the region objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Optional reference to the sub-region objectRegistry.
|
||||
// If a sub-region is not in effect, this reference is identical
|
||||
// to the usual region objectRegistry.
|
||||
const objectRegistry& subObr_;
|
||||
//- Pointer to alternative (eg, sub-region) objectRegistry.
|
||||
// If a sub-region is not in effect, this is a nullptr
|
||||
mutable const objectRegistry* obrPtr_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Selector for alternative sub-registry,
|
||||
// when the keyword %subRegion is present in the dictionary
|
||||
static const objectRegistry& whichSubRegistry
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- The region or sub-region registry being used
|
||||
virtual const objectRegistry& obr() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user