functionObjects::regionFunctionObject: Added optional 'log' entry (defaults to true)

This commit is contained in:
Henry Weller
2016-05-24 09:03:41 +01:00
parent b634f5af08
commit 6ce303c79a
12 changed files with 43 additions and 27 deletions

View File

@ -55,7 +55,8 @@ Foam::functionObjects::regionFunctionObject::regionFunctionObject
(
dict.lookupOrDefault("region", polyMesh::defaultRegion)
)
)
),
log_(true)
{}
@ -68,7 +69,8 @@ Foam::functionObjects::regionFunctionObject::regionFunctionObject
:
functionObject(name),
time_(obr.time()),
obr_(obr)
obr_(obr),
log_(true)
{}
@ -78,4 +80,14 @@ Foam::functionObjects::regionFunctionObject::~regionFunctionObject()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::regionFunctionObject::read(const dictionary& dict)
{
log_ = dict.lookupOrDefault<Switch>("log", true);
return true;
}
// ************************************************************************* //

View File

@ -40,6 +40,7 @@ SourceFiles
#define functionObjects_regionFunctionObject_H
#include "functionObject.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -71,6 +72,9 @@ protected:
//- Reference to the region objectRegistry
const objectRegistry& obr_;
//- Switch to send output to Info as well as to file
Switch log_;
private:
@ -112,6 +116,12 @@ public:
//- Destructor
virtual ~regionFunctionObject();
// Member Functions
//- Read optional controls
virtual bool read(const dictionary&);
};

View File

@ -106,8 +106,7 @@ Foam::functionObjects::writeFile::writeFile
)
:
regionFunctionObject(name, runTime, dict),
prefix_(prefix),
log_(true)
prefix_(prefix)
{}
@ -120,8 +119,7 @@ Foam::functionObjects::writeFile::writeFile
)
:
regionFunctionObject(name, obr, dict),
prefix_(prefix),
log_(true)
prefix_(prefix)
{}
@ -133,14 +131,6 @@ Foam::functionObjects::writeFile::~writeFile()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::writeFile::read(const dictionary& dict)
{
log_ = dict.lookupOrDefault<Switch>("log", true);
return true;
}
Foam::label Foam::functionObjects::writeFile::charWidth() const
{
return IOstream::defaultPrecision() + addChars;

View File

@ -66,9 +66,6 @@ protected:
//- Prefix
const word prefix_;
//- Switch to send output to Info as well as to file
Switch log_;
// Protected Member Functions
@ -130,9 +127,6 @@ public:
// Member Functions
//- Read optional controls
virtual bool read(const dictionary&);
//- Write a commented string to stream
void writeCommented(Ostream& os, const string& str) const;