Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
c45fad83
Commit
c45fad83
authored
Jan 25, 2019
by
Mark Olesen
Browse files
ENH: add support for an output object registry for function objects
parent
c4aebc3c
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C
View file @
c45fad83
...
...
@@ -67,6 +67,25 @@ void Foam::functionObjectList::createStateDict() const
}
void
Foam
::
functionObjectList
::
createOutputRegistry
()
const
{
objectsRegistryPtr_
.
reset
(
new
objectRegistry
(
IOobject
(
"functionObjectObjects"
,
time_
.
timeName
(),
time_
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
)
)
);
}
Foam
::
autoPtr
<
Foam
::
functionObject
>
Foam
::
functionObjectList
::
remove
(
const
word
&
key
,
...
...
@@ -339,6 +358,7 @@ Foam::functionObjectList::functionObjectList
time_
(
runTime
),
parentDict_
(
runTime
.
controlDict
()),
stateDictPtr_
(),
objectsRegistryPtr_
(),
execution_
(
execution
),
updated_
(
false
)
{}
...
...
@@ -357,6 +377,7 @@ Foam::functionObjectList::functionObjectList
time_
(
runTime
),
parentDict_
(
parentDict
),
stateDictPtr_
(),
objectsRegistryPtr_
(),
execution_
(
execution
),
updated_
(
false
)
{}
...
...
@@ -491,6 +512,28 @@ const Foam::IOdictionary& Foam::functionObjectList::stateDict() const
}
Foam
::
objectRegistry
&
Foam
::
functionObjectList
::
storedObjects
()
{
if
(
!
objectsRegistryPtr_
.
valid
())
{
createOutputRegistry
();
}
return
*
objectsRegistryPtr_
;
}
const
Foam
::
objectRegistry
&
Foam
::
functionObjectList
::
storedObjects
()
const
{
if
(
!
objectsRegistryPtr_
.
valid
())
{
createOutputRegistry
();
}
return
*
objectsRegistryPtr_
;
}
void
Foam
::
functionObjectList
::
clear
()
{
PtrList
<
functionObject
>::
clear
();
...
...
src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H
View file @
c45fad83
...
...
@@ -84,6 +84,9 @@ class functionObjectList
//- Function object properties - stores state information
mutable
autoPtr
<
IOdictionary
>
stateDictPtr_
;
//- Function objects output registry
mutable
autoPtr
<
objectRegistry
>
objectsRegistryPtr_
;
//- Switch for the execution of the functionObjects
bool
execution_
;
...
...
@@ -102,6 +105,9 @@ class functionObjectList
//- Create state dictionary - attached to Time.
void
createStateDict
()
const
;
//- Create registry for output objects - attached to Time.
void
createOutputRegistry
()
const
;
//- Remove and return the function object pointer by name,
//- and returns the old index (into digest) via the parameter.
// Returns nullptr (and index -1) if it didn't exist
...
...
@@ -188,11 +194,21 @@ public:
void
resetState
();
//- Write access to the state dictionary ("functionObjectProperties")
//- registered on Time
IOdictionary
&
stateDict
();
//- Const access to the state dictionary ("functionObjectProperties")
//- registered on Time
const
IOdictionary
&
stateDict
()
const
;
//- Write access to the output objects ("functionObjectObjects")
//- registered on Time
objectRegistry
&
storedObjects
();
//- Const access to the output objects ("functionObjectObjects")
//- registered on Time
const
objectRegistry
&
storedObjects
()
const
;
//- Clear the list of function objects
void
clear
();
...
...
src/OpenFOAM/db/functionObjects/timeFunctionObject/timeFunctionObject.C
View file @
c45fad83
...
...
@@ -39,4 +39,20 @@ Foam::functionObjects::timeFunctionObject::timeFunctionObject
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam
::
objectRegistry
&
Foam
::
functionObjects
::
timeFunctionObject
::
storedObjects
()
{
return
const_cast
<
Time
&>
(
time_
).
functionObjects
().
storedObjects
();
}
const
Foam
::
objectRegistry
&
Foam
::
functionObjects
::
timeFunctionObject
::
storedObjects
()
const
{
return
time_
.
functionObjects
().
storedObjects
();
}
// ************************************************************************* //
src/OpenFOAM/db/functionObjects/timeFunctionObject/timeFunctionObject.H
View file @
c45fad83
...
...
@@ -92,6 +92,14 @@ public:
{
return
time_
;
}
//- Write access to the output objects ("functionObjectObjects")
//- registered on Time
objectRegistry
&
storedObjects
();
//- Const access to the output objects ("functionObjectObjects")
//- registered on Time
const
objectRegistry
&
storedObjects
()
const
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment