mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: write/clear on all components (issue #1199)
- use registry checkOut for removeRegisteredObject function object
This commit is contained in:
committed by
Andrew Heather
parent
f6d462a246
commit
8f92fa016f
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2016 OpenFOAM Foundation
|
| Copyright (C) 2016 OpenFOAM Foundation
|
||||||
@ -68,37 +68,31 @@ Foam::functionObjects::components::components
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::functionObjects::components::~components()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::functionObjects::components::write()
|
bool Foam::functionObjects::components::write()
|
||||||
{
|
{
|
||||||
bool written = true;
|
bool ok = true;
|
||||||
|
|
||||||
forAll(resultNames_, i)
|
for (const word& result : resultNames_)
|
||||||
{
|
{
|
||||||
written = written && writeObject(resultNames_[i]);
|
ok = writeObject(result) && ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
return written;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::components::clear()
|
bool Foam::functionObjects::components::clear()
|
||||||
{
|
{
|
||||||
bool cleared = true;
|
bool ok = true;
|
||||||
|
|
||||||
forAll(resultNames_, i)
|
for (const word& result : resultNames_)
|
||||||
{
|
{
|
||||||
cleared = cleared && clearObject(resultNames_[i]);
|
ok = clearObject(result) && ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cleared;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2016 OpenFOAM Foundation
|
| Copyright (C) 2016 OpenFOAM Foundation
|
||||||
@ -103,7 +103,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~components();
|
virtual ~components() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2013-2016 OpenFOAM Foundation
|
| Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||||
@ -64,12 +64,6 @@ Foam::functionObjects::removeRegisteredObject::removeRegisteredObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::functionObjects::removeRegisteredObject::~removeRegisteredObject()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
|
bool Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
|
||||||
@ -86,7 +80,7 @@ bool Foam::functionObjects::removeRegisteredObject::execute()
|
|||||||
{
|
{
|
||||||
for (const word& objName : objectNames_)
|
for (const word& objName : objectNames_)
|
||||||
{
|
{
|
||||||
regIOobject* ptr = getObjectPtr<regIOobject>(objName);
|
regIOobject* ptr = findObject<regIOobject>(objName);
|
||||||
|
|
||||||
if (ptr && ptr->ownedByRegistry())
|
if (ptr && ptr->ownedByRegistry())
|
||||||
{
|
{
|
||||||
@ -94,8 +88,7 @@ bool Foam::functionObjects::removeRegisteredObject::execute()
|
|||||||
<< " removing object " << ptr->name() << nl
|
<< " removing object " << ptr->name() << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
ptr->release();
|
ptr->checkOut();
|
||||||
delete ptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2015-2016, 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2013-2016 OpenFOAM Foundation
|
| Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||||
@ -80,7 +80,7 @@ class removeRegisteredObject
|
|||||||
:
|
:
|
||||||
public regionFunctionObject
|
public regionFunctionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Names of objects to control
|
//- Names of objects to control
|
||||||
wordList objectNames_;
|
wordList objectNames_;
|
||||||
@ -113,13 +113,13 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~removeRegisteredObject();
|
virtual ~removeRegisteredObject() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Read the removeRegisteredObject data
|
//- Read the removeRegisteredObject data
|
||||||
virtual bool read(const dictionary&);
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
//- Remove the registered objects
|
//- Remove the registered objects
|
||||||
virtual bool execute();
|
virtual bool execute();
|
||||||
|
|||||||
Reference in New Issue
Block a user