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 935e5a8f03
commit 66a6700a4b
26 changed files with 375 additions and 146 deletions

View File

@ -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
}

View File

@ -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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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;
}

View File

@ -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,

View File

@ -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
@ -30,14 +30,17 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
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()
{}
// ************************************************************************* //

View File

@ -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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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;
}

View File

@ -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,14 +31,17 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
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()
{}
// ************************************************************************* //

View File

@ -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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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;
}

View File

@ -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
@ -30,14 +30,17 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
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;

View File

@ -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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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;
}

View File

@ -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_)
{

View File

@ -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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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;
}

View File

@ -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
{

View File

@ -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();

View File

@ -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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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]);
}

View File

@ -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
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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());

View File

@ -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();

View File

@ -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();