src/postProcessing/functionObjects: Moving the functionObjects into the "functionObjects" namespace

This commit is contained in:
Henry Weller
2016-05-01 14:48:30 +01:00
parent a3aa589263
commit 09262f5273
26 changed files with 375 additions and 146 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,14 +33,17 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace functionObjects
{ {
defineTypeNameAndDebug(partialWrite, 0); defineTypeNameAndDebug(partialWrite, 0);
} }
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::partialWrite::partialWrite Foam::functionObjects::partialWrite::partialWrite
( (
const word& name, const word& name,
const objectRegistry& obr, 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 * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::partialWrite::~partialWrite() Foam::functionObjects::partialWrite::~partialWrite()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::partialWrite::read(const dictionary& dict) void Foam::functionObjects::partialWrite::read(const dictionary& dict)
{ {
dict.lookup("objectNames") >> objectNames_; dict.lookup("objectNames") >> objectNames_;
dict.lookup("writeInterval") >> writeInterval_; dict.lookup("writeInterval") >> writeInterval_;
@ -72,6 +98,7 @@ void Foam::partialWrite::read(const dictionary& dict)
Info<< type() << " " << name() << ":" << nl Info<< type() << " " << name() << ":" << nl
<< " dumping every " << writeInterval_ << " dumping every " << writeInterval_
<< " th outputTime : " << nl << endl ; << " th outputTime : " << nl << endl ;
forAllConstIter(HashSet<word>, objectNames_, iter) forAllConstIter(HashSet<word>, objectNames_, iter)
{ {
Info<< ' ' << iter.key(); 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() void Foam::functionObjects::partialWrite::end()
{ {}
//Pout<< "end at time " << obr_.time().timeName() << endl;
// Do nothing - only valid on write
}
void Foam::partialWrite::timeSet() void Foam::functionObjects::partialWrite::timeSet()
{ {
if (obr_.time().outputTime()) 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 // Fields are written in the standard manner
// standard dump
} }

View File

@ -81,6 +81,9 @@ class dictionary;
class polyMesh; class polyMesh;
class mapPolyMesh; class mapPolyMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class partialWrite Declaration Class partialWrite Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -91,7 +94,7 @@ protected:
// Private data // Private data
//- Name of this set of partialWrite //- Name of this partialWrite functionObject
word name_; word name_;
const objectRegistry& obr_; const objectRegistry& obr_;
@ -168,6 +171,16 @@ public:
const bool loadFromFiles = false 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 //- Destructor
virtual ~partialWrite(); virtual ~partialWrite();
@ -208,6 +221,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
typedef OutputFilterFunctionObject<partialWrite> typedef OutputFilterFunctionObject<functionObjects::partialWrite>
partialWriteFunctionObject; partialWriteFunctionObject;
} }

View File

@ -31,7 +31,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::partialWrite::loadField void Foam::functionObjects::partialWrite::loadField
( (
const word& fieldName, const word& fieldName,
UPtrList<GeometricField<Type, fvPatchField, volMesh>>& vflds, UPtrList<GeometricField<Type, fvPatchField, volMesh>>& vflds,
@ -83,7 +83,7 @@ void Foam::partialWrite::loadField
template<class Type> template<class Type>
void Foam::partialWrite::changeWriteOptions void Foam::functionObjects::partialWrite::changeWriteOptions
( (
UPtrList<GeometricField<Type, fvPatchField, volMesh>>& vflds, UPtrList<GeometricField<Type, fvPatchField, volMesh>>& vflds,
UPtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& sflds, UPtrList<GeometricField<Type, fvsPatchField, surfaceMesh>>& sflds,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,13 +31,16 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(removeRegisteredObject, 0); namespace functionObjects
{
defineTypeNameAndDebug(removeRegisteredObject, 0);
}
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::removeRegisteredObject::removeRegisteredObject Foam::functionObjects::removeRegisteredObject::removeRegisteredObject
( (
const word& name, const word& name,
const objectRegistry& obr, 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 * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::removeRegisteredObject::~removeRegisteredObject() Foam::functionObjects::removeRegisteredObject::~removeRegisteredObject()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::removeRegisteredObject::read(const dictionary& dict) void Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
{ {
dict.lookup("objectNames") >> objectNames_; dict.lookup("objectNames") >> objectNames_;
} }
void Foam::removeRegisteredObject::execute() void Foam::functionObjects::removeRegisteredObject::execute()
{ {
forAll(objectNames_, i) forAll(objectNames_, i)
{ {
@ -90,22 +109,18 @@ void Foam::removeRegisteredObject::execute()
} }
void Foam::removeRegisteredObject::end() void Foam::functionObjects::removeRegisteredObject::end()
{ {
execute(); execute();
} }
void Foam::removeRegisteredObject::timeSet() void Foam::functionObjects::removeRegisteredObject::timeSet()
{ {}
// Do nothing - only valid on execute
}
void Foam::removeRegisteredObject::write() void Foam::functionObjects::removeRegisteredObject::write()
{ {}
// Do nothing - only valid on execute
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -75,6 +75,9 @@ class dictionary;
class polyMesh; class polyMesh;
class mapPolyMesh; class mapPolyMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class removeRegisteredObject Declaration Class removeRegisteredObject Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -125,6 +128,16 @@ public:
const bool loadFromFiles = false 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 //- Destructor
virtual ~removeRegisteredObject(); virtual ~removeRegisteredObject();
@ -165,6 +178,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
typedef OutputFilterFunctionObject<removeRegisteredObject> typedef OutputFilterFunctionObject<functionObjects::removeRegisteredObject>
removeRegisteredObjectFunctionObject; removeRegisteredObjectFunctionObject;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,13 +32,16 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(writeDictionary, 0); namespace functionObjects
{
defineTypeNameAndDebug(writeDictionary, 0);
}
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::writeDictionary::tryDirectory bool Foam::functionObjects::writeDictionary::tryDirectory
( (
const label dictI, const label dictI,
const word& location, const word& location,
@ -86,7 +89,7 @@ bool Foam::writeDictionary::tryDirectory
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::writeDictionary::writeDictionary Foam::functionObjects::writeDictionary::writeDictionary
( (
const word& name, const word& name,
const objectRegistry& obr, const objectRegistry& obr,
@ -100,20 +103,35 @@ Foam::writeDictionary::writeDictionary
digests_() digests_()
{ {
read(dict); read(dict);
execute(); 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 * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::writeDictionary::~writeDictionary() Foam::functionObjects::writeDictionary::~writeDictionary()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::writeDictionary::read(const dictionary& dict) void Foam::functionObjects::writeDictionary::read(const dictionary& dict)
{ {
wordList dictNames(dict.lookup("dictNames")); wordList dictNames(dict.lookup("dictNames"));
HashSet<word> uniqueNames(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; bool firstDict = true;
forAll(dictNames_, i) forAll(dictNames_, i)
@ -193,22 +211,18 @@ void Foam::writeDictionary::execute()
} }
void Foam::writeDictionary::end() void Foam::functionObjects::writeDictionary::end()
{ {
execute(); execute();
} }
void Foam::writeDictionary::timeSet() void Foam::functionObjects::writeDictionary::timeSet()
{ {}
// do nothing
}
void Foam::writeDictionary::write() void Foam::functionObjects::writeDictionary::write()
{ {}
// do nothing
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -54,6 +54,9 @@ class dictionary;
class polyMesh; class polyMesh;
class mapPolyMesh; class mapPolyMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class writeDictionary Declaration Class writeDictionary Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -117,6 +120,16 @@ public:
const bool loadFromFiles = false 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 //- Destructor
virtual ~writeDictionary(); virtual ~writeDictionary();
@ -157,6 +170,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
typedef OutputFilterFunctionObject<writeDictionary> typedef OutputFilterFunctionObject<functionObjects::writeDictionary>
writeDictionaryFunctionObject; writeDictionaryFunctionObject;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,13 +31,16 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(writeRegisteredObject, 0); namespace functionObjects
{
defineTypeNameAndDebug(writeRegisteredObject, 0);
}
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::writeRegisteredObject::writeRegisteredObject Foam::functionObjects::writeRegisteredObject::writeRegisteredObject
( (
const word& name, const word& name,
const objectRegistry& obr, 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 * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::writeRegisteredObject::~writeRegisteredObject() Foam::functionObjects::writeRegisteredObject::~writeRegisteredObject()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::writeRegisteredObject::read(const dictionary& dict) void Foam::functionObjects::writeRegisteredObject::read(const dictionary& dict)
{ {
dict.lookup("objectNames") >> objectNames_; dict.lookup("objectNames") >> objectNames_;
dict.readIfPresent("exclusiveWriting", exclusiveWriting_); dict.readIfPresent("exclusiveWriting", exclusiveWriting_);
} }
void Foam::writeRegisteredObject::execute() void Foam::functionObjects::writeRegisteredObject::execute()
{ {}
// Do nothing - only valid on write
}
void Foam::writeRegisteredObject::end() void Foam::functionObjects::writeRegisteredObject::end()
{ {}
// Do nothing - only valid on write
}
void Foam::writeRegisteredObject::timeSet() void Foam::functionObjects::writeRegisteredObject::timeSet()
{ {}
// Do nothing - only valid on write
}
void Foam::writeRegisteredObject::write() void Foam::functionObjects::writeRegisteredObject::write()
{ {
Info<< type() << " " << name_ << " output:" << nl; Info<< type() << " " << name_ << " output:" << nl;

View File

@ -89,6 +89,9 @@ class dictionary;
class polyMesh; class polyMesh;
class mapPolyMesh; class mapPolyMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class writeRegisteredObject Declaration Class writeRegisteredObject Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -140,6 +143,16 @@ public:
const bool loadFromFiles = false 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 //- Destructor
virtual ~writeRegisteredObject(); virtual ~writeRegisteredObject();
@ -180,6 +193,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
typedef OutputFilterFunctionObject<writeRegisteredObject> typedef OutputFilterFunctionObject<functionObjects::writeRegisteredObject>
writeRegisteredObjectFunctionObject; writeRegisteredObjectFunctionObject;
} }

View File

@ -30,14 +30,17 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace functionObjects
{ {
defineTypeNameAndDebug(cloudInfo, 0); defineTypeNameAndDebug(cloudInfo, 0);
} }
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::cloudInfo::writeFileHeader(const label i) void Foam::functionObjects::cloudInfo::writeFileHeader(const label i)
{ {
writeHeader(file(), "Cloud information"); writeHeader(file(), "Cloud information");
writeCommented(file(), "Time"); writeCommented(file(), "Time");
@ -49,7 +52,7 @@ void Foam::cloudInfo::writeFileHeader(const label i)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cloudInfo::cloudInfo Foam::functionObjects::cloudInfo::cloudInfo
( (
const word& name, const word& name,
const objectRegistry& obr, 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 * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cloudInfo::~cloudInfo() Foam::functionObjects::cloudInfo::~cloudInfo()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cloudInfo::read(const dictionary& dict) void Foam::functionObjects::cloudInfo::read(const dictionary& dict)
{ {
if (active_) 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_) if (active_)
{ {

View File

@ -88,6 +88,9 @@ class objectRegistry;
class dictionary; class dictionary;
class mapPolyMesh; class mapPolyMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class cloudInfo Declaration Class cloudInfo Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -145,6 +148,16 @@ public:
const bool loadFromFiles = false 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 //- Destructor
virtual ~cloudInfo(); virtual ~cloudInfo();
@ -185,6 +198,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
typedef OutputFilterFunctionObject<cloudInfo> typedef OutputFilterFunctionObject<functionObjects::cloudInfo>
cloudInfoFunctionObject; cloudInfoFunctionObject;
} }

View File

@ -104,7 +104,10 @@ Foam::functionObjects::histogram::New
{ {
if (isA<fvMesh>(obr)) if (isA<fvMesh>(obr))
{ {
return autoPtr<histogram>(new histogram(name, obr, dict)); return autoPtr<histogram>
(
new histogram(name, obr, dict, loadFromFiles)
);
} }
else else
{ {

View File

@ -26,20 +26,24 @@ License
#include "forceCoeffs.H" #include "forceCoeffs.H"
#include "dictionary.H" #include "dictionary.H"
#include "Time.H" #include "Time.H"
#include "fvMesh.H"
#include "Pstream.H" #include "Pstream.H"
#include "IOmanip.H" #include "IOmanip.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace functionObjects
{ {
defineTypeNameAndDebug(forceCoeffs, 0); defineTypeNameAndDebug(forceCoeffs, 0);
} }
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::forceCoeffs::writeFileHeader(const label i) void Foam::functionObjects::forceCoeffs::writeFileHeader(const label i)
{ {
if (i == 0) if (i == 0)
{ {
@ -119,7 +123,7 @@ void Foam::forceCoeffs::writeFileHeader(const label i)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::forceCoeffs::forceCoeffs Foam::functionObjects::forceCoeffs::forceCoeffs
( (
const word& name, const word& name,
const objectRegistry& obr, 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 * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::forceCoeffs::~forceCoeffs() Foam::functionObjects::forceCoeffs::~forceCoeffs()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::forceCoeffs::read(const dictionary& dict) void Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
{ {
if (active_) if (active_)
{ {
@ -170,25 +197,19 @@ void Foam::forceCoeffs::read(const dictionary& dict)
} }
void Foam::forceCoeffs::execute() void Foam::functionObjects::forceCoeffs::execute()
{ {}
// Do nothing - only valid on write
}
void Foam::forceCoeffs::end() void Foam::functionObjects::forceCoeffs::end()
{ {}
// Do nothing - only valid on write
}
void Foam::forceCoeffs::timeSet() void Foam::functionObjects::forceCoeffs::timeSet()
{ {}
// Do nothing - only valid on write
}
void Foam::forceCoeffs::write() void Foam::functionObjects::forceCoeffs::write()
{ {
forces::calcForcesMoment(); forces::calcForcesMoment();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -99,6 +99,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
namespace functionObjects
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class forceCoeffs Declaration Class forceCoeffs Declaration
@ -170,6 +172,16 @@ public:
const bool loadFromFiles = false 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 //- Destructor
virtual ~forceCoeffs(); virtual ~forceCoeffs();
@ -196,6 +208,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
typedef OutputFilterFunctionObject<forceCoeffs> forceCoeffsFunctionObject; typedef OutputFilterFunctionObject<functionObjects::forceCoeffs>
forceCoeffsFunctionObject;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -36,14 +36,20 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{
namespace functionObjects
{ {
defineTypeNameAndDebug(forces, 0); defineTypeNameAndDebug(forces, 0);
} }
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * 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); 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) 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_) 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 compressible::turbulenceModel cmpTurbModel;
typedef incompressible::turbulenceModel icoTurbModel; 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)) 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") 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) 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& Md,
const vectorField& fN, const vectorField& fN,
@ -388,7 +395,7 @@ void Foam::forces::applyBins
} }
void Foam::forces::writeForces() void Foam::functionObjects::forces::writeForces()
{ {
if (log_) Info if (log_) Info
<< type() << " " << name_ << " output:" << nl << type() << " " << name_ << " output:" << nl
@ -434,7 +441,7 @@ void Foam::forces::writeForces()
} }
void Foam::forces::writeBins() void Foam::functionObjects::forces::writeBins()
{ {
if (nBin_ == 1) if (nBin_ == 1)
{ {
@ -515,7 +522,7 @@ void Foam::forces::writeBins()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::forces::forces Foam::functionObjects::forces::forces
( (
const word& name, const word& name,
const objectRegistry& obr, 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 word& name,
const objectRegistry& obr, const objectRegistry& obr,
@ -619,13 +649,13 @@ Foam::forces::forces
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::forces::~forces() Foam::functionObjects::forces::~forces()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::forces::read(const dictionary& dict) void Foam::functionObjects::forces::read(const dictionary& dict)
{ {
if (active_) if (active_)
{ {
@ -758,25 +788,19 @@ void Foam::forces::read(const dictionary& dict)
} }
void Foam::forces::execute() void Foam::functionObjects::forces::execute()
{ {}
// Do nothing - only valid on write
}
void Foam::forces::end() void Foam::functionObjects::forces::end()
{ {}
// Do nothing - only valid on write
}
void Foam::forces::timeSet() void Foam::functionObjects::forces::timeSet()
{ {}
// Do nothing - only valid on write
}
void Foam::forces::write() void Foam::functionObjects::forces::write()
{ {
calcForcesMoment(); calcForcesMoment();
@ -798,7 +822,7 @@ void Foam::forces::write()
} }
void Foam::forces::calcForcesMoment() void Foam::functionObjects::forces::calcForcesMoment()
{ {
initialise(); 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]); 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]); return sum(moment_[0]) + sum(moment_[1]) + sum(moment_[2]);
} }

View File

@ -135,6 +135,9 @@ class dictionary;
class polyMesh; class polyMesh;
class mapPolyMesh; class mapPolyMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class forces Declaration Class forces Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -293,6 +296,15 @@ public:
const bool readFields = true 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 //- Construct from components
forces forces
@ -357,6 +369,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
typedef OutputFilterFunctionObject<forces> forcesFunctionObject; typedef OutputFilterFunctionObject<functionObjects::forces>
forcesFunctionObject;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -250,13 +250,13 @@ void Foam::rigidBodyMeshMotion::solve()
const label bodyID = bodyMeshes_[bi].bodyID_; const label bodyID = bodyMeshes_[bi].bodyID_;
dictionary forcesDict; dictionary forcesDict;
forcesDict.add("type", forces::typeName); forcesDict.add("type", functionObjects::forces::typeName);
forcesDict.add("patches", bodyMeshes_[bi].patches_); forcesDict.add("patches", bodyMeshes_[bi].patches_);
forcesDict.add("rhoInf", rhoInf_); forcesDict.add("rhoInf", rhoInf_);
forcesDict.add("rhoName", rhoName_); forcesDict.add("rhoName", rhoName_);
forcesDict.add("CofR", vector::zero); forcesDict.add("CofR", vector::zero);
forces f("forces", db(), forcesDict); functionObjects::forces f("forces", db(), forcesDict);
f.calcForcesMoment(); f.calcForcesMoment();
fx[bodyID] = spatialVector(f.momentEff(), f.forceEff()); fx[bodyID] = spatialVector(f.momentEff(), f.forceEff());

View File

@ -210,13 +210,13 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
dictionary forcesDict; dictionary forcesDict;
forcesDict.add("type", forces::typeName); forcesDict.add("type", functionObjects::forces::typeName);
forcesDict.add("patches", wordList(1, ptPatch.name())); forcesDict.add("patches", wordList(1, ptPatch.name()));
forcesDict.add("rhoInf", rhoInf_); forcesDict.add("rhoInf", rhoInf_);
forcesDict.add("rhoName", rhoName_); forcesDict.add("rhoName", rhoName_);
forcesDict.add("CofR", motion_.centreOfRotation()); forcesDict.add("CofR", motion_.centreOfRotation());
forces f("forces", db(), forcesDict); functionObjects::forces f("forces", db(), forcesDict);
f.calcForcesMoment(); f.calcForcesMoment();

View File

@ -216,13 +216,13 @@ void Foam::sixDoFRigidBodyMotionSolver::solve()
{ {
dictionary forcesDict; dictionary forcesDict;
forcesDict.add("type", forces::typeName); forcesDict.add("type", functionObjects::forces::typeName);
forcesDict.add("patches", patches_); forcesDict.add("patches", patches_);
forcesDict.add("rhoInf", rhoInf_); forcesDict.add("rhoInf", rhoInf_);
forcesDict.add("rhoName", rhoName_); forcesDict.add("rhoName", rhoName_);
forcesDict.add("CofR", motion_.centreOfRotation()); forcesDict.add("CofR", motion_.centreOfRotation());
forces f("forces", db(), forcesDict); functionObjects::forces f("forces", db(), forcesDict);
f.calcForcesMoment(); f.calcForcesMoment();