functionObjects::writeRegisteredObject -> functionObjects::writeObjects

Added configuration file etc/caseDicts/postProcessing/fields/writeObjects
This commit is contained in:
Henry Weller 2016-06-10 08:28:13 +01:00
parent 792eaa3566
commit 4b5905e535
7 changed files with 64 additions and 155 deletions

View File

@ -11,7 +11,7 @@ turbulenceFields
type turbulenceFields;
libs ("libfieldFunctionObjects.so");
fields (<list of field names>);
fields (<field names>);
executeControl writeTime;
writeControl writeTime;

View File

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
writeObjects
{
type writeObjects;
libs ("libutilityFunctionObjects.so");
objects (<object names>);
writeControl writeTime;
}
// ************************************************************************* //

View File

@ -62,7 +62,7 @@ bool Foam::functionObjects::regionFunctionObject::store
<< "Cannot store cache-able field with the named used in the cache."
<< nl
<< " Either choose a different name or cache the field"
<< " and use the 'writeRegisteredObject' functionObject."
<< " and use the 'writeObjects' functionObject."
<< endl;
return false;

View File

@ -6,6 +6,6 @@ systemCall/systemCall.C
abort/abort.C
removeRegisteredObject/removeRegisteredObject.C
writeDictionary/writeDictionary.C
writeRegisteredObject/writeRegisteredObject.C
writeObjects/writeObjects.C
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "writeRegisteredObject.H"
#include "writeObjects.H"
#include "Time.H"
#include "polyMesh.H"
#include "addToRunTimeSelectionTable.H"
@ -34,12 +34,12 @@ namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(writeRegisteredObject, 0);
defineTypeNameAndDebug(writeObjects, 0);
addToRunTimeSelectionTable
(
functionObject,
writeRegisteredObject,
writeObjects,
dictionary
);
}
@ -48,7 +48,7 @@ namespace functionObjects
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::writeRegisteredObject::writeRegisteredObject
Foam::functionObjects::writeObjects::writeObjects
(
const word& name,
const Time& runTime,
@ -72,22 +72,35 @@ Foam::functionObjects::writeRegisteredObject::writeRegisteredObject
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::writeRegisteredObject::~writeRegisteredObject()
Foam::functionObjects::writeObjects::~writeObjects()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::writeRegisteredObject::read(const dictionary& dict)
bool Foam::functionObjects::writeObjects::read(const dictionary& dict)
{
dict.lookup("objects") >> objectNames_;
if (dict.found("field"))
{
objectNames_.setSize(1);
dict.lookup("field") >> objectNames_[0];
}
else if (dict.found("fields"))
{
dict.lookup("fields") >> objectNames_;
}
else
{
dict.lookup("objects") >> objectNames_;
}
dict.readIfPresent("exclusiveWriting", exclusiveWriting_);
return true;
}
bool Foam::functionObjects::writeRegisteredObject::execute
bool Foam::functionObjects::writeObjects::execute
(
const bool postProcess
)
@ -96,7 +109,7 @@ bool Foam::functionObjects::writeRegisteredObject::execute
}
bool Foam::functionObjects::writeRegisteredObject::write
bool Foam::functionObjects::writeObjects::write
(
const bool postProcess
)
@ -128,11 +141,10 @@ bool Foam::functionObjects::writeRegisteredObject::write
forAll(allNames, i)
{
regIOobject& obj =
const_cast<regIOobject&>
(
obr_.lookupObject<regIOobject>(allNames[i])
);
regIOobject& obj = const_cast<regIOobject&>
(
obr_.lookupObject<regIOobject>(allNames[i])
);
if (exclusiveWriting_)
{
@ -140,7 +152,7 @@ bool Foam::functionObjects::writeRegisteredObject::write
obj.writeOpt() = IOobject::NO_WRITE;
}
Info<< " writing object " << obj.name() << nl << endl;
Info<< " writing object " << obj.name() << endl;
obj.write();
}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::writeRegisteredObject
Foam::functionObjects::writeObjects
Group
grpUtilitiesFunctionObjects
@ -41,9 +41,9 @@ Description
Example of function object specification:
\verbatim
writeRegisteredObject1
writeObjects1
{
type writeRegisteredObject;
type writeObjects;
libs ("libutilityFunctionObjects.so");
exclusiveWriting true;
...
@ -54,7 +54,7 @@ Description
\heading Function object usage
\table
Property | Description | Required | Default value
type | type name: writeRegisteredObject | yes |
type | type name: writeObjects | yes |
objectNames | objects to write | yes |
exclusiveWriting | Takes over object writing | no | yes
\endtable
@ -67,12 +67,12 @@ SeeAlso
Foam::functionObjects::timeControl
SourceFiles
writeRegisteredObject.C
writeObjects.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_writeRegisteredObject_H
#define functionObjects_writeRegisteredObject_H
#ifndef functionObjects_writeObjects_H
#define functionObjects_writeObjects_H
#include "functionObject.H"
#include "wordReList.H"
@ -89,10 +89,10 @@ namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class writeRegisteredObject Declaration
Class writeObjects Declaration
\*---------------------------------------------------------------------------*/
class writeRegisteredObject
class writeObjects
:
public functionObject
{
@ -111,22 +111,22 @@ class writeRegisteredObject
// Private Member Functions
//- Disallow default bitwise copy construct
writeRegisteredObject(const writeRegisteredObject&);
writeObjects(const writeObjects&);
//- Disallow default bitwise assignment
void operator=(const writeRegisteredObject&);
void operator=(const writeObjects&);
public:
//- Runtime type information
TypeName("writeRegisteredObject");
TypeName("writeObjects");
// Constructors
//- Construct from Time and dictionary
writeRegisteredObject
writeObjects
(
const word& name,
const Time& runTime,
@ -135,12 +135,12 @@ public:
//- Destructor
virtual ~writeRegisteredObject();
virtual ~writeObjects();
// Member Functions
//- Read the writeRegisteredObject data
//- Read the writeObjects data
virtual bool read(const dictionary&);
//- Do nothing

View File

@ -1,122 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// So we get a decent warning if we have multiple functionObject entries
// with the same name.
#inputMode error;
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.5;
deltaT 0.005;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
functions
{
partialWrite
{
// Write some registered objects more often than others.
// Above writeControl determines most frequent dump.
type partialWrite;
// Where to load it from
libs ("libutilityFunctionObjects.so");
// Optional mesh region to operate on. Only one partialWrite per
// region allowed.
region wallFilmRegion;
// Execute upon options:
// timeStep
// writeTime
// adjustableRunTime
// runTime
// clockTime
// cpuTime
writeControl writeTime;
// Objects (fields or lagrangian fields in any of the clouds)
// to write every writeTime
objectNames (p positions nParticle);
// Write as normal every writeInterval'th writeTime.
writeInterval 1; // (timeStep, writeTime)
// Interval of time (sec) to write down(
writeInterval 10.5; //(adjustableRunTime, runTime, clockTime, cpuTime)
}
dumpObjects
{
// Forcibly write registered objects
type writeRegisteredObject;
// Where to load it from
libs ("libutilityFunctionObjects.so");
// When to write:
// timeStep (with optional writeInterval)
// writeTime (with optional writeInterval)
// adjustableRunTime
// runTime
// clockTime
// cpuTime
writeControl writeTime;
// Write every writeInterval (only valid for timeStemp, writeTime)
writeInterval 1;
// Interval of time (valid for adjustableRunTime, runTime, clockTime,
// cpuTime)
writeInterval 10.5;
// Objects to write
objectNames ();
// Is the object written by this function Object alone
// (default is false)
//exclusiveWriting true;
}
}
// ************************************************************************* //