Commit 66a6700a authored by Henry Weller's avatar Henry Weller
Browse files

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

parent 935e5a8f
......@@ -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
}
......
......@@ -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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -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;
}
......
......@@ -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,
......
......@@ -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()
{}
// ************************************************************************* //
......@@ -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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -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;
}
......
......@@ -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()
{}
// ************************************************************************* //
......@@ -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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -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;
}
......
......@@ -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;
......