mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
functionObjects::regionFunctionObject: Added optional 'log' entry (defaults to true)
This commit is contained in:
@ -55,7 +55,8 @@ Foam::functionObjects::regionFunctionObject::regionFunctionObject
|
|||||||
(
|
(
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
|
log_(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +69,8 @@ Foam::functionObjects::regionFunctionObject::regionFunctionObject
|
|||||||
:
|
:
|
||||||
functionObject(name),
|
functionObject(name),
|
||||||
time_(obr.time()),
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -40,6 +40,7 @@ SourceFiles
|
|||||||
#define functionObjects_regionFunctionObject_H
|
#define functionObjects_regionFunctionObject_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
#include "functionObject.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -71,6 +72,9 @@ protected:
|
|||||||
//- Reference to the region objectRegistry
|
//- Reference to the region objectRegistry
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
|
//- Switch to send output to Info as well as to file
|
||||||
|
Switch log_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -112,6 +116,12 @@ public:
|
|||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~regionFunctionObject();
|
virtual ~regionFunctionObject();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read optional controls
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -106,8 +106,7 @@ Foam::functionObjects::writeFile::writeFile
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
regionFunctionObject(name, runTime, dict),
|
regionFunctionObject(name, runTime, dict),
|
||||||
prefix_(prefix),
|
prefix_(prefix)
|
||||||
log_(true)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -120,8 +119,7 @@ Foam::functionObjects::writeFile::writeFile
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
regionFunctionObject(name, obr, dict),
|
regionFunctionObject(name, obr, dict),
|
||||||
prefix_(prefix),
|
prefix_(prefix)
|
||||||
log_(true)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -133,14 +131,6 @@ Foam::functionObjects::writeFile::~writeFile()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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
|
Foam::label Foam::functionObjects::writeFile::charWidth() const
|
||||||
{
|
{
|
||||||
return IOstream::defaultPrecision() + addChars;
|
return IOstream::defaultPrecision() + addChars;
|
||||||
|
|||||||
@ -66,9 +66,6 @@ protected:
|
|||||||
//- Prefix
|
//- Prefix
|
||||||
const word prefix_;
|
const word prefix_;
|
||||||
|
|
||||||
//- Switch to send output to Info as well as to file
|
|
||||||
Switch log_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
@ -130,9 +127,6 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Read optional controls
|
|
||||||
virtual bool read(const dictionary&);
|
|
||||||
|
|
||||||
//- Write a commented string to stream
|
//- Write a commented string to stream
|
||||||
void writeCommented(Ostream& os, const string& str) const;
|
void writeCommented(Ostream& os, const string& str) const;
|
||||||
|
|
||||||
|
|||||||
@ -49,8 +49,11 @@ bool Foam::functionObjects::fvMeshFunctionObject::writeField
|
|||||||
{
|
{
|
||||||
const regIOobject& field = mesh_.lookupObject<regIOobject>(fieldName);
|
const regIOobject& field = mesh_.lookupObject<regIOobject>(fieldName);
|
||||||
|
|
||||||
|
if (log_)
|
||||||
|
{
|
||||||
Info<< "functionObjects::" << type() << " " << name()
|
Info<< "functionObjects::" << type() << " " << name()
|
||||||
<< " writing field: " << field.name() << endl;
|
<< " writing field: " << field.name() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
field.write();
|
field.write();
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,8 @@ bool Foam::functionObjects::fieldCoordinateSystemTransform::read
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
dict.lookup("fields") >> fieldSet_;
|
dict.lookup("fields") >> fieldSet_;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -65,6 +65,8 @@ Foam::functionObjects::fieldExpression::~fieldExpression()
|
|||||||
|
|
||||||
bool Foam::functionObjects::fieldExpression::read(const dictionary& dict)
|
bool Foam::functionObjects::fieldExpression::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
if (fieldName_ == word::null || dict.found("field"))
|
if (fieldName_ == word::null || dict.found("field"))
|
||||||
{
|
{
|
||||||
dict.lookup("field") >> fieldName_;
|
dict.lookup("field") >> fieldName_;
|
||||||
|
|||||||
@ -250,10 +250,7 @@ Foam::functionObjects::nearWallFields::~nearWallFields()
|
|||||||
|
|
||||||
bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
if (debug)
|
fvMeshFunctionObject::read(dict);
|
||||||
{
|
|
||||||
InfoInFunction << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
dict.lookup("fields") >> fieldSet_;
|
dict.lookup("fields") >> fieldSet_;
|
||||||
patchSet_ =
|
patchSet_ =
|
||||||
|
|||||||
@ -83,6 +83,8 @@ Foam::functionObjects::processorField::~processorField()
|
|||||||
|
|
||||||
bool Foam::functionObjects::processorField::read(const dictionary& dict)
|
bool Foam::functionObjects::processorField::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,8 @@ Foam::functionObjects::readFields::~readFields()
|
|||||||
|
|
||||||
bool Foam::functionObjects::readFields::read(const dictionary& dict)
|
bool Foam::functionObjects::readFields::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
dict.lookup("fields") >> fieldSet_;
|
dict.lookup("fields") >> fieldSet_;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -120,6 +120,8 @@ bool Foam::functionObjects::icoUncoupledKinematicCloud::read
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -195,7 +195,7 @@ Foam::functionObjects::scalarTransport::~scalarTransport()
|
|||||||
|
|
||||||
bool Foam::functionObjects::scalarTransport::read(const dictionary& dict)
|
bool Foam::functionObjects::scalarTransport::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
Info<< type() << ":" << nl;
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
|
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
|
||||||
UName_ = dict.lookupOrDefault<word>("U", "U");
|
UName_ = dict.lookupOrDefault<word>("U", "U");
|
||||||
|
|||||||
Reference in New Issue
Block a user