functionObjectFile: Separated into functionObjectFile and functionObjectFiles

functionObjectFile provides basic directory, file and formatting functions
functionObjectFiles provides multi-file cache
This commit is contained in:
Henry Weller
2016-04-30 09:18:42 +01:00
parent 3c61a1dbeb
commit 67e2d02800
33 changed files with 488 additions and 347 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -57,7 +57,7 @@ Foam::cloudInfo::cloudInfo
const bool loadFromFiles
)
:
functionObjectFile(obr, name),
functionObjectFiles(obr, name),
name_(name),
obr_(obr),
active_(true)
@ -78,7 +78,7 @@ void Foam::cloudInfo::read(const dictionary& dict)
{
if (active_)
{
functionObjectFile::resetNames(dict.lookup("clouds"));
functionObjectFiles::resetNames(dict.lookup("clouds"));
Info<< type() << " " << name_ << ": ";
if (names().size())
@ -114,7 +114,7 @@ void Foam::cloudInfo::write()
{
if (active_)
{
functionObjectFile::write();
functionObjectFiles::write();
forAll(names(), i)
{

View File

@ -72,7 +72,7 @@ SourceFiles
#ifndef cloudInfo_H
#define cloudInfo_H
#include "functionObjectFile.H"
#include "functionObjectFiles.H"
#include "PtrList.H"
#include "pointFieldFwd.H"
#include "volFields.H"
@ -94,7 +94,7 @@ class mapPolyMesh;
class cloudInfo
:
public functionObjectFile
public functionObjectFiles
{
protected:

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
@ -59,7 +59,7 @@ Foam::fieldMinMax::fieldMinMax
const bool loadFromFiles
)
:
functionObjectFile(obr, name, typeName),
functionObjectFiles(obr, name, typeName),
name_(name),
obr_(obr),
active_(true),
@ -164,7 +164,7 @@ void Foam::fieldMinMax::write()
{
if (active_)
{
functionObjectFile::write();
functionObjectFiles::write();
if (!location_) writeTime(file());
if (log_) Info<< type() << " " << name_ << " output:" << nl;

View File

@ -78,7 +78,7 @@ SourceFiles
#ifndef fieldMinMax_H
#define fieldMinMax_H
#include "functionObjectFile.H"
#include "functionObjectFiles.H"
#include "Switch.H"
#include "vector.H"
@ -99,7 +99,7 @@ class mapPolyMesh;
class fieldMinMax
:
public functionObjectFile
public functionObjectFiles
{
public:

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
@ -56,7 +56,7 @@ void Foam::fieldValue::write()
{
if (active_)
{
functionObjectFile::write();
functionObjectFiles::write();
if (log_) Info<< type() << " " << name_ << " output:" << nl;
}
@ -74,7 +74,7 @@ Foam::fieldValue::fieldValue
const bool loadFromFiles
)
:
functionObjectFile(obr, name, valueType),
functionObjectFiles(obr, name, valueType),
name_(name),
obr_(obr),
dict_(dict),

View File

@ -38,7 +38,7 @@ SourceFiles
#ifndef fieldValue_H
#define fieldValue_H
#include "functionObjectFile.H"
#include "functionObjectFiles.H"
#include "Switch.H"
#include "OFstream.H"
#include "dictionary.H"
@ -62,7 +62,7 @@ class mapPolyMesh;
class fieldValue
:
public functionObjectFile
public functionObjectFiles
{
protected:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -64,7 +64,7 @@ Foam::fieldValues::fieldValueDelta::fieldValueDelta
const bool loadFromFiles
)
:
functionObjectFile(obr, name, typeName),
functionObjectFiles(obr, name, typeName),
name_(name),
obr_(obr),
loadFromFiles_(loadFromFiles),
@ -148,7 +148,7 @@ void Foam::fieldValues::fieldValueDelta::read(const dictionary& dict)
void Foam::fieldValues::fieldValueDelta::write()
{
functionObjectFile::write();
functionObjectFiles::write();
source1Ptr_->write();
source2Ptr_->write();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -76,7 +76,7 @@ SourceFiles
#ifndef fieldValueDelta_H
#define fieldValueDelta_H
#include "functionObjectFile.H"
#include "functionObjectFiles.H"
#include "fieldValue.H"
#include "autoPtr.H"
@ -94,7 +94,7 @@ namespace fieldValues
class fieldValueDelta
:
public functionObjectFile
public functionObjectFiles
{
public:
//- Operation type enumeration

View File

@ -74,9 +74,8 @@ Foam::functionObjects::histogram::histogram
const bool loadFromFiles
)
:
functionObjectFile(obr, name, typeName),
functionObjectFile(obr, typeName),
name_(name),
obr_(obr),
active_(true)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
@ -94,6 +93,26 @@ Foam::functionObjects::histogram::histogram
}
Foam::autoPtr<Foam::functionObjects::histogram>
Foam::functionObjects::histogram::New
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
{
if (isA<fvMesh>(obr))
{
return autoPtr<histogram>(new histogram(name, obr, dict));
}
else
{
return autoPtr<histogram>();
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::histogram::~histogram()
@ -108,8 +127,7 @@ void Foam::functionObjects::histogram::read(const dictionary& dict)
{
dict.lookup("field") >> fieldName_;
dict.lookup("max") >> max_;
min_ = 0.0;
dict.readIfPresent("min", min_);
min_ = dict.lookupOrDefault<scalar>("min", 0);
dict.lookup("nBins") >> nBins_;
word format(dict.lookup("setFormat"));

View File

@ -30,7 +30,7 @@ Group
Description
Write the volume-weighted histogram of a volScalarField.
Example of function object specification:
Example:
\verbatim
histogram1
{
@ -69,9 +69,9 @@ SourceFiles
#ifndef functionObjects_histogram_H
#define functionObjects_histogram_H
#include "functionObjectFile.H"
#include "writer.H"
#include "volFieldsFwd.H"
#include "functionObjectFile.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -79,6 +79,7 @@ namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class mapPolyMesh;
class polyMesh;
@ -95,11 +96,9 @@ class histogram
{
// Private data
//- Name of this set of histogram objects
//- Name of this histogram
word name_;
const objectRegistry& obr_;
//- on/off switch
bool active_;
@ -153,6 +152,16 @@ public:
const bool loadFromFiles = false
);
//- Construct on free-store and return pointer if successful
// otherwise return a null-pointer
static autoPtr<histogram> New
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
// Destructor

View File

@ -322,7 +322,7 @@ Foam::regionSizeDistribution::regionSizeDistribution
const bool loadFromFiles
)
:
functionObjectFile(obr, name, typeName),
functionObjectFiles(obr, name, typeName),
name_(name),
obr_(obr),
active_(true),

View File

@ -106,7 +106,7 @@ SourceFiles
#ifndef regionSizeDistribution_H
#define regionSizeDistribution_H
#include "functionObjectFile.H"
#include "functionObjectFiles.H"
#include "pointFieldFwd.H"
#include "writer.H"
#include "Map.H"
@ -132,7 +132,7 @@ class polyMesh;
class regionSizeDistribution
:
public functionObjectFile
public functionObjectFiles
{
// Private data

View File

@ -199,7 +199,7 @@ void Foam::forceCoeffs::write()
if (Pstream::master())
{
functionObjectFile::write();
functionObjectFiles::write();
scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;

View File

@ -524,7 +524,7 @@ Foam::forces::forces
const bool readFields
)
:
functionObjectFile(obr, name, createFileNames(dict)),
functionObjectFiles(obr, name, createFileNames(dict)),
name_(name),
obr_(obr),
active_(true),
@ -583,7 +583,7 @@ Foam::forces::forces
const coordinateSystem& coordSys
)
:
functionObjectFile(obr, name, typeName),
functionObjectFiles(obr, name, typeName),
name_(name),
obr_(obr),
active_(true),
@ -787,7 +787,7 @@ void Foam::forces::write()
if (Pstream::master())
{
functionObjectFile::write();
functionObjectFiles::write();
writeForces();

View File

@ -113,7 +113,7 @@ SourceFiles
#ifndef forces_H
#define forces_H
#include "functionObjectFile.H"
#include "functionObjectFiles.H"
#include "coordinateSystem.H"
#include "coordinateSystems.H"
#include "primitiveFieldsFwd.H"
@ -141,7 +141,7 @@ class mapPolyMesh;
class forces
:
public functionObjectFile
public functionObjectFiles
{
protected:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,7 +46,7 @@ Foam::residuals::residuals
const bool loadFromFiles
)
:
functionObjectFile(obr, name, typeName),
functionObjectFiles(obr, name, typeName),
name_(name),
obr_(obr),
active_(true),
@ -121,7 +121,7 @@ void Foam::residuals::write()
{
if (active_)
{
functionObjectFile::write();
functionObjectFiles::write();
if (Pstream::master())
{

View File

@ -62,7 +62,7 @@ SourceFiles
#ifndef residuals_H
#define residuals_H
#include "functionObjectFile.H"
#include "functionObjectFiles.H"
#include "primitiveFieldsFwd.H"
#include "volFieldsFwd.H"
#include "HashSet.H"
@ -88,7 +88,7 @@ class mapPolyMesh;
class residuals
:
public functionObjectFile
public functionObjectFiles
{
protected:

View File

@ -99,7 +99,7 @@ Foam::wallShearStress::wallShearStress
const bool loadFromFiles
)
:
functionObjectFile(obr, name, typeName),
functionObjectFiles(obr, name, typeName),
name_(name),
obr_(obr),
active_(true),
@ -220,7 +220,7 @@ void Foam::wallShearStress::execute()
if (active_)
{
functionObjectFile::write();
functionObjectFiles::write();
const fvMesh& mesh = refCast<const fvMesh>(obr_);
@ -279,7 +279,7 @@ void Foam::wallShearStress::write()
{
if (active_)
{
functionObjectFile::write();
functionObjectFiles::write();
const volVectorField& wallShearStress =
obr_.lookupObject<volVectorField>(type());

View File

@ -73,10 +73,10 @@ SourceFiles
#ifndef wallShearStress_H
#define wallShearStress_H
#include "functionObjectFile.H"
#include "functionObjectFiles.H"
#include "volFieldsFwd.H"
#include "Switch.H"
#include "OFstream.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -96,7 +96,7 @@ class fvMesh;
class wallShearStress
:
public functionObjectFile
public functionObjectFiles
{
protected:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -61,7 +61,7 @@ Foam::yPlus::yPlus
const bool loadFromFiles
)
:
functionObjectFile(obr, name, typeName),
functionObjectFiles(obr, name, typeName),
name_(name),
obr_(obr),
active_(true),
@ -128,7 +128,7 @@ void Foam::yPlus::execute()
if (active_)
{
functionObjectFile::write();
functionObjectFiles::write();
const fvMesh& mesh = refCast<const fvMesh>(obr_);
@ -184,7 +184,7 @@ void Foam::yPlus::write()
{
if (active_)
{
functionObjectFile::write();
functionObjectFiles::write();
const volScalarField& yPlus =
obr_.lookupObject<volScalarField>(type());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,7 +40,7 @@ SourceFiles
#ifndef yPlus_H
#define yPlus_H
#include "functionObjectFile.H"
#include "functionObjectFiles.H"
#include "volFieldsFwd.H"
#include "Switch.H"
#include "OFstream.H"
@ -63,7 +63,7 @@ class fvMesh;
class yPlus
:
public functionObjectFile
public functionObjectFiles
{
// Private data