From f274630f4d1fa553cb0d22c3a7e6604747dfeda9 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 20 Aug 2020 12:45:29 +0100 Subject: [PATCH] unwatchedIOdictionary: Removed with associated clutter IOdictionary is now used instead of unwatchedIOdictionary --- src/OpenFOAM/Make/files | 1 - .../IOdictionary/unwatchedIOdictionary.C | 124 ----------------- .../IOdictionary/unwatchedIOdictionary.H | 126 ------------------ src/OpenFOAM/db/regIOobject/regIOobject.C | 25 +--- src/OpenFOAM/db/regIOobject/regIOobject.H | 8 +- 5 files changed, 3 insertions(+), 281 deletions(-) delete mode 100644 src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C delete mode 100644 src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.H diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index f855232117..657187f6f5 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -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 diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C b/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C deleted file mode 100644 index 5b3ae78c2b..0000000000 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.C +++ /dev/null @@ -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 . - -\*---------------------------------------------------------------------------*/ - -#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); - } -} - - -// ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.H b/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.H deleted file mode 100644 index d51046a284..0000000000 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/unwatchedIOdictionary.H +++ /dev/null @@ -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 . - -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() -{ - return true; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/db/regIOobject/regIOobject.C b/src/OpenFOAM/db/regIOobject/regIOobject.C index 8c61f44d02..d97dbf3bf2 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobject.C +++ b/src/OpenFOAM/db/regIOobject/regIOobject.C @@ -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 diff --git a/src/OpenFOAM/db/regIOobject/regIOobject.H b/src/OpenFOAM/db/regIOobject/regIOobject.H index a17504a0c1..7035f6ba95 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobject.H +++ b/src/OpenFOAM/db/regIOobject/regIOobject.H @@ -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;