unwatchedIOdictionary: Removed with associated clutter
IOdictionary is now used instead of unwatchedIOdictionary
This commit is contained in:
@ -237,7 +237,6 @@ IOdictionary = db/IOobjects/IOdictionary
|
||||
$(IOdictionary)/baseIOdictionary.C
|
||||
$(IOdictionary)/baseIOdictionaryIO.C
|
||||
$(IOdictionary)/IOdictionary.C
|
||||
$(IOdictionary)/unwatchedIOdictionary.C
|
||||
$(IOdictionary)/localIOdictionary.C
|
||||
|
||||
db/IOobjects/IOMap/IOMapName.C
|
||||
|
||||
@ -1,124 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2020 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "unwatchedIOdictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::unwatchedIOdictionary::unwatchedIOdictionary(const IOobject& io)
|
||||
:
|
||||
baseIOdictionary(io)
|
||||
{
|
||||
readHeaderOk(IOstream::ASCII, typeName);
|
||||
|
||||
// For if MUST_READ_IF_MODIFIED
|
||||
addWatch();
|
||||
}
|
||||
|
||||
|
||||
Foam::unwatchedIOdictionary::unwatchedIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
baseIOdictionary(io)
|
||||
{
|
||||
if (!readHeaderOk(IOstream::ASCII, typeName))
|
||||
{
|
||||
dictionary::operator=(dict);
|
||||
}
|
||||
|
||||
// For if MUST_READ_IF_MODIFIED
|
||||
addWatch();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::unwatchedIOdictionary::~unwatchedIOdictionary()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Members Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::unwatchedIOdictionary::addWatch(const fileName& f)
|
||||
{
|
||||
label index = -1;
|
||||
|
||||
if (readOpt() == MUST_READ_IF_MODIFIED)
|
||||
{
|
||||
index = findIndex(files_, f);
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
index = files_.size();
|
||||
files_.append(f);
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
void Foam::unwatchedIOdictionary::addWatch()
|
||||
{
|
||||
if (readOpt() == MUST_READ_IF_MODIFIED)
|
||||
{
|
||||
fileName f = filePath();
|
||||
if (!f.size())
|
||||
{
|
||||
// We don't have this file but would like to re-read it.
|
||||
// Possibly if master-only reading mode.
|
||||
f = objectPath();
|
||||
}
|
||||
|
||||
if (findIndex(files_, f) != -1)
|
||||
{
|
||||
FatalErrorIn("regIOobject::addWatch()")
|
||||
<< "Object " << objectPath() << " of type " << type()
|
||||
<< " already watched" << abort(FatalError);
|
||||
}
|
||||
|
||||
// If master-only reading only the master will have all dependencies
|
||||
// so scatter these to slaves
|
||||
bool masterOnly =
|
||||
global()
|
||||
&& (
|
||||
regIOobject::fileModificationChecking == timeStampMaster
|
||||
|| regIOobject::fileModificationChecking == inotifyMaster
|
||||
);
|
||||
|
||||
if (masterOnly && Pstream::parRun())
|
||||
{
|
||||
Pstream::scatter(files_);
|
||||
}
|
||||
|
||||
addWatch(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,126 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2020 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::unwatchedIOdictionary
|
||||
|
||||
Description
|
||||
unwatchedIOdictionary is like IOdictionary but stores
|
||||
dependencies as files instead of fileMonitor watchIndices. Used
|
||||
to read controlDict since there fileMonitor not yet setup.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef unwatchedIOdictionary_H
|
||||
#define unwatchedIOdictionary_H
|
||||
|
||||
#include "baseIOdictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class unwatchedIOdictionary Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class unwatchedIOdictionary
|
||||
:
|
||||
public baseIOdictionary
|
||||
{
|
||||
// Private member data
|
||||
|
||||
fileNameList files_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given an IOobject
|
||||
unwatchedIOdictionary(const IOobject& io);
|
||||
|
||||
//- Construct given an IOobject and dictionary
|
||||
unwatchedIOdictionary
|
||||
(
|
||||
const IOobject& io,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~unwatchedIOdictionary();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- This object is global
|
||||
virtual bool global() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Return complete path + object name if the file exists
|
||||
// either in the case/processor or case otherwise null
|
||||
virtual fileName filePath() const
|
||||
{
|
||||
return globalFilePath(type());
|
||||
}
|
||||
|
||||
//- Add file watch on object (READ_IF_MODIFIED)
|
||||
virtual void addWatch();
|
||||
|
||||
//- Add file watch for fileName on object if not yet watched. Return
|
||||
// index of watch
|
||||
virtual label addWatch(const fileName&);
|
||||
|
||||
const fileNameList& files() const
|
||||
{
|
||||
return files_;
|
||||
}
|
||||
|
||||
fileNameList& files()
|
||||
{
|
||||
return files_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//- Template function for obtaining global status
|
||||
template<>
|
||||
inline bool typeGlobal<unwatchedIOdictionary>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -216,29 +216,6 @@ bool Foam::regIOobject::checkOut()
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::regIOobject::addWatch(const fileName& f)
|
||||
{
|
||||
label index = -1;
|
||||
|
||||
if
|
||||
(
|
||||
registered_
|
||||
&& readOpt() == MUST_READ_IF_MODIFIED
|
||||
&& time().runTimeModifiable()
|
||||
)
|
||||
{
|
||||
index = fileHandler().findWatch(watchIndices_, f);
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
index = watchIndices_.size();
|
||||
watchIndices_.append(fileHandler().addWatch(f));
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
void Foam::regIOobject::addWatch()
|
||||
{
|
||||
if
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -140,7 +140,7 @@ public:
|
||||
bool checkOut();
|
||||
|
||||
//- Add file watch on object (if registered and READ_IF_MODIFIED)
|
||||
virtual void addWatch();
|
||||
void addWatch();
|
||||
|
||||
//- Is this object owned by the registry?
|
||||
inline bool ownedByRegistry() const;
|
||||
@ -236,10 +236,6 @@ public:
|
||||
//- Read object
|
||||
virtual bool read();
|
||||
|
||||
//- Add file watch for fileName on object if not yet watched. Return
|
||||
// index of watch
|
||||
virtual label addWatch(const fileName&);
|
||||
|
||||
//- Return file-monitoring handles
|
||||
inline const labelList& watchIndices() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user