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) 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