Commit 8f92fa01 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

ENH: write/clear on all components (issue #1199)

- use registry checkOut for removeRegisteredObject function object
parent f6d462a2
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation
......@@ -68,37 +68,31 @@ Foam::functionObjects::components::components
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::components::~components()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
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 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
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016 OpenFOAM Foundation
......@@ -103,7 +103,7 @@ public:
//- Destructor
virtual ~components();
virtual ~components() = default;
// Member Functions
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2013-2016 OpenFOAM Foundation
......@@ -64,12 +64,6 @@ Foam::functionObjects::removeRegisteredObject::removeRegisteredObject
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::removeRegisteredObject::~removeRegisteredObject()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
......@@ -86,7 +80,7 @@ bool Foam::functionObjects::removeRegisteredObject::execute()
{
for (const word& objName : objectNames_)
{
regIOobject* ptr = getObjectPtr<regIOobject>(objName);
regIOobject* ptr = findObject<regIOobject>(objName);
if (ptr && ptr->ownedByRegistry())
{
......@@ -94,8 +88,7 @@ bool Foam::functionObjects::removeRegisteredObject::execute()
<< " removing object " << ptr->name() << nl
<< endl;
ptr->release();
delete ptr;
ptr->checkOut();
}
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2016, 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2013-2016 OpenFOAM Foundation
......@@ -80,7 +80,7 @@ class removeRegisteredObject
:
public regionFunctionObject
{
// Private data
// Private Data
//- Names of objects to control
wordList objectNames_;
......@@ -113,13 +113,13 @@ public:
//- Destructor
virtual ~removeRegisteredObject();
virtual ~removeRegisteredObject() = default;
// Member Functions
//- Read the removeRegisteredObject data
virtual bool read(const dictionary&);
virtual bool read(const dictionary& dict);
//- Remove the registered objects
virtual bool execute();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment