functionObjects::writeLocalObjects: Provides support for controlled writing of field
defined by functionObjects, e.g. wallHeatFlux, wallShearStress and yPlus. Patch contributed by Bruno Santos Resolves bug-report http://bugs.openfoam.org/view.php?id=2353
This commit is contained in:
@ -228,6 +228,8 @@ db/functionObjects/functionObject/functionObject.C
|
|||||||
db/functionObjects/functionObjectList/functionObjectList.C
|
db/functionObjects/functionObjectList/functionObjectList.C
|
||||||
db/functionObjects/writeFile/writeFile.C
|
db/functionObjects/writeFile/writeFile.C
|
||||||
db/functionObjects/logFiles/logFiles.C
|
db/functionObjects/logFiles/logFiles.C
|
||||||
|
db/functionObjects/writeObjectsBase/writeObjectsBase.C
|
||||||
|
db/functionObjects/writeLocalObjects/writeLocalObjects.C
|
||||||
db/functionObjects/timeControl/timeControl.C
|
db/functionObjects/timeControl/timeControl.C
|
||||||
db/functionObjects/timeControl/timeControlFunctionObject.C
|
db/functionObjects/timeControl/timeControlFunctionObject.C
|
||||||
db/functionObjects/regionFunctionObject/regionFunctionObject.C
|
db/functionObjects/regionFunctionObject/regionFunctionObject.C
|
||||||
|
|||||||
@ -0,0 +1,106 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 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 "writeLocalObjects.H"
|
||||||
|
#include "stringListOps.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::functionObjects::writeLocalObjects::resetLocalObjectName
|
||||||
|
(
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
localObjectNames_.clear();
|
||||||
|
localObjectNames_.append(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjects::writeLocalObjects::resetLocalObjectNames
|
||||||
|
(
|
||||||
|
const wordList& names
|
||||||
|
)
|
||||||
|
{
|
||||||
|
localObjectNames_.clear();
|
||||||
|
localObjectNames_.append(names);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::functionObjects::writeLocalObjects::objectNames()
|
||||||
|
{
|
||||||
|
wordList names
|
||||||
|
(
|
||||||
|
subsetStrings(wordReListMatcher(writeObjectNames_), localObjectNames_)
|
||||||
|
);
|
||||||
|
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::writeLocalObjects::writeLocalObjects
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const Switch& log
|
||||||
|
)
|
||||||
|
:
|
||||||
|
writeObjectsBase(obr, log),
|
||||||
|
localObjectNames_()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::writeLocalObjects::~writeLocalObjects()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::wordList&
|
||||||
|
Foam::functionObjects::writeLocalObjects::localObjectNames() const
|
||||||
|
{
|
||||||
|
return localObjectNames_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::writeLocalObjects::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (dict.found("objects"))
|
||||||
|
{
|
||||||
|
writeObjectsBase::read(dict);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resetWriteObjectName(wordRe(".*", wordRe::DETECT));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,160 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 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::functionObjects::writeLocalObjects
|
||||||
|
|
||||||
|
Description
|
||||||
|
FunctionObject base class for managing a list of objects on behalf of the
|
||||||
|
inheriting function object, on when those should be written to disk.
|
||||||
|
|
||||||
|
FunctionObjects that inherit this class will receive the additional
|
||||||
|
dictionary option \c objects which allows selecting which fields of the
|
||||||
|
inherited function should be written to disk when \c write() is called.
|
||||||
|
When \c objects is omitted, it will write all objects and when that list is
|
||||||
|
empty, it will not write any of the inheriting function object's managed
|
||||||
|
objects.
|
||||||
|
|
||||||
|
Example of function object specification:
|
||||||
|
\verbatim
|
||||||
|
<functionObjectName>
|
||||||
|
{
|
||||||
|
...
|
||||||
|
objects (obj1 obj2);
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Usage
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default value
|
||||||
|
objects | List of objects to be written | no | ".*"
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Note: Regular expressions can also be used in \c objects.
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::functionObject
|
||||||
|
Foam::functionObjects::writeObjectsBase
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
writeLocalObjects.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef functionObjects_writeLocalObjects_H
|
||||||
|
#define functionObjects_writeLocalObjects_H
|
||||||
|
|
||||||
|
#include "wordList.H"
|
||||||
|
#include "writeObjectsBase.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class objectRegistry;
|
||||||
|
class regIOobject;
|
||||||
|
class Switch;
|
||||||
|
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class writeLocalObjects Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class writeLocalObjects
|
||||||
|
:
|
||||||
|
public writeObjectsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Object names that are handled on behalf of the inheritor
|
||||||
|
wordList localObjectNames_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Reset the list of local object names from a single word
|
||||||
|
void resetLocalObjectName(const word& name);
|
||||||
|
|
||||||
|
//- Reset the list of local object names from a wordList
|
||||||
|
void resetLocalObjectNames(const wordList& names);
|
||||||
|
|
||||||
|
//- Get the list of field names to be written
|
||||||
|
virtual wordList objectNames();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
writeLocalObjects(const writeLocalObjects&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const writeLocalObjects&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from objectRegistry and inheriting function object
|
||||||
|
writeLocalObjects
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const Switch& logRef
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~writeLocalObjects();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return const access to the local object names
|
||||||
|
const wordList& localObjectNames() const;
|
||||||
|
|
||||||
|
//- Read the list of objects to be written
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace functionObjects
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,147 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 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 "writeObjectsBase.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::functionObjects::writeObjectsBase::resetWriteObjectName
|
||||||
|
(
|
||||||
|
const wordRe& name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
writeObjectNames_.clear();
|
||||||
|
writeObjectNames_.append(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjects::writeObjectsBase::resetWriteObjectNames
|
||||||
|
(
|
||||||
|
const wordReList& names
|
||||||
|
)
|
||||||
|
{
|
||||||
|
writeObjectNames_.clear();
|
||||||
|
writeObjectNames_.append(names);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::functionObjects::writeObjectsBase::objectNames()
|
||||||
|
{
|
||||||
|
DynamicList<word> allNames(writeObr_.toc().size());
|
||||||
|
forAll(writeObjectNames_, i)
|
||||||
|
{
|
||||||
|
wordList names(writeObr_.names<regIOobject>(writeObjectNames_[i]));
|
||||||
|
|
||||||
|
if (names.size())
|
||||||
|
{
|
||||||
|
allNames.append(names);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Object " << writeObjectNames_[i] << " not found in "
|
||||||
|
<< "database. Available objects:" << nl << writeObr_.sortedToc()
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return allNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjects::writeObjectsBase::writeObject
|
||||||
|
(
|
||||||
|
const regIOobject& obj
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (log_) Info << " writing object " << obj.name() << endl;
|
||||||
|
|
||||||
|
obj.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::writeObjectsBase::writeObjectsBase
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const Switch& log
|
||||||
|
)
|
||||||
|
:
|
||||||
|
writeObr_(obr),
|
||||||
|
log_(log)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::writeObjectsBase::~writeObjectsBase()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::wordReList&
|
||||||
|
Foam::functionObjects::writeObjectsBase::writeObjectNames() const
|
||||||
|
{
|
||||||
|
return writeObjectNames_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::writeObjectsBase::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
dict.lookup("objects") >> writeObjectNames_;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::writeObjectsBase::write()
|
||||||
|
{
|
||||||
|
wordList names(objectNames());
|
||||||
|
|
||||||
|
if(!names.empty())
|
||||||
|
{
|
||||||
|
if (!writeObr_.time().writeTime())
|
||||||
|
{
|
||||||
|
writeObr_.time().writeTimeDict();
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(names, i)
|
||||||
|
{
|
||||||
|
const regIOobject& obj =
|
||||||
|
writeObr_.lookupObject<regIOobject>(names[i]);
|
||||||
|
|
||||||
|
writeObject(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,169 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 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::functionObjects::writeObjectsBase
|
||||||
|
|
||||||
|
Description
|
||||||
|
FunctionObject base class for writing a list of objects registered to the
|
||||||
|
database, on behalf of the inheriting function object, on when those should
|
||||||
|
be written to disk.
|
||||||
|
|
||||||
|
FunctionObjects that inherit this class will receive the additional
|
||||||
|
dictionary option \c objects which allows selecting which fields of the
|
||||||
|
inherited function should be written to disk when \c write() is called.
|
||||||
|
|
||||||
|
Example of function object specification:
|
||||||
|
\verbatim
|
||||||
|
<functionObjectName>
|
||||||
|
{
|
||||||
|
...
|
||||||
|
objects (obj1 obj2);
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Usage
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default value
|
||||||
|
objects | List of objects to be written | yes |
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Note: Regular expressions can also be used in \c objects.
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::functionObject
|
||||||
|
Foam::functionObjects::writeObjects
|
||||||
|
Foam::functionObjects::writeLocalObjects
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
writeObjectsBase.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef functionObjects_writeObjectsBase_H
|
||||||
|
#define functionObjects_writeObjectsBase_H
|
||||||
|
|
||||||
|
#include "wordList.H"
|
||||||
|
#include "wordReList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class objectRegistry;
|
||||||
|
class regIOobject;
|
||||||
|
class Switch;
|
||||||
|
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class writeObjectsBase Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class writeObjectsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Reference to the region objectRegistry
|
||||||
|
const objectRegistry& writeObr_;
|
||||||
|
|
||||||
|
//- Reference to the inheriting function object's log variable
|
||||||
|
const Switch& log_;
|
||||||
|
|
||||||
|
//- Object names requested by the user to be written
|
||||||
|
wordReList writeObjectNames_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Reset the list of object names to be written to a single regular
|
||||||
|
// expression
|
||||||
|
void resetWriteObjectName(const wordRe& name);
|
||||||
|
|
||||||
|
//- Reset the list of object names to be written
|
||||||
|
void resetWriteObjectNames(const wordReList& names);
|
||||||
|
|
||||||
|
//- Get the list of field names to be written
|
||||||
|
virtual wordList objectNames();
|
||||||
|
|
||||||
|
//- Write the requested registered IO object
|
||||||
|
virtual void writeObject(const regIOobject& obj);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
writeObjectsBase(const writeObjectsBase&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const writeObjectsBase&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from objectRegistry and inheriting function object
|
||||||
|
writeObjectsBase
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const Switch& logRef
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~writeObjectsBase();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return const access to the object names requested to be written
|
||||||
|
const wordReList& writeObjectNames() const;
|
||||||
|
|
||||||
|
//- Read the list of objects to be written
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
|
//- Write function
|
||||||
|
virtual bool write();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace functionObjects
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -104,6 +104,7 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
|
|||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
logFiles(obr_, name),
|
logFiles(obr_, name),
|
||||||
|
writeLocalObjects(obr_, log),
|
||||||
patchSet_()
|
patchSet_()
|
||||||
{
|
{
|
||||||
volScalarField* wallHeatFluxPtr
|
volScalarField* wallHeatFluxPtr
|
||||||
@ -127,6 +128,7 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
|
|||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
resetName(typeName);
|
resetName(typeName);
|
||||||
|
resetLocalObjectName(typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,6 +143,7 @@ Foam::functionObjects::wallHeatFlux::~wallHeatFlux()
|
|||||||
bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
|
bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
fvMeshFunctionObject::read(dict);
|
fvMeshFunctionObject::read(dict);
|
||||||
|
writeLocalObjects::read(dict);
|
||||||
|
|
||||||
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
||||||
|
|
||||||
@ -229,16 +232,15 @@ bool Foam::functionObjects::wallHeatFlux::execute()
|
|||||||
|
|
||||||
bool Foam::functionObjects::wallHeatFlux::write()
|
bool Foam::functionObjects::wallHeatFlux::write()
|
||||||
{
|
{
|
||||||
|
Log << type() << " " << name() << " write:" << nl;
|
||||||
|
|
||||||
|
writeLocalObjects::write();
|
||||||
|
|
||||||
logFiles::write();
|
logFiles::write();
|
||||||
|
|
||||||
const volScalarField& wallHeatFlux =
|
const volScalarField& wallHeatFlux =
|
||||||
obr_.lookupObject<volScalarField>(type());
|
obr_.lookupObject<volScalarField>(type());
|
||||||
|
|
||||||
Log << type() << " " << name() << " write:" << nl
|
|
||||||
<< " writing field " << wallHeatFlux.name() << endl;
|
|
||||||
|
|
||||||
wallHeatFlux.write();
|
|
||||||
|
|
||||||
const fvPatchList& patches = mesh_.boundary();
|
const fvPatchList& patches = mesh_.boundary();
|
||||||
|
|
||||||
const surfaceScalarField::Boundary& magSf =
|
const surfaceScalarField::Boundary& magSf =
|
||||||
@ -249,8 +251,7 @@ bool Foam::functionObjects::wallHeatFlux::write()
|
|||||||
label patchi = iter.key();
|
label patchi = iter.key();
|
||||||
const fvPatch& pp = patches[patchi];
|
const fvPatch& pp = patches[patchi];
|
||||||
|
|
||||||
const scalarField& hfp =
|
const scalarField& hfp = wallHeatFlux.boundaryField()[patchi];
|
||||||
wallHeatFlux.boundaryField()[patchi];
|
|
||||||
|
|
||||||
const scalar minHfp = gMin(hfp);
|
const scalar minHfp = gMin(hfp);
|
||||||
const scalar maxHfp = gMax(hfp);
|
const scalar maxHfp = gMax(hfp);
|
||||||
@ -267,10 +268,12 @@ bool Foam::functionObjects::wallHeatFlux::write()
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log << " min/max(" << pp.name() << ") = "
|
Log << " min/max/integ(" << pp.name() << ") = "
|
||||||
<< minHfp << ", " << maxHfp << ", " << integralHfp << endl;
|
<< minHfp << ", " << maxHfp << ", " << integralHfp << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log << endl;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,10 +52,15 @@ Usage
|
|||||||
patches | list of patches to process | no | all wall patches
|
patches | list of patches to process | no | all wall patches
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
Writing field 'wallHeatFlux' is done by default, but it can be overridden by
|
||||||
|
defining an empty \c objects list. For details see writeLocalObjects.
|
||||||
|
|
||||||
See also
|
See also
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::functionObjects::fvMeshFunctionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
Foam::functionObjects::logFiles
|
Foam::functionObjects::logFiles
|
||||||
|
Foam::functionObjects::writeLocalObjects
|
||||||
Foam::functionObjects::pressureTools
|
Foam::functionObjects::pressureTools
|
||||||
Foam::functionObjects::timeControl
|
Foam::functionObjects::timeControl
|
||||||
|
|
||||||
@ -69,6 +74,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "fvMeshFunctionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "logFiles.H"
|
#include "logFiles.H"
|
||||||
|
#include "writeLocalObjects.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "surfaceFieldsFwd.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
@ -88,7 +94,8 @@ namespace functionObjects
|
|||||||
class wallHeatFlux
|
class wallHeatFlux
|
||||||
:
|
:
|
||||||
public fvMeshFunctionObject,
|
public fvMeshFunctionObject,
|
||||||
public logFiles
|
public logFiles,
|
||||||
|
public writeLocalObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -90,6 +90,7 @@ Foam::functionObjects::wallShearStress::wallShearStress
|
|||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
logFiles(obr_, name),
|
logFiles(obr_, name),
|
||||||
|
writeLocalObjects(obr_, log),
|
||||||
patchSet_()
|
patchSet_()
|
||||||
{
|
{
|
||||||
volVectorField* wallShearStressPtr
|
volVectorField* wallShearStressPtr
|
||||||
@ -118,6 +119,7 @@ Foam::functionObjects::wallShearStress::wallShearStress
|
|||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
resetName(typeName);
|
resetName(typeName);
|
||||||
|
resetLocalObjectName(typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -132,6 +134,7 @@ Foam::functionObjects::wallShearStress::~wallShearStress()
|
|||||||
bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
|
bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
fvMeshFunctionObject::read(dict);
|
fvMeshFunctionObject::read(dict);
|
||||||
|
writeLocalObjects::read(dict);
|
||||||
|
|
||||||
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
||||||
|
|
||||||
@ -225,16 +228,15 @@ bool Foam::functionObjects::wallShearStress::execute()
|
|||||||
|
|
||||||
bool Foam::functionObjects::wallShearStress::write()
|
bool Foam::functionObjects::wallShearStress::write()
|
||||||
{
|
{
|
||||||
|
Log << type() << " " << name() << " write:" << nl;
|
||||||
|
|
||||||
|
writeLocalObjects::write();
|
||||||
|
|
||||||
logFiles::write();
|
logFiles::write();
|
||||||
|
|
||||||
const volVectorField& wallShearStress =
|
const volVectorField& wallShearStress =
|
||||||
obr_.lookupObject<volVectorField>(type());
|
obr_.lookupObject<volVectorField>(type());
|
||||||
|
|
||||||
Log << type() << " " << name() << " write:" << nl
|
|
||||||
<< " writing field " << wallShearStress.name() << endl;
|
|
||||||
|
|
||||||
wallShearStress.write();
|
|
||||||
|
|
||||||
const fvPatchList& patches = mesh_.boundary();
|
const fvPatchList& patches = mesh_.boundary();
|
||||||
|
|
||||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||||
@ -260,6 +262,8 @@ bool Foam::functionObjects::wallShearStress::write()
|
|||||||
<< minSsp << ", " << maxSsp << endl;
|
<< minSsp << ", " << maxSsp << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log << endl;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,10 +63,15 @@ Usage
|
|||||||
patches | list of patches to process | no | all wall patches
|
patches | list of patches to process | no | all wall patches
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
Writing field 'wallShearStress' is done by default, but it can be overridden
|
||||||
|
by defining an empty \c objects list. For details see writeLocalObjects.
|
||||||
|
|
||||||
See also
|
See also
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::functionObjects::fvMeshFunctionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
Foam::functionObjects::logFiles
|
Foam::functionObjects::logFiles
|
||||||
|
Foam::functionObjects::writeLocalObjects
|
||||||
Foam::functionObjects::pressureTools
|
Foam::functionObjects::pressureTools
|
||||||
Foam::functionObjects::timeControl
|
Foam::functionObjects::timeControl
|
||||||
|
|
||||||
@ -80,6 +85,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "fvMeshFunctionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "logFiles.H"
|
#include "logFiles.H"
|
||||||
|
#include "writeLocalObjects.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
|
|
||||||
@ -97,7 +103,8 @@ namespace functionObjects
|
|||||||
class wallShearStress
|
class wallShearStress
|
||||||
:
|
:
|
||||||
public fvMeshFunctionObject,
|
public fvMeshFunctionObject,
|
||||||
public logFiles
|
public logFiles,
|
||||||
|
public writeLocalObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -121,7 +121,8 @@ Foam::functionObjects::yPlus::yPlus
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
logFiles(obr_, name)
|
logFiles(obr_, name),
|
||||||
|
writeLocalObjects(obr_, log)
|
||||||
{
|
{
|
||||||
volScalarField* yPlusPtr
|
volScalarField* yPlusPtr
|
||||||
(
|
(
|
||||||
@ -144,6 +145,7 @@ Foam::functionObjects::yPlus::yPlus
|
|||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
resetName(typeName);
|
resetName(typeName);
|
||||||
|
resetLocalObjectName(typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -158,6 +160,7 @@ Foam::functionObjects::yPlus::~yPlus()
|
|||||||
bool Foam::functionObjects::yPlus::read(const dictionary& dict)
|
bool Foam::functionObjects::yPlus::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
fvMeshFunctionObject::read(dict);
|
fvMeshFunctionObject::read(dict);
|
||||||
|
writeLocalObjects::read(dict);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -193,16 +196,15 @@ bool Foam::functionObjects::yPlus::execute()
|
|||||||
|
|
||||||
bool Foam::functionObjects::yPlus::write()
|
bool Foam::functionObjects::yPlus::write()
|
||||||
{
|
{
|
||||||
const volScalarField& yPlus =
|
Log << type() << " " << name() << " write:" << nl;
|
||||||
obr_.lookupObject<volScalarField>(type());
|
|
||||||
|
|
||||||
Log << type() << " " << name() << " write:" << nl
|
writeLocalObjects::write();
|
||||||
<< " writing field " << yPlus.name() << endl;
|
|
||||||
|
|
||||||
yPlus.write();
|
|
||||||
|
|
||||||
logFiles::write();
|
logFiles::write();
|
||||||
|
|
||||||
|
const volScalarField& yPlus =
|
||||||
|
mesh_.lookupObject<volScalarField>(type());
|
||||||
|
|
||||||
const volScalarField::Boundary& yPlusBf = yPlus.boundaryField();
|
const volScalarField::Boundary& yPlusBf = yPlus.boundaryField();
|
||||||
const fvPatchList& patches = mesh_.boundary();
|
const fvPatchList& patches = mesh_.boundary();
|
||||||
|
|
||||||
@ -235,6 +237,8 @@ bool Foam::functionObjects::yPlus::write()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log << endl;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,13 +28,34 @@ Group
|
|||||||
grpFieldFunctionObjects
|
grpFieldFunctionObjects
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Evaluates and outputs turbulence y+ for models. Values written to
|
Evaluates and outputs turbulence y+ for models. Values written to
|
||||||
time directories as field 'yPlus'
|
time directories as field 'yPlus'.
|
||||||
|
|
||||||
|
Example of function object specification:
|
||||||
|
\verbatim
|
||||||
|
yPlus1
|
||||||
|
{
|
||||||
|
type yPlus;
|
||||||
|
libs ("libfieldFunctionObjects.so");
|
||||||
|
...
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Usage
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default value
|
||||||
|
type | type name: yPlus | yes |
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
Writing field 'yPlus' is done by default, but it can be overridden by
|
||||||
|
defining an empty \c objects list. For details see writeLocalObjects.
|
||||||
|
|
||||||
See also
|
See also
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::functionObjects::fvMeshFunctionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
Foam::functionObjects::logFiles
|
Foam::functionObjects::logFiles
|
||||||
|
Foam::functionObjects::writeLocalObjects
|
||||||
Foam::functionObjects::timeControl
|
Foam::functionObjects::timeControl
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -47,6 +68,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "fvMeshFunctionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "logFiles.H"
|
#include "logFiles.H"
|
||||||
|
#include "writeLocalObjects.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -67,7 +89,8 @@ namespace functionObjects
|
|||||||
class yPlus
|
class yPlus
|
||||||
:
|
:
|
||||||
public fvMeshFunctionObject,
|
public fvMeshFunctionObject,
|
||||||
public logFiles
|
public logFiles,
|
||||||
|
public writeLocalObjects
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,62 @@ const Foam::NamedEnum
|
|||||||
> Foam::functionObjects::writeObjects::writeOptionNames_;
|
> Foam::functionObjects::writeObjects::writeOptionNames_;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::functionObjects::writeObjects::writeObject
|
||||||
|
(
|
||||||
|
const regIOobject& obj
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (writeOption_)
|
||||||
|
{
|
||||||
|
case AUTO_WRITE:
|
||||||
|
{
|
||||||
|
if(obj.writeOpt() != IOobject::AUTO_WRITE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NO_WRITE:
|
||||||
|
{
|
||||||
|
if(obj.writeOpt() != IOobject::NO_WRITE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ANY_WRITE:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unknown writeOption "
|
||||||
|
<< writeOptionNames_[writeOption_]
|
||||||
|
<< ". Valid writeOption types are" << writeOptionNames_
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
obj.writeOpt() == IOobject::AUTO_WRITE
|
||||||
|
&& writeObr_.time().writeTime()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Log << " automatically written object " << obj.name() << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writeObjectsBase::writeObject(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::writeObjects::writeObjects
|
Foam::functionObjects::writeObjects::writeObjects
|
||||||
@ -74,15 +130,15 @@ Foam::functionObjects::writeObjects::writeObjects
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObject(name),
|
functionObject(name),
|
||||||
obr_
|
writeObjectsBase
|
||||||
(
|
(
|
||||||
runTime.lookupObject<objectRegistry>
|
runTime.lookupObject<objectRegistry>
|
||||||
(
|
(
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
)
|
),
|
||||||
|
log
|
||||||
),
|
),
|
||||||
writeOption_(ANY_WRITE),
|
writeOption_(ANY_WRITE)
|
||||||
objectNames_()
|
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
@ -100,16 +156,16 @@ bool Foam::functionObjects::writeObjects::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (dict.found("field"))
|
if (dict.found("field"))
|
||||||
{
|
{
|
||||||
objectNames_.setSize(1);
|
writeObjectNames_.setSize(1);
|
||||||
dict.lookup("field") >> objectNames_[0];
|
dict.lookup("field") >> writeObjectNames_[0];
|
||||||
}
|
}
|
||||||
else if (dict.found("fields"))
|
else if (dict.found("fields"))
|
||||||
{
|
{
|
||||||
dict.lookup("fields") >> objectNames_;
|
dict.lookup("fields") >> writeObjectNames_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dict.lookup("objects") >> objectNames_;
|
writeObjectsBase::read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict.found("writeOption"))
|
if (dict.found("writeOption"))
|
||||||
@ -121,7 +177,7 @@ bool Foam::functionObjects::writeObjects::read(const dictionary& dict)
|
|||||||
writeOption_ = ANY_WRITE;
|
writeOption_ = ANY_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return functionObject::read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -135,85 +191,9 @@ bool Foam::functionObjects::writeObjects::write()
|
|||||||
{
|
{
|
||||||
Info<< type() << " " << name() << " write:" << nl;
|
Info<< type() << " " << name() << " write:" << nl;
|
||||||
|
|
||||||
if (!obr_.time().writeTime())
|
writeObjectsBase::write();
|
||||||
{
|
|
||||||
obr_.time().writeTimeDict();
|
|
||||||
}
|
|
||||||
|
|
||||||
DynamicList<word> allNames(obr_.toc().size());
|
Log << endl;
|
||||||
forAll(objectNames_, i)
|
|
||||||
{
|
|
||||||
wordList names(obr_.names<regIOobject>(objectNames_[i]));
|
|
||||||
|
|
||||||
if (names.size())
|
|
||||||
{
|
|
||||||
allNames.append(names);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Object " << objectNames_[i] << " not found in "
|
|
||||||
<< "database. Available objects:" << nl << obr_.sortedToc()
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(allNames, i)
|
|
||||||
{
|
|
||||||
regIOobject& obj = const_cast<regIOobject&>
|
|
||||||
(
|
|
||||||
obr_.lookupObject<regIOobject>(allNames[i])
|
|
||||||
);
|
|
||||||
|
|
||||||
switch (writeOption_)
|
|
||||||
{
|
|
||||||
case AUTO_WRITE:
|
|
||||||
{
|
|
||||||
if(obj.writeOpt() != IOobject::AUTO_WRITE)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case NO_WRITE:
|
|
||||||
{
|
|
||||||
if(obj.writeOpt() != IOobject::NO_WRITE)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ANY_WRITE:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Unknown writeOption "
|
|
||||||
<< writeOptionNames_[writeOption_]
|
|
||||||
<< ". Valid writeOption types are" << writeOptionNames_
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
obj.writeOpt() == IOobject::AUTO_WRITE
|
|
||||||
&& obr_.time().writeTime()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Info<< " automatically written object " << obj.name() << endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< " writing object " << obj.name() << endl;
|
|
||||||
|
|
||||||
obj.write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,6 +72,7 @@ Usage
|
|||||||
|
|
||||||
See also
|
See also
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
|
Foam::functionObjects::writeObjectsBase
|
||||||
Foam::functionObjects::timeControl
|
Foam::functionObjects::timeControl
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -83,7 +84,7 @@ SourceFiles
|
|||||||
#define functionObjects_writeObjects_H
|
#define functionObjects_writeObjects_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "functionObject.H"
|
||||||
#include "wordReList.H"
|
#include "writeObjectsBase.H"
|
||||||
#include "NamedEnum.H"
|
#include "NamedEnum.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -91,9 +92,6 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -103,7 +101,8 @@ namespace functionObjects
|
|||||||
|
|
||||||
class writeObjects
|
class writeObjects
|
||||||
:
|
:
|
||||||
public functionObject
|
public functionObject,
|
||||||
|
public writeObjectsBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -124,18 +123,15 @@ private:
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Reference to Db
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- To only write objects of defined writeOption
|
//- To only write objects of defined writeOption
|
||||||
writeOption writeOption_;
|
writeOption writeOption_;
|
||||||
|
|
||||||
//- Names of objects to control
|
|
||||||
wordReList objectNames_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Write the requested registered IO object
|
||||||
|
virtual void writeObject(const regIOobject& obj);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
writeObjects(const writeObjects&);
|
writeObjects(const writeObjects&);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user