diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C index a681b856930d61eb5037d0a5dc5bbdc83ec4bb1f..c04f6eca2d2afd91ac6d965d98552af0108ac443 100644 --- a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,14 +33,17 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam +{ +namespace functionObjects { defineTypeNameAndDebug(partialWrite, 0); } +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::partialWrite::partialWrite +Foam::functionObjects::partialWrite::partialWrite ( const word& name, const objectRegistry& obr, @@ -55,15 +58,38 @@ Foam::partialWrite::partialWrite } +Foam::autoPtr<Foam::functionObjects::partialWrite> +Foam::functionObjects::partialWrite::New +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +{ + if (isA<fvMesh>(obr)) + { + return autoPtr<partialWrite> + ( + new partialWrite(name, obr, dict, loadFromFiles) + ); + } + else + { + return autoPtr<partialWrite>(); + } +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::partialWrite::~partialWrite() +Foam::functionObjects::partialWrite::~partialWrite() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::partialWrite::read(const dictionary& dict) +void Foam::functionObjects::partialWrite::read(const dictionary& dict) { dict.lookup("objectNames") >> objectNames_; dict.lookup("writeInterval") >> writeInterval_; @@ -72,6 +98,7 @@ void Foam::partialWrite::read(const dictionary& dict) Info<< type() << " " << name() << ":" << nl << " dumping every " << writeInterval_ << " th outputTime : " << nl << endl ; + forAllConstIter(HashSet<word>, objectNames_, iter) { Info<< ' ' << iter.key(); @@ -109,19 +136,15 @@ void Foam::partialWrite::read(const dictionary& dict) } -void Foam::partialWrite::execute() -{ -} +void Foam::functionObjects::partialWrite::execute() +{} -void Foam::partialWrite::end() -{ - //Pout<< "end at time " << obr_.time().timeName() << endl; - // Do nothing - only valid on write -} +void Foam::functionObjects::partialWrite::end() +{} -void Foam::partialWrite::timeSet() +void Foam::functionObjects::partialWrite::timeSet() { if (obr_.time().outputTime()) { @@ -171,10 +194,9 @@ void Foam::partialWrite::timeSet() } -void Foam::partialWrite::write() +void Foam::functionObjects::partialWrite::write() { - // Do nothing. The fields get written through the - // standard dump + // Fields are written in the standard manner } diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H index 59f101619f283d999b6066af4564fcbc218d8245..a49aabc1293b01e45e535fe82a390d8f02932406 100644 --- a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H @@ -81,6 +81,9 @@ class dictionary; class polyMesh; class mapPolyMesh; +namespace functionObjects +{ + /*---------------------------------------------------------------------------*\ Class partialWrite Declaration \*---------------------------------------------------------------------------*/ @@ -91,7 +94,7 @@ protected: // Private data - //- Name of this set of partialWrite + //- Name of this partialWrite functionObject word name_; const objectRegistry& obr_; @@ -168,6 +171,16 @@ public: const bool loadFromFiles = false ); + //- Construct on free-store and return pointer if successful + // otherwise return a null-pointer + static autoPtr<partialWrite> New + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + //- Destructor virtual ~partialWrite(); @@ -208,6 +221,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace functionObjects } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.H b/src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.H index a84b02aa115039cc8b231a17309971f1ad33ee2f..a65a095fe581b0bff33e838b0602579775d02c1a 100644 --- a/src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.H +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,7 @@ SourceFiles namespace Foam { - typedef OutputFilterFunctionObject<partialWrite> + typedef OutputFilterFunctionObject<functionObjects::partialWrite> partialWriteFunctionObject; } diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWriteTemplates.C b/src/postProcessing/functionObjects/IO/partialWrite/partialWriteTemplates.C index ea6683fffe4ee317858b7b3e0f1a35199b2e84a4..0cd06903c9e149faa7ab6a297312ee94dab1a796 100644 --- a/src/postProcessing/functionObjects/IO/partialWrite/partialWriteTemplates.C +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWriteTemplates.C @@ -31,7 +31,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template<class Type> -void Foam::partialWrite::loadField +void Foam::functionObjects::partialWrite::loadField ( const word& fieldName, UPtrList<GeometricField<Type, fvPatchField, volMesh>>& vflds, @@ -83,7 +83,7 @@ void Foam::partialWrite::loadField template<class Type> -void Foam::partialWrite::changeWriteOptions +void Foam::functionObjects::partialWrite::changeWriteOptions ( UPtrList<GeometricField<Type, fvPatchField, volMesh>>& vflds, UPtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& sflds, diff --git a/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.C b/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.C index 28bb18292eb5ba423f00f42f863c8b04f797a651..ea296544c3f70511af24527d0292c5bafcfcd9c5 100644 --- a/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.C +++ b/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,13 +31,16 @@ License namespace Foam { -defineTypeNameAndDebug(removeRegisteredObject, 0); +namespace functionObjects +{ + defineTypeNameAndDebug(removeRegisteredObject, 0); +} } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::removeRegisteredObject::removeRegisteredObject +Foam::functionObjects::removeRegisteredObject::removeRegisteredObject ( const word& name, const objectRegistry& obr, @@ -53,21 +56,37 @@ Foam::removeRegisteredObject::removeRegisteredObject } +Foam::autoPtr<Foam::functionObjects::removeRegisteredObject> +Foam::functionObjects::removeRegisteredObject::New +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +{ + return autoPtr<removeRegisteredObject> + ( + new removeRegisteredObject(name, obr, dict, loadFromFiles) + ); +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::removeRegisteredObject::~removeRegisteredObject() +Foam::functionObjects::removeRegisteredObject::~removeRegisteredObject() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::removeRegisteredObject::read(const dictionary& dict) +void Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict) { dict.lookup("objectNames") >> objectNames_; } -void Foam::removeRegisteredObject::execute() +void Foam::functionObjects::removeRegisteredObject::execute() { forAll(objectNames_, i) { @@ -90,22 +109,18 @@ void Foam::removeRegisteredObject::execute() } -void Foam::removeRegisteredObject::end() +void Foam::functionObjects::removeRegisteredObject::end() { execute(); } -void Foam::removeRegisteredObject::timeSet() -{ - // Do nothing - only valid on execute -} +void Foam::functionObjects::removeRegisteredObject::timeSet() +{} -void Foam::removeRegisteredObject::write() -{ - // Do nothing - only valid on execute -} +void Foam::functionObjects::removeRegisteredObject::write() +{} // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.H b/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.H index 8a9b2774f9cf198b3801af0db90098f977b3c948..860a2e98635b6790a28a9dbc5a0ec9c8efad9c85 100644 --- a/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.H +++ b/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.H @@ -75,6 +75,9 @@ class dictionary; class polyMesh; class mapPolyMesh; +namespace functionObjects +{ + /*---------------------------------------------------------------------------*\ Class removeRegisteredObject Declaration \*---------------------------------------------------------------------------*/ @@ -125,6 +128,16 @@ public: const bool loadFromFiles = false ); + //- Construct on free-store and return pointer if successful + // otherwise return a null-pointer + static autoPtr<removeRegisteredObject> New + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + //- Destructor virtual ~removeRegisteredObject(); @@ -165,6 +178,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace functionObjects } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObjectFunctionObject.H b/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObjectFunctionObject.H index 9bc0e1be51b101aea9fa7aa35324def13b170669..e166d00be7efd69cb15cfe369ba0c7b139a5473e 100644 --- a/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObjectFunctionObject.H +++ b/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObjectFunctionObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,7 @@ SourceFiles namespace Foam { - typedef OutputFilterFunctionObject<removeRegisteredObject> + typedef OutputFilterFunctionObject<functionObjects::removeRegisteredObject> removeRegisteredObjectFunctionObject; } diff --git a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C index 0e6ec44ce8cd2c44c52ff0a8df70a6a38b047b0f..7acd2abefbccaaea9dea27b031e021134bf52a27 100644 --- a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C +++ b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,13 +32,16 @@ License namespace Foam { -defineTypeNameAndDebug(writeDictionary, 0); +namespace functionObjects +{ + defineTypeNameAndDebug(writeDictionary, 0); +} } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -bool Foam::writeDictionary::tryDirectory +bool Foam::functionObjects::writeDictionary::tryDirectory ( const label dictI, const word& location, @@ -86,7 +89,7 @@ bool Foam::writeDictionary::tryDirectory // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::writeDictionary::writeDictionary +Foam::functionObjects::writeDictionary::writeDictionary ( const word& name, const objectRegistry& obr, @@ -100,20 +103,35 @@ Foam::writeDictionary::writeDictionary digests_() { read(dict); - execute(); } +Foam::autoPtr<Foam::functionObjects::writeDictionary> +Foam::functionObjects::writeDictionary::New +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +{ + return autoPtr<writeDictionary> + ( + new writeDictionary(name, obr, dict, loadFromFiles) + ); +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::writeDictionary::~writeDictionary() +Foam::functionObjects::writeDictionary::~writeDictionary() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::writeDictionary::read(const dictionary& dict) +void Foam::functionObjects::writeDictionary::read(const dictionary& dict) { wordList dictNames(dict.lookup("dictNames")); HashSet<word> uniqueNames(dictNames); @@ -137,7 +155,7 @@ void Foam::writeDictionary::read(const dictionary& dict) } -void Foam::writeDictionary::execute() +void Foam::functionObjects::writeDictionary::execute() { bool firstDict = true; forAll(dictNames_, i) @@ -193,22 +211,18 @@ void Foam::writeDictionary::execute() } -void Foam::writeDictionary::end() +void Foam::functionObjects::writeDictionary::end() { execute(); } -void Foam::writeDictionary::timeSet() -{ - // do nothing -} +void Foam::functionObjects::writeDictionary::timeSet() +{} -void Foam::writeDictionary::write() -{ - // do nothing -} +void Foam::functionObjects::writeDictionary::write() +{} // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.H b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.H index 9282daec35400875cd64ee8119c1d0427a87d0c3..19d42766efc9f7dfb9277fc61895959e69d70f2d 100644 --- a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.H +++ b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.H @@ -54,6 +54,9 @@ class dictionary; class polyMesh; class mapPolyMesh; +namespace functionObjects +{ + /*---------------------------------------------------------------------------*\ Class writeDictionary Declaration \*---------------------------------------------------------------------------*/ @@ -117,6 +120,16 @@ public: const bool loadFromFiles = false ); + //- Construct on free-store and return pointer if successful + // otherwise return a null-pointer + static autoPtr<writeDictionary> New + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + //- Destructor virtual ~writeDictionary(); @@ -157,6 +170,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace functionObjects } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionaryFunctionObject.H b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionaryFunctionObject.H index 2f53fd5d2e9a1190f5991b68325c5cf1271a74ba..f75e01271dbaf445db945c95c20e14e9c9be58bf 100644 --- a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionaryFunctionObject.H +++ b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionaryFunctionObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,7 @@ SourceFiles namespace Foam { - typedef OutputFilterFunctionObject<writeDictionary> + typedef OutputFilterFunctionObject<functionObjects::writeDictionary> writeDictionaryFunctionObject; } diff --git a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C index 35513a0b8b4fd1cd40848b356751063682e05335..ad68d6b9aea3c771c8ae29c566fca649473c5152 100644 --- a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C +++ b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,13 +31,16 @@ License namespace Foam { -defineTypeNameAndDebug(writeRegisteredObject, 0); +namespace functionObjects +{ + defineTypeNameAndDebug(writeRegisteredObject, 0); +} } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::writeRegisteredObject::writeRegisteredObject +Foam::functionObjects::writeRegisteredObject::writeRegisteredObject ( const word& name, const objectRegistry& obr, @@ -54,40 +57,50 @@ Foam::writeRegisteredObject::writeRegisteredObject } +Foam::autoPtr<Foam::functionObjects::writeRegisteredObject> +Foam::functionObjects::writeRegisteredObject::New +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +{ + return autoPtr<writeRegisteredObject> + ( + new writeRegisteredObject(name, obr, dict, loadFromFiles) + ); +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::writeRegisteredObject::~writeRegisteredObject() +Foam::functionObjects::writeRegisteredObject::~writeRegisteredObject() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::writeRegisteredObject::read(const dictionary& dict) +void Foam::functionObjects::writeRegisteredObject::read(const dictionary& dict) { dict.lookup("objectNames") >> objectNames_; dict.readIfPresent("exclusiveWriting", exclusiveWriting_); } -void Foam::writeRegisteredObject::execute() -{ - // Do nothing - only valid on write -} +void Foam::functionObjects::writeRegisteredObject::execute() +{} -void Foam::writeRegisteredObject::end() -{ - // Do nothing - only valid on write -} +void Foam::functionObjects::writeRegisteredObject::end() +{} -void Foam::writeRegisteredObject::timeSet() -{ - // Do nothing - only valid on write -} +void Foam::functionObjects::writeRegisteredObject::timeSet() +{} -void Foam::writeRegisteredObject::write() +void Foam::functionObjects::writeRegisteredObject::write() { Info<< type() << " " << name_ << " output:" << nl; diff --git a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H index a4fd4dec630f3da215edb91175bfcf83a31232bf..37bb625c4e8c491ec7bc41180803c16d7be8a082 100644 --- a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H +++ b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H @@ -89,6 +89,9 @@ class dictionary; class polyMesh; class mapPolyMesh; +namespace functionObjects +{ + /*---------------------------------------------------------------------------*\ Class writeRegisteredObject Declaration \*---------------------------------------------------------------------------*/ @@ -140,6 +143,16 @@ public: const bool loadFromFiles = false ); + //- Construct on free-store and return pointer if successful + // otherwise return a null-pointer + static autoPtr<writeRegisteredObject> New + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + //- Destructor virtual ~writeRegisteredObject(); @@ -180,6 +193,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace functionObjects } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObjectFunctionObject.H b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObjectFunctionObject.H index a7e47134f78167f3f7fc668bc7da6b91dd22dccb..dd45776f4e7a8fd81b7c6c87924fff320c5e9ec7 100644 --- a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObjectFunctionObject.H +++ b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObjectFunctionObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,7 @@ SourceFiles namespace Foam { - typedef OutputFilterFunctionObject<writeRegisteredObject> + typedef OutputFilterFunctionObject<functionObjects::writeRegisteredObject> writeRegisteredObjectFunctionObject; } diff --git a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C index 902c79d0cfe549b8dc6ec1c176b3095bfe72d73d..f17f36684553d94a8090d63027a929e5ddd4a3b7 100644 --- a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C +++ b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C @@ -30,14 +30,17 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam +{ +namespace functionObjects { defineTypeNameAndDebug(cloudInfo, 0); } +} // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -void Foam::cloudInfo::writeFileHeader(const label i) +void Foam::functionObjects::cloudInfo::writeFileHeader(const label i) { writeHeader(file(), "Cloud information"); writeCommented(file(), "Time"); @@ -49,7 +52,7 @@ void Foam::cloudInfo::writeFileHeader(const label i) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::cloudInfo::cloudInfo +Foam::functionObjects::cloudInfo::cloudInfo ( const word& name, const objectRegistry& obr, @@ -66,15 +69,31 @@ Foam::cloudInfo::cloudInfo } +Foam::autoPtr<Foam::functionObjects::cloudInfo> +Foam::functionObjects::cloudInfo::New +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +{ + return autoPtr<cloudInfo> + ( + new cloudInfo(name, obr, dict, loadFromFiles) + ); +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::cloudInfo::~cloudInfo() +Foam::functionObjects::cloudInfo::~cloudInfo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::cloudInfo::read(const dictionary& dict) +void Foam::functionObjects::cloudInfo::read(const dictionary& dict) { if (active_) { @@ -98,19 +117,19 @@ void Foam::cloudInfo::read(const dictionary& dict) } -void Foam::cloudInfo::execute() +void Foam::functionObjects::cloudInfo::execute() {} -void Foam::cloudInfo::end() +void Foam::functionObjects::cloudInfo::end() {} -void Foam::cloudInfo::timeSet() +void Foam::functionObjects::cloudInfo::timeSet() {} -void Foam::cloudInfo::write() +void Foam::functionObjects::cloudInfo::write() { if (active_) { diff --git a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H index 281ef26b82426a4a5b413b0ee8559d390adc98a5..3af05b7d1043d5b326ae75a822a11661774a1c02 100644 --- a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H +++ b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H @@ -88,6 +88,9 @@ class objectRegistry; class dictionary; class mapPolyMesh; +namespace functionObjects +{ + /*---------------------------------------------------------------------------*\ Class cloudInfo Declaration \*---------------------------------------------------------------------------*/ @@ -145,6 +148,16 @@ public: const bool loadFromFiles = false ); + //- Construct on free-store and return pointer if successful + // otherwise return a null-pointer + static autoPtr<cloudInfo> New + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + //- Destructor virtual ~cloudInfo(); @@ -185,6 +198,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace functionObjects } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfoFunctionObject.H b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfoFunctionObject.H index 3d85754fceb28ff62ce226939b144d61f3cab493..6cfd39830e8f0ce80a4f39b659af64ae628295a5 100644 --- a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfoFunctionObject.H +++ b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfoFunctionObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,7 @@ SourceFiles namespace Foam { - typedef OutputFilterFunctionObject<cloudInfo> + typedef OutputFilterFunctionObject<functionObjects::cloudInfo> cloudInfoFunctionObject; } diff --git a/src/postProcessing/functionObjects/field/histogram/histogram.C b/src/postProcessing/functionObjects/field/histogram/histogram.C index 79391d628e46074741e4bad354627c6f1257032d..38c0f59c151d4e90a298bce009a55e8c26dfb1cc 100644 --- a/src/postProcessing/functionObjects/field/histogram/histogram.C +++ b/src/postProcessing/functionObjects/field/histogram/histogram.C @@ -104,7 +104,10 @@ Foam::functionObjects::histogram::New { if (isA<fvMesh>(obr)) { - return autoPtr<histogram>(new histogram(name, obr, dict)); + return autoPtr<histogram> + ( + new histogram(name, obr, dict, loadFromFiles) + ); } else { diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C index a6e6dd108f692bf508b89e7d5db73663036f381c..f54bc9bf2b1dbbdec64aa5dbbd18507cd98b0109 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -26,20 +26,24 @@ License #include "forceCoeffs.H" #include "dictionary.H" #include "Time.H" +#include "fvMesh.H" #include "Pstream.H" #include "IOmanip.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam +{ +namespace functionObjects { defineTypeNameAndDebug(forceCoeffs, 0); } +} // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -void Foam::forceCoeffs::writeFileHeader(const label i) +void Foam::functionObjects::forceCoeffs::writeFileHeader(const label i) { if (i == 0) { @@ -119,7 +123,7 @@ void Foam::forceCoeffs::writeFileHeader(const label i) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::forceCoeffs::forceCoeffs +Foam::functionObjects::forceCoeffs::forceCoeffs ( const word& name, const objectRegistry& obr, @@ -141,15 +145,38 @@ Foam::forceCoeffs::forceCoeffs } +Foam::autoPtr<Foam::functionObjects::forceCoeffs> +Foam::functionObjects::forceCoeffs::New +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +{ + if (isA<fvMesh>(obr)) + { + return autoPtr<forceCoeffs> + ( + new forceCoeffs(name, obr, dict, loadFromFiles) + ); + } + else + { + return autoPtr<forceCoeffs>(); + } +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::forceCoeffs::~forceCoeffs() +Foam::functionObjects::forceCoeffs::~forceCoeffs() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::forceCoeffs::read(const dictionary& dict) +void Foam::functionObjects::forceCoeffs::read(const dictionary& dict) { if (active_) { @@ -170,25 +197,19 @@ void Foam::forceCoeffs::read(const dictionary& dict) } -void Foam::forceCoeffs::execute() -{ - // Do nothing - only valid on write -} +void Foam::functionObjects::forceCoeffs::execute() +{} -void Foam::forceCoeffs::end() -{ - // Do nothing - only valid on write -} +void Foam::functionObjects::forceCoeffs::end() +{} -void Foam::forceCoeffs::timeSet() -{ - // Do nothing - only valid on write -} +void Foam::functionObjects::forceCoeffs::timeSet() +{} -void Foam::forceCoeffs::write() +void Foam::functionObjects::forceCoeffs::write() { forces::calcForcesMoment(); diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H index e291065f33e309e8349445f5d880e34b9666a3be..c061831135903373e56ab1c28a031f3cd4d42db8 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,6 +99,8 @@ SourceFiles namespace Foam { +namespace functionObjects +{ /*---------------------------------------------------------------------------*\ Class forceCoeffs Declaration @@ -170,6 +172,16 @@ public: const bool loadFromFiles = false ); + //- Construct on free-store and return pointer if successful + // otherwise return a null-pointer + static autoPtr<forceCoeffs> New + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + //- Destructor virtual ~forceCoeffs(); @@ -196,6 +208,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace functionObjects } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffsFunctionObject.H b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffsFunctionObject.H index f47469fff9034c6179aeb103cb3dd764abe22182..7be6eb561afc3d496f2d7eefca9a4d86b5194ad9 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffsFunctionObject.H +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffsFunctionObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,8 @@ SourceFiles namespace Foam { - typedef OutputFilterFunctionObject<forceCoeffs> forceCoeffsFunctionObject; + typedef OutputFilterFunctionObject<functionObjects::forceCoeffs> + forceCoeffsFunctionObject; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index 743dd1a27ed88a3fe1b8f20503a3d0df6d49ae15..4775d1caa0c02ed0453b0c202296acd631a36f05 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -36,14 +36,20 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam +{ +namespace functionObjects { defineTypeNameAndDebug(forces, 0); } +} // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -Foam::wordList Foam::forces::createFileNames(const dictionary& dict) const +Foam::wordList Foam::functionObjects::forces::createFileNames +( + const dictionary& dict +) const { DynamicList<word> names(1); @@ -65,7 +71,7 @@ Foam::wordList Foam::forces::createFileNames(const dictionary& dict) const } -void Foam::forces::writeFileHeader(const label i) +void Foam::functionObjects::forces::writeFileHeader(const label i) { if (i == 0) { @@ -153,7 +159,7 @@ void Foam::forces::writeFileHeader(const label i) } -void Foam::forces::initialise() +void Foam::functionObjects::forces::initialise() { if (initialised_ || !active_) { @@ -202,7 +208,8 @@ void Foam::forces::initialise() } -Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const +Foam::tmp<Foam::volSymmTensorField> +Foam::functionObjects::forces::devRhoReff() const { typedef compressible::turbulenceModel cmpTurbModel; typedef incompressible::turbulenceModel icoTurbModel; @@ -264,7 +271,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const } -Foam::tmp<Foam::volScalarField> Foam::forces::mu() const +Foam::tmp<Foam::volScalarField> Foam::functionObjects::forces::mu() const { if (obr_.foundObject<fluidThermo>(basicThermo::dictName)) { @@ -303,7 +310,7 @@ Foam::tmp<Foam::volScalarField> Foam::forces::mu() const } -Foam::tmp<Foam::volScalarField> Foam::forces::rho() const +Foam::tmp<Foam::volScalarField> Foam::functionObjects::forces::rho() const { if (rhoName_ == "rhoInf") { @@ -331,7 +338,7 @@ Foam::tmp<Foam::volScalarField> Foam::forces::rho() const } -Foam::scalar Foam::forces::rho(const volScalarField& p) const +Foam::scalar Foam::functionObjects::forces::rho(const volScalarField& p) const { if (p.dimensions() == dimPressure) { @@ -351,7 +358,7 @@ Foam::scalar Foam::forces::rho(const volScalarField& p) const } -void Foam::forces::applyBins +void Foam::functionObjects::forces::applyBins ( const vectorField& Md, const vectorField& fN, @@ -388,7 +395,7 @@ void Foam::forces::applyBins } -void Foam::forces::writeForces() +void Foam::functionObjects::forces::writeForces() { if (log_) Info << type() << " " << name_ << " output:" << nl @@ -434,7 +441,7 @@ void Foam::forces::writeForces() } -void Foam::forces::writeBins() +void Foam::functionObjects::forces::writeBins() { if (nBin_ == 1) { @@ -515,7 +522,7 @@ void Foam::forces::writeBins() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::forces::forces +Foam::functionObjects::forces::forces ( const word& name, const objectRegistry& obr, @@ -570,7 +577,30 @@ Foam::forces::forces } -Foam::forces::forces +Foam::autoPtr<Foam::functionObjects::forces> +Foam::functionObjects::forces::New +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +{ + if (isA<fvMesh>(obr)) + { + return autoPtr<forces> + ( + new forces(name, obr, dict, loadFromFiles) + ); + } + else + { + return autoPtr<forces>(); + } +} + + +Foam::functionObjects::forces::forces ( const word& name, const objectRegistry& obr, @@ -619,13 +649,13 @@ Foam::forces::forces // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::forces::~forces() +Foam::functionObjects::forces::~forces() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::forces::read(const dictionary& dict) +void Foam::functionObjects::forces::read(const dictionary& dict) { if (active_) { @@ -758,25 +788,19 @@ void Foam::forces::read(const dictionary& dict) } -void Foam::forces::execute() -{ - // Do nothing - only valid on write -} +void Foam::functionObjects::forces::execute() +{} -void Foam::forces::end() -{ - // Do nothing - only valid on write -} +void Foam::functionObjects::forces::end() +{} -void Foam::forces::timeSet() -{ - // Do nothing - only valid on write -} +void Foam::functionObjects::forces::timeSet() +{} -void Foam::forces::write() +void Foam::functionObjects::forces::write() { calcForcesMoment(); @@ -798,7 +822,7 @@ void Foam::forces::write() } -void Foam::forces::calcForcesMoment() +void Foam::functionObjects::forces::calcForcesMoment() { initialise(); @@ -943,13 +967,13 @@ void Foam::forces::calcForcesMoment() } -Foam::vector Foam::forces::forceEff() const +Foam::vector Foam::functionObjects::forces::forceEff() const { return sum(force_[0]) + sum(force_[1]) + sum(force_[2]); } -Foam::vector Foam::forces::momentEff() const +Foam::vector Foam::functionObjects::forces::momentEff() const { return sum(moment_[0]) + sum(moment_[1]) + sum(moment_[2]); } diff --git a/src/postProcessing/functionObjects/forces/forces/forces.H b/src/postProcessing/functionObjects/forces/forces/forces.H index 97706425269ce0542a3e8dce1354959636c502ff..1c5c2befbbe94bc018db2076c94941b2f9c9c9c5 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.H +++ b/src/postProcessing/functionObjects/forces/forces/forces.H @@ -135,6 +135,9 @@ class dictionary; class polyMesh; class mapPolyMesh; +namespace functionObjects +{ + /*---------------------------------------------------------------------------*\ Class forces Declaration \*---------------------------------------------------------------------------*/ @@ -293,6 +296,15 @@ public: const bool readFields = true ); + //- Construct on free-store and return pointer if successful + // otherwise return a null-pointer + static autoPtr<forces> New + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); //- Construct from components forces @@ -357,6 +369,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace functionObjects } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/forces/forces/forcesFunctionObject.H b/src/postProcessing/functionObjects/forces/forces/forcesFunctionObject.H index 0b38a7e50b05bf7951e002a416c84134d6c32ee8..518815cc718548792dcb8612eb30e6a7770fc9fc 100644 --- a/src/postProcessing/functionObjects/forces/forces/forcesFunctionObject.H +++ b/src/postProcessing/functionObjects/forces/forces/forcesFunctionObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,8 @@ SourceFiles namespace Foam { - typedef OutputFilterFunctionObject<forces> forcesFunctionObject; + typedef OutputFilterFunctionObject<functionObjects::forces> + forcesFunctionObject; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotion.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotion.C index 54197202975b0af0f71dc2798fef555967bcb68e..fcff9df278e09ceb78350406dd40989c0aae50f2 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotion.C +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotion.C @@ -250,13 +250,13 @@ void Foam::rigidBodyMeshMotion::solve() const label bodyID = bodyMeshes_[bi].bodyID_; dictionary forcesDict; - forcesDict.add("type", forces::typeName); + forcesDict.add("type", functionObjects::forces::typeName); forcesDict.add("patches", bodyMeshes_[bi].patches_); forcesDict.add("rhoInf", rhoInf_); forcesDict.add("rhoName", rhoName_); forcesDict.add("CofR", vector::zero); - forces f("forces", db(), forcesDict); + functionObjects::forces f("forces", db(), forcesDict); f.calcForcesMoment(); fx[bodyID] = spatialVector(f.momentEff(), f.forceEff()); diff --git a/src/sixDoFRigidBodyMotion/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C b/src/sixDoFRigidBodyMotion/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C index 353397bc2a8cc35058077beb78865b9f617f6f8d..b2ef71dc8f301fbaef96d585b5b493d3f5a47026 100644 --- a/src/sixDoFRigidBodyMotion/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C +++ b/src/sixDoFRigidBodyMotion/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C @@ -210,13 +210,13 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs() dictionary forcesDict; - forcesDict.add("type", forces::typeName); + forcesDict.add("type", functionObjects::forces::typeName); forcesDict.add("patches", wordList(1, ptPatch.name())); forcesDict.add("rhoInf", rhoInf_); forcesDict.add("rhoName", rhoName_); forcesDict.add("CofR", motion_.centreOfRotation()); - forces f("forces", db(), forcesDict); + functionObjects::forces f("forces", db(), forcesDict); f.calcForcesMoment(); diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C index f25d1bba49051e8998495328b14ba0405df624ca..9aaf0785636f535b0e7d11c5933c287c3529331e 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionSolver/sixDoFRigidBodyMotionSolver.C @@ -216,13 +216,13 @@ void Foam::sixDoFRigidBodyMotionSolver::solve() { dictionary forcesDict; - forcesDict.add("type", forces::typeName); + forcesDict.add("type", functionObjects::forces::typeName); forcesDict.add("patches", patches_); forcesDict.add("rhoInf", rhoInf_); forcesDict.add("rhoName", rhoName_); forcesDict.add("CofR", motion_.centreOfRotation()); - forces f("forces", db(), forcesDict); + functionObjects::forces f("forces", db(), forcesDict); f.calcForcesMoment();