diff --git a/etc/caseDicts/postProcessing/fields/turbulenceFields b/etc/caseDicts/postProcessing/fields/turbulenceFields index 91aa25420598e19f9613a94bcc1d9f7e40d5f7ce..128467eb1aaf6f0b6c690a22d4f05396520cda44 100644 --- a/etc/caseDicts/postProcessing/fields/turbulenceFields +++ b/etc/caseDicts/postProcessing/fields/turbulenceFields @@ -11,7 +11,7 @@ turbulenceFields type turbulenceFields; libs ("libfieldFunctionObjects.so"); - fields (<list of field names>); + fields (<field names>); executeControl writeTime; writeControl writeTime; diff --git a/etc/caseDicts/postProcessing/fields/writeObjects b/etc/caseDicts/postProcessing/fields/writeObjects new file mode 100644 index 0000000000000000000000000000000000000000..a90743cc3ea0023eb7e556c5f7723b5457ed1dde --- /dev/null +++ b/etc/caseDicts/postProcessing/fields/writeObjects @@ -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; +} + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C index d85bc46a2c399e7afe46547d0ca931e327824a2d..89223ebb736f7e22ce191dfb1b5bbd46eaf4df48 100644 --- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C +++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObjectTemplates.C @@ -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; diff --git a/src/functionObjects/utilities/Make/files b/src/functionObjects/utilities/Make/files index c064190a489d3bea20eac1d5fe8d1ff4df1ec59b..870ee734ce914daac544985571183e165ae01d87 100644 --- a/src/functionObjects/utilities/Make/files +++ b/src/functionObjects/utilities/Make/files @@ -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 diff --git a/src/functionObjects/utilities/writeRegisteredObject/writeRegisteredObject.C b/src/functionObjects/utilities/writeObjects/writeObjects.C similarity index 78% rename from src/functionObjects/utilities/writeRegisteredObject/writeRegisteredObject.C rename to src/functionObjects/utilities/writeObjects/writeObjects.C index a108afa29a427137feee3c85fb2e739714a1d7a6..1ade3208b8548ee116a1231af24bf993bc12b6e7 100644 --- a/src/functionObjects/utilities/writeRegisteredObject/writeRegisteredObject.C +++ b/src/functionObjects/utilities/writeObjects/writeObjects.C @@ -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(); } diff --git a/src/functionObjects/utilities/writeRegisteredObject/writeRegisteredObject.H b/src/functionObjects/utilities/writeObjects/writeObjects.H similarity index 85% rename from src/functionObjects/utilities/writeRegisteredObject/writeRegisteredObject.H rename to src/functionObjects/utilities/writeObjects/writeObjects.H index ad24be130436681720c25f4f78e42af4baeef888..659fe6a7c9305d34470cd3d4cb2975f79d48934f 100644 --- a/src/functionObjects/utilities/writeRegisteredObject/writeRegisteredObject.H +++ b/src/functionObjects/utilities/writeObjects/writeObjects.H @@ -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 diff --git a/src/functionObjects/utilities/writeRegisteredObject/controlDict b/src/functionObjects/utilities/writeRegisteredObject/controlDict deleted file mode 100644 index 32b81bd46c263f1611584ef11b8736d258b24e04..0000000000000000000000000000000000000000 --- a/src/functionObjects/utilities/writeRegisteredObject/controlDict +++ /dev/null @@ -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; - } -} - -// ************************************************************************* //