functionObjectFile: Separated into functionObjectFile and functionObjectFiles
functionObjectFile provides basic directory, file and formatting functions functionObjectFiles provides multi-file cache
This commit is contained in:
@ -82,7 +82,7 @@ SeeAlso
|
|||||||
#include "noiseFFT.H"
|
#include "noiseFFT.H"
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFiles.H"
|
||||||
#include "CSV.H"
|
#include "CSV.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -215,6 +215,7 @@ $(dll)/codedBase/codedBase.C
|
|||||||
db/functionObjects/functionObject/functionObject.C
|
db/functionObjects/functionObject/functionObject.C
|
||||||
db/functionObjects/functionObjectList/functionObjectList.C
|
db/functionObjects/functionObjectList/functionObjectList.C
|
||||||
db/functionObjects/functionObjectFile/functionObjectFile.C
|
db/functionObjects/functionObjectFile/functionObjectFile.C
|
||||||
|
db/functionObjects/functionObjectFiles/functionObjectFiles.C
|
||||||
db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C
|
db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -90,8 +90,8 @@ class OutputFilterFunctionObject
|
|||||||
//- De-activation time - defaults to VGREAT
|
//- De-activation time - defaults to VGREAT
|
||||||
scalar timeEnd_;
|
scalar timeEnd_;
|
||||||
|
|
||||||
//- Number of steps before the dumping time in which the deltaT
|
//- Number of steps before the dump-time during which deltaT
|
||||||
// will start to change (valid for ocAdjustableTime)
|
// may be changed (valid for adjustableRunTime)
|
||||||
label nStepsToStartTimeChange_;
|
label nStepsToStartTimeChange_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
@ -126,15 +126,4 @@ bool Foam::functionObject::adjustTimeStep()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::functionObject> Foam::functionObject::iNew::operator()
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
Istream& is
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
dictionary dict(is);
|
|
||||||
return functionObject::New(name, time_, dict);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -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
|
||||||
@ -105,26 +105,6 @@ public:
|
|||||||
return autoPtr<functionObject>(NULL);
|
return autoPtr<functionObject>(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return a pointer to a new functionObject created on freestore
|
|
||||||
// from Istream
|
|
||||||
class iNew
|
|
||||||
{
|
|
||||||
const Time& time_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
iNew(const Time& t)
|
|
||||||
:
|
|
||||||
time_(t)
|
|
||||||
{}
|
|
||||||
|
|
||||||
autoPtr<functionObject> operator()
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
Istream& is
|
|
||||||
) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
|
|||||||
@ -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-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -26,7 +26,7 @@ License
|
|||||||
#include "functionObjectFile.H"
|
#include "functionObjectFile.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "IFstream.H"
|
#include "IOmanip.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -78,81 +78,10 @@ Foam::fileName Foam::functionObjectFile::baseTimeDir() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFile::createFiles()
|
|
||||||
{
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
const word startTimeName =
|
|
||||||
obr_.time().timeName(obr_.time().startTime().value());
|
|
||||||
|
|
||||||
forAll(names_, i)
|
|
||||||
{
|
|
||||||
if (!filePtrs_.set(i))
|
|
||||||
{
|
|
||||||
fileName outputDir(baseFileDir()/prefix_/startTimeName);
|
|
||||||
mkDir(outputDir);
|
|
||||||
|
|
||||||
word fName(names_[i]);
|
|
||||||
|
|
||||||
// Check if file already exists
|
|
||||||
IFstream is(outputDir/(fName + ".dat"));
|
|
||||||
if (is.good())
|
|
||||||
{
|
|
||||||
fName = fName + "_" + obr_.time().timeName();
|
|
||||||
}
|
|
||||||
|
|
||||||
filePtrs_.set(i, new OFstream(outputDir/(fName + ".dat")));
|
|
||||||
|
|
||||||
initStream(filePtrs_[i]);
|
|
||||||
|
|
||||||
writeFileHeader(i);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFile::writeFileHeader(const label i)
|
void Foam::functionObjectFile::writeFileHeader(const label i)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFile::write()
|
|
||||||
{
|
|
||||||
createFiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFile::resetNames(const wordList& names)
|
|
||||||
{
|
|
||||||
names_.clear();
|
|
||||||
names_.append(names);
|
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
filePtrs_.clear();
|
|
||||||
filePtrs_.setSize(names_.size());
|
|
||||||
|
|
||||||
createFiles();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFile::resetName(const word& name)
|
|
||||||
{
|
|
||||||
names_.clear();
|
|
||||||
names_.append(name);
|
|
||||||
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
filePtrs_.clear();
|
|
||||||
filePtrs_.setSize(1);
|
|
||||||
|
|
||||||
createFiles();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::Omanip<int> Foam::functionObjectFile::valueWidth(const label offset) const
|
Foam::Omanip<int> Foam::functionObjectFile::valueWidth(const label offset) const
|
||||||
{
|
{
|
||||||
return setw(IOstream::defaultPrecision() + addChars + offset);
|
return setw(IOstream::defaultPrecision() + addChars + offset);
|
||||||
@ -168,60 +97,10 @@ Foam::functionObjectFile::functionObjectFile
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
prefix_(prefix),
|
prefix_(prefix)
|
||||||
names_(),
|
|
||||||
filePtrs_()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::functionObjectFile::functionObjectFile
|
|
||||||
(
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const word& prefix,
|
|
||||||
const word& name
|
|
||||||
)
|
|
||||||
:
|
|
||||||
obr_(obr),
|
|
||||||
prefix_(prefix),
|
|
||||||
names_(),
|
|
||||||
filePtrs_()
|
|
||||||
{
|
|
||||||
names_.clear();
|
|
||||||
names_.append(name);
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
filePtrs_.clear();
|
|
||||||
filePtrs_.setSize(1);
|
|
||||||
|
|
||||||
// Cannot create files - need to access virtual function
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::functionObjectFile::functionObjectFile
|
|
||||||
(
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const word& prefix,
|
|
||||||
const wordList& names
|
|
||||||
)
|
|
||||||
:
|
|
||||||
obr_(obr),
|
|
||||||
prefix_(prefix),
|
|
||||||
names_(names),
|
|
||||||
filePtrs_()
|
|
||||||
{
|
|
||||||
names_.clear();
|
|
||||||
names_.append(names);
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
filePtrs_.clear();
|
|
||||||
filePtrs_.setSize(names_.size());
|
|
||||||
|
|
||||||
// Cannot create files - need to access virtual function
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjectFile::~functionObjectFile()
|
Foam::functionObjectFile::~functionObjectFile()
|
||||||
@ -230,72 +109,6 @@ Foam::functionObjectFile::~functionObjectFile()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::wordList& Foam::functionObjectFile::names() const
|
|
||||||
{
|
|
||||||
return names_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::OFstream& Foam::functionObjectFile::file()
|
|
||||||
{
|
|
||||||
if (!Pstream::master())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Request for file() can only be done by the master process"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filePtrs_.size() != 1)
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Requested single file, but multiple files are present"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!filePtrs_.set(0))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "File pointer at index " << 0 << " not allocated"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return filePtrs_[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::PtrList<Foam::OFstream>& Foam::functionObjectFile::files()
|
|
||||||
{
|
|
||||||
if (!Pstream::master())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Request for files() can only be done by the master process"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return filePtrs_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::OFstream& Foam::functionObjectFile::file(const label i)
|
|
||||||
{
|
|
||||||
if (!Pstream::master())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Request for file(i) can only be done by the master process"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!filePtrs_.set(i))
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "File pointer at index " << i << " not allocated"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return filePtrs_[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::label Foam::functionObjectFile::charWidth() const
|
Foam::label Foam::functionObjectFile::charWidth() const
|
||||||
{
|
{
|
||||||
return IOstream::defaultPrecision() + addChars;
|
return IOstream::defaultPrecision() + addChars;
|
||||||
|
|||||||
@ -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-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -40,9 +40,6 @@ SourceFiles
|
|||||||
#define functionObjectFile_H
|
#define functionObjectFile_H
|
||||||
|
|
||||||
#include "objectRegistry.H"
|
#include "objectRegistry.H"
|
||||||
#include "OFstream.H"
|
|
||||||
#include "PtrList.H"
|
|
||||||
#include "HashSet.H"
|
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -57,22 +54,17 @@ namespace Foam
|
|||||||
|
|
||||||
class functionObjectFile
|
class functionObjectFile
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Reference to the database
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Reference to the objectRegistry
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- Prefix
|
//- Prefix
|
||||||
const word prefix_;
|
const word prefix_;
|
||||||
|
|
||||||
//- File names
|
|
||||||
wordList names_;
|
|
||||||
|
|
||||||
//- File pointer
|
|
||||||
PtrList<OFstream> filePtrs_;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
@ -85,21 +77,9 @@ protected:
|
|||||||
//- Return the base directory for the current time value
|
//- Return the base directory for the current time value
|
||||||
virtual fileName baseTimeDir() const;
|
virtual fileName baseTimeDir() const;
|
||||||
|
|
||||||
//- Create the output file
|
|
||||||
virtual void createFiles();
|
|
||||||
|
|
||||||
//- File header information
|
//- File header information
|
||||||
virtual void writeFileHeader(const label i = 0);
|
virtual void writeFileHeader(const label i = 0);
|
||||||
|
|
||||||
//- Write function
|
|
||||||
virtual void write();
|
|
||||||
|
|
||||||
//- Reset the list of names from a wordList
|
|
||||||
virtual void resetNames(const wordList& names);
|
|
||||||
|
|
||||||
//- Reset the list of names to a single name entry
|
|
||||||
virtual void resetName(const word& name);
|
|
||||||
|
|
||||||
//- Return the value width when writing to stream with optional offset
|
//- Return the value width when writing to stream with optional offset
|
||||||
virtual Omanip<int> valueWidth(const label offset = 0) const;
|
virtual Omanip<int> valueWidth(const label offset = 0) const;
|
||||||
|
|
||||||
@ -121,25 +101,9 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct from objectRegistry
|
||||||
functionObjectFile(const objectRegistry& obr, const word& prefix);
|
functionObjectFile(const objectRegistry& obr, const word& prefix);
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
functionObjectFile
|
|
||||||
(
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const word& prefix,
|
|
||||||
const word& name
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
functionObjectFile
|
|
||||||
(
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const word& prefix,
|
|
||||||
const wordList& names
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~functionObjectFile();
|
virtual ~functionObjectFile();
|
||||||
@ -147,18 +111,6 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return const access to the names
|
|
||||||
const wordList& names() const;
|
|
||||||
|
|
||||||
//- Return access to the file (if only 1)
|
|
||||||
OFstream& file();
|
|
||||||
|
|
||||||
//- Return access to the files
|
|
||||||
PtrList<OFstream>& files();
|
|
||||||
|
|
||||||
//- Return file 'i'
|
|
||||||
OFstream& file(const label i);
|
|
||||||
|
|
||||||
//- Write a commented string to stream
|
//- Write a commented string to stream
|
||||||
void writeCommented
|
void writeCommented
|
||||||
(
|
(
|
||||||
|
|||||||
@ -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 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,8 +23,6 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "OStringStream.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -0,0 +1,237 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "functionObjectFiles.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::functionObjectFiles::createFiles()
|
||||||
|
{
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
const word startTimeName =
|
||||||
|
obr_.time().timeName(obr_.time().startTime().value());
|
||||||
|
|
||||||
|
forAll(names_, i)
|
||||||
|
{
|
||||||
|
if (!filePtrs_.set(i))
|
||||||
|
{
|
||||||
|
fileName outputDir(baseFileDir()/prefix_/startTimeName);
|
||||||
|
mkDir(outputDir);
|
||||||
|
|
||||||
|
word fName(names_[i]);
|
||||||
|
|
||||||
|
// Check if file already exists
|
||||||
|
IFstream is(outputDir/(fName + ".dat"));
|
||||||
|
if (is.good())
|
||||||
|
{
|
||||||
|
fName = fName + "_" + obr_.time().timeName();
|
||||||
|
}
|
||||||
|
|
||||||
|
filePtrs_.set(i, new OFstream(outputDir/(fName + ".dat")));
|
||||||
|
|
||||||
|
initStream(filePtrs_[i]);
|
||||||
|
|
||||||
|
writeFileHeader(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjectFiles::write()
|
||||||
|
{
|
||||||
|
createFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjectFiles::resetNames(const wordList& names)
|
||||||
|
{
|
||||||
|
names_.clear();
|
||||||
|
names_.append(names);
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
filePtrs_.clear();
|
||||||
|
filePtrs_.setSize(names_.size());
|
||||||
|
|
||||||
|
createFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjectFiles::resetName(const word& name)
|
||||||
|
{
|
||||||
|
names_.clear();
|
||||||
|
names_.append(name);
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
filePtrs_.clear();
|
||||||
|
filePtrs_.setSize(1);
|
||||||
|
|
||||||
|
createFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjectFiles::functionObjectFiles
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const word& prefix
|
||||||
|
)
|
||||||
|
:
|
||||||
|
functionObjectFile(obr, prefix),
|
||||||
|
names_(),
|
||||||
|
filePtrs_()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::functionObjectFiles::functionObjectFiles
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const word& prefix,
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
:
|
||||||
|
functionObjectFile(obr, prefix),
|
||||||
|
names_(),
|
||||||
|
filePtrs_()
|
||||||
|
{
|
||||||
|
names_.clear();
|
||||||
|
names_.append(name);
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
filePtrs_.clear();
|
||||||
|
filePtrs_.setSize(1);
|
||||||
|
|
||||||
|
// Cannot create files - need to access virtual function
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::functionObjectFiles::functionObjectFiles
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const word& prefix,
|
||||||
|
const wordList& names
|
||||||
|
)
|
||||||
|
:
|
||||||
|
functionObjectFile(obr, prefix),
|
||||||
|
names_(names),
|
||||||
|
filePtrs_()
|
||||||
|
{
|
||||||
|
names_.clear();
|
||||||
|
names_.append(names);
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
filePtrs_.clear();
|
||||||
|
filePtrs_.setSize(names_.size());
|
||||||
|
|
||||||
|
// Cannot create files - need to access virtual function
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjectFiles::~functionObjectFiles()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::wordList& Foam::functionObjectFiles::names() const
|
||||||
|
{
|
||||||
|
return names_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::OFstream& Foam::functionObjectFiles::file()
|
||||||
|
{
|
||||||
|
if (!Pstream::master())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Request for file() can only be done by the master process"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filePtrs_.size() != 1)
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Requested single file, but multiple files are present"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!filePtrs_.set(0))
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "File pointer at index " << 0 << " not allocated"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return filePtrs_[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::PtrList<Foam::OFstream>& Foam::functionObjectFiles::files()
|
||||||
|
{
|
||||||
|
if (!Pstream::master())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Request for files() can only be done by the master process"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return filePtrs_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::OFstream& Foam::functionObjectFiles::file(const label i)
|
||||||
|
{
|
||||||
|
if (!Pstream::master())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Request for file(i) can only be done by the master process"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!filePtrs_.set(i))
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "File pointer at index " << i << " not allocated"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return filePtrs_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,144 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::functionObjectFiles
|
||||||
|
|
||||||
|
Description
|
||||||
|
Base class for output file data handling
|
||||||
|
|
||||||
|
See Also
|
||||||
|
Foam::functionObject
|
||||||
|
Foam::OutputFilterFunctionObject
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
functionObjectFiles.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef functionObjectFiles_H
|
||||||
|
#define functionObjectFiles_H
|
||||||
|
|
||||||
|
#include "functionObjectFile.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "PtrList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class functionObjectFiles Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class functionObjectFiles
|
||||||
|
:
|
||||||
|
public functionObjectFile
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- File names
|
||||||
|
wordList names_;
|
||||||
|
|
||||||
|
//- File pointer
|
||||||
|
PtrList<OFstream> filePtrs_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Create the output file
|
||||||
|
virtual void createFiles();
|
||||||
|
|
||||||
|
//- Write function
|
||||||
|
virtual void write();
|
||||||
|
|
||||||
|
//- Reset the list of names from a wordList
|
||||||
|
virtual void resetNames(const wordList& names);
|
||||||
|
|
||||||
|
//- Reset the list of names to a single name entry
|
||||||
|
virtual void resetName(const word& name);
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
functionObjectFiles(const functionObjectFiles&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const functionObjectFiles&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from objectRegistry
|
||||||
|
functionObjectFiles(const objectRegistry& obr, const word& prefix);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
functionObjectFiles
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const word& prefix,
|
||||||
|
const word& name
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
functionObjectFiles
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const word& prefix,
|
||||||
|
const wordList& names
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~functionObjectFiles();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return const access to the names
|
||||||
|
const wordList& names() const;
|
||||||
|
|
||||||
|
//- Return access to the file (if only 1)
|
||||||
|
OFstream& file();
|
||||||
|
|
||||||
|
//- Return access to the files
|
||||||
|
PtrList<OFstream>& files();
|
||||||
|
|
||||||
|
//- Return file 'i'
|
||||||
|
OFstream& file(const label i);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -57,7 +57,7 @@ Foam::cloudInfo::cloudInfo
|
|||||||
const bool loadFromFiles
|
const bool loadFromFiles
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name),
|
functionObjectFiles(obr, name),
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true)
|
active_(true)
|
||||||
@ -78,7 +78,7 @@ void Foam::cloudInfo::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
functionObjectFile::resetNames(dict.lookup("clouds"));
|
functionObjectFiles::resetNames(dict.lookup("clouds"));
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ": ";
|
Info<< type() << " " << name_ << ": ";
|
||||||
if (names().size())
|
if (names().size())
|
||||||
@ -114,7 +114,7 @@ void Foam::cloudInfo::write()
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFiles::write();
|
||||||
|
|
||||||
forAll(names(), i)
|
forAll(names(), i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -72,7 +72,7 @@ SourceFiles
|
|||||||
#ifndef cloudInfo_H
|
#ifndef cloudInfo_H
|
||||||
#define cloudInfo_H
|
#define cloudInfo_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFiles.H"
|
||||||
#include "PtrList.H"
|
#include "PtrList.H"
|
||||||
#include "pointFieldFwd.H"
|
#include "pointFieldFwd.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
@ -94,7 +94,7 @@ class mapPolyMesh;
|
|||||||
|
|
||||||
class cloudInfo
|
class cloudInfo
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public functionObjectFiles
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
@ -59,7 +59,7 @@ Foam::fieldMinMax::fieldMinMax
|
|||||||
const bool loadFromFiles
|
const bool loadFromFiles
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name, typeName),
|
functionObjectFiles(obr, name, typeName),
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
active_(true),
|
||||||
@ -164,7 +164,7 @@ void Foam::fieldMinMax::write()
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFiles::write();
|
||||||
|
|
||||||
if (!location_) writeTime(file());
|
if (!location_) writeTime(file());
|
||||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||||
|
|||||||
@ -78,7 +78,7 @@ SourceFiles
|
|||||||
#ifndef fieldMinMax_H
|
#ifndef fieldMinMax_H
|
||||||
#define fieldMinMax_H
|
#define fieldMinMax_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFiles.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ class mapPolyMesh;
|
|||||||
|
|
||||||
class fieldMinMax
|
class fieldMinMax
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public functionObjectFiles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
@ -56,7 +56,7 @@ void Foam::fieldValue::write()
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFiles::write();
|
||||||
|
|
||||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ Foam::fieldValue::fieldValue
|
|||||||
const bool loadFromFiles
|
const bool loadFromFiles
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name, valueType),
|
functionObjectFiles(obr, name, valueType),
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
|
|||||||
@ -38,7 +38,7 @@ SourceFiles
|
|||||||
#ifndef fieldValue_H
|
#ifndef fieldValue_H
|
||||||
#define fieldValue_H
|
#define fieldValue_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFiles.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
@ -62,7 +62,7 @@ class mapPolyMesh;
|
|||||||
|
|
||||||
class fieldValue
|
class fieldValue
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public functionObjectFiles
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -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-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -64,7 +64,7 @@ Foam::fieldValues::fieldValueDelta::fieldValueDelta
|
|||||||
const bool loadFromFiles
|
const bool loadFromFiles
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name, typeName),
|
functionObjectFiles(obr, name, typeName),
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
loadFromFiles_(loadFromFiles),
|
loadFromFiles_(loadFromFiles),
|
||||||
@ -148,7 +148,7 @@ void Foam::fieldValues::fieldValueDelta::read(const dictionary& dict)
|
|||||||
|
|
||||||
void Foam::fieldValues::fieldValueDelta::write()
|
void Foam::fieldValues::fieldValueDelta::write()
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFiles::write();
|
||||||
|
|
||||||
source1Ptr_->write();
|
source1Ptr_->write();
|
||||||
source2Ptr_->write();
|
source2Ptr_->write();
|
||||||
|
|||||||
@ -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-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -76,7 +76,7 @@ SourceFiles
|
|||||||
#ifndef fieldValueDelta_H
|
#ifndef fieldValueDelta_H
|
||||||
#define fieldValueDelta_H
|
#define fieldValueDelta_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFiles.H"
|
||||||
#include "fieldValue.H"
|
#include "fieldValue.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ namespace fieldValues
|
|||||||
|
|
||||||
class fieldValueDelta
|
class fieldValueDelta
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public functionObjectFiles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//- Operation type enumeration
|
//- Operation type enumeration
|
||||||
|
|||||||
@ -74,9 +74,8 @@ Foam::functionObjects::histogram::histogram
|
|||||||
const bool loadFromFiles
|
const bool loadFromFiles
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name, typeName),
|
functionObjectFile(obr, typeName),
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
|
||||||
active_(true)
|
active_(true)
|
||||||
{
|
{
|
||||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
// 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 * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::histogram::~histogram()
|
Foam::functionObjects::histogram::~histogram()
|
||||||
@ -108,8 +127,7 @@ void Foam::functionObjects::histogram::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
dict.lookup("field") >> fieldName_;
|
dict.lookup("field") >> fieldName_;
|
||||||
dict.lookup("max") >> max_;
|
dict.lookup("max") >> max_;
|
||||||
min_ = 0.0;
|
min_ = dict.lookupOrDefault<scalar>("min", 0);
|
||||||
dict.readIfPresent("min", min_);
|
|
||||||
dict.lookup("nBins") >> nBins_;
|
dict.lookup("nBins") >> nBins_;
|
||||||
|
|
||||||
word format(dict.lookup("setFormat"));
|
word format(dict.lookup("setFormat"));
|
||||||
|
|||||||
@ -30,7 +30,7 @@ Group
|
|||||||
Description
|
Description
|
||||||
Write the volume-weighted histogram of a volScalarField.
|
Write the volume-weighted histogram of a volScalarField.
|
||||||
|
|
||||||
Example of function object specification:
|
Example:
|
||||||
\verbatim
|
\verbatim
|
||||||
histogram1
|
histogram1
|
||||||
{
|
{
|
||||||
@ -69,9 +69,9 @@ SourceFiles
|
|||||||
#ifndef functionObjects_histogram_H
|
#ifndef functionObjects_histogram_H
|
||||||
#define functionObjects_histogram_H
|
#define functionObjects_histogram_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
|
||||||
#include "writer.H"
|
#include "writer.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
|
#include "functionObjectFile.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -79,6 +79,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
|
class objectRegistry;
|
||||||
class mapPolyMesh;
|
class mapPolyMesh;
|
||||||
class polyMesh;
|
class polyMesh;
|
||||||
|
|
||||||
@ -95,11 +96,9 @@ class histogram
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of this set of histogram objects
|
//- Name of this histogram
|
||||||
word name_;
|
word name_;
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- on/off switch
|
//- on/off switch
|
||||||
bool active_;
|
bool active_;
|
||||||
|
|
||||||
@ -153,6 +152,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<histogram> New
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry&,
|
||||||
|
const dictionary&,
|
||||||
|
const bool loadFromFiles = false
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
|
||||||
|
|||||||
@ -322,7 +322,7 @@ Foam::regionSizeDistribution::regionSizeDistribution
|
|||||||
const bool loadFromFiles
|
const bool loadFromFiles
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name, typeName),
|
functionObjectFiles(obr, name, typeName),
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
active_(true),
|
||||||
|
|||||||
@ -106,7 +106,7 @@ SourceFiles
|
|||||||
#ifndef regionSizeDistribution_H
|
#ifndef regionSizeDistribution_H
|
||||||
#define regionSizeDistribution_H
|
#define regionSizeDistribution_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFiles.H"
|
||||||
#include "pointFieldFwd.H"
|
#include "pointFieldFwd.H"
|
||||||
#include "writer.H"
|
#include "writer.H"
|
||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
@ -132,7 +132,7 @@ class polyMesh;
|
|||||||
|
|
||||||
class regionSizeDistribution
|
class regionSizeDistribution
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public functionObjectFiles
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
|||||||
@ -199,7 +199,7 @@ void Foam::forceCoeffs::write()
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFiles::write();
|
||||||
|
|
||||||
scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;
|
scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;
|
||||||
|
|
||||||
|
|||||||
@ -524,7 +524,7 @@ Foam::forces::forces
|
|||||||
const bool readFields
|
const bool readFields
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name, createFileNames(dict)),
|
functionObjectFiles(obr, name, createFileNames(dict)),
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
active_(true),
|
||||||
@ -583,7 +583,7 @@ Foam::forces::forces
|
|||||||
const coordinateSystem& coordSys
|
const coordinateSystem& coordSys
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name, typeName),
|
functionObjectFiles(obr, name, typeName),
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
active_(true),
|
||||||
@ -787,7 +787,7 @@ void Foam::forces::write()
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFiles::write();
|
||||||
|
|
||||||
writeForces();
|
writeForces();
|
||||||
|
|
||||||
|
|||||||
@ -113,7 +113,7 @@ SourceFiles
|
|||||||
#ifndef forces_H
|
#ifndef forces_H
|
||||||
#define forces_H
|
#define forces_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFiles.H"
|
||||||
#include "coordinateSystem.H"
|
#include "coordinateSystem.H"
|
||||||
#include "coordinateSystems.H"
|
#include "coordinateSystems.H"
|
||||||
#include "primitiveFieldsFwd.H"
|
#include "primitiveFieldsFwd.H"
|
||||||
@ -141,7 +141,7 @@ class mapPolyMesh;
|
|||||||
|
|
||||||
class forces
|
class forces
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public functionObjectFiles
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@ -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) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -46,7 +46,7 @@ Foam::residuals::residuals
|
|||||||
const bool loadFromFiles
|
const bool loadFromFiles
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name, typeName),
|
functionObjectFiles(obr, name, typeName),
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
active_(true),
|
||||||
@ -121,7 +121,7 @@ void Foam::residuals::write()
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFiles::write();
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -62,7 +62,7 @@ SourceFiles
|
|||||||
#ifndef residuals_H
|
#ifndef residuals_H
|
||||||
#define residuals_H
|
#define residuals_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFiles.H"
|
||||||
#include "primitiveFieldsFwd.H"
|
#include "primitiveFieldsFwd.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
@ -88,7 +88,7 @@ class mapPolyMesh;
|
|||||||
|
|
||||||
class residuals
|
class residuals
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public functionObjectFiles
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,7 @@ Foam::wallShearStress::wallShearStress
|
|||||||
const bool loadFromFiles
|
const bool loadFromFiles
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name, typeName),
|
functionObjectFiles(obr, name, typeName),
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
active_(true),
|
||||||
@ -220,7 +220,7 @@ void Foam::wallShearStress::execute()
|
|||||||
|
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFiles::write();
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ void Foam::wallShearStress::write()
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFiles::write();
|
||||||
|
|
||||||
const volVectorField& wallShearStress =
|
const volVectorField& wallShearStress =
|
||||||
obr_.lookupObject<volVectorField>(type());
|
obr_.lookupObject<volVectorField>(type());
|
||||||
|
|||||||
@ -73,10 +73,10 @@ SourceFiles
|
|||||||
#ifndef wallShearStress_H
|
#ifndef wallShearStress_H
|
||||||
#define wallShearStress_H
|
#define wallShearStress_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFiles.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
#include "OFstream.H"
|
#include "HashSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ class fvMesh;
|
|||||||
|
|
||||||
class wallShearStress
|
class wallShearStress
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public functionObjectFiles
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@ -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-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -61,7 +61,7 @@ Foam::yPlus::yPlus
|
|||||||
const bool loadFromFiles
|
const bool loadFromFiles
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name, typeName),
|
functionObjectFiles(obr, name, typeName),
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
active_(true),
|
||||||
@ -128,7 +128,7 @@ void Foam::yPlus::execute()
|
|||||||
|
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFiles::write();
|
||||||
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ void Foam::yPlus::write()
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFiles::write();
|
||||||
|
|
||||||
const volScalarField& yPlus =
|
const volScalarField& yPlus =
|
||||||
obr_.lookupObject<volScalarField>(type());
|
obr_.lookupObject<volScalarField>(type());
|
||||||
|
|||||||
@ -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-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -40,7 +40,7 @@ SourceFiles
|
|||||||
#ifndef yPlus_H
|
#ifndef yPlus_H
|
||||||
#define yPlus_H
|
#define yPlus_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFiles.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
@ -63,7 +63,7 @@ class fvMesh;
|
|||||||
|
|
||||||
class yPlus
|
class yPlus
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public functionObjectFiles
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ Foam::moleFractions<ThermoType>::moleFractions
|
|||||||
const bool loadFromFiles
|
const bool loadFromFiles
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name),
|
functionObjectFiles(obr, name),
|
||||||
name_(name),
|
name_(name),
|
||||||
mesh_(refCast<const fvMesh>(obr))
|
mesh_(refCast<const fvMesh>(obr))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -60,7 +60,7 @@ SourceFiles
|
|||||||
#ifndef moleFractions_H
|
#ifndef moleFractions_H
|
||||||
#define moleFractions_H
|
#define moleFractions_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFiles.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -75,7 +75,7 @@ namespace Foam
|
|||||||
template<class ThermoType>
|
template<class ThermoType>
|
||||||
class moleFractions
|
class moleFractions
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public functionObjectFiles
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user