mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
functionObjectFile: Separated into functionObjectFile and functionObjectFiles
functionObjectFile provides basic directory, file and formatting functions functionObjectFiles provides multi-file cache
This commit is contained in:
@ -90,8 +90,8 @@ class OutputFilterFunctionObject
|
||||
//- De-activation time - defaults to VGREAT
|
||||
scalar timeEnd_;
|
||||
|
||||
//- Number of steps before the dumping time in which the deltaT
|
||||
// will start to change (valid for ocAdjustableTime)
|
||||
//- Number of steps before the dump-time during which deltaT
|
||||
// may be changed (valid for adjustableRunTime)
|
||||
label nStepsToStartTimeChange_;
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
@ -32,8 +32,8 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineDebugSwitchWithName(functionObject, "functionObject", 0);
|
||||
defineRunTimeSelectionTable(functionObject, dictionary);
|
||||
defineDebugSwitchWithName(functionObject, "functionObject", 0);
|
||||
defineRunTimeSelectionTable(functionObject, dictionary);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -105,26 +105,6 @@ public:
|
||||
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
|
||||
|
||||
|
||||
@ -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
|
||||
@ -26,7 +26,7 @@ License
|
||||
#include "functionObjectFile.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "IFstream.H"
|
||||
#include "IOmanip.H"
|
||||
|
||||
// * * * * * * * * * * * * * * 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::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
|
||||
{
|
||||
return setw(IOstream::defaultPrecision() + addChars + offset);
|
||||
@ -168,60 +97,10 @@ Foam::functionObjectFile::functionObjectFile
|
||||
)
|
||||
:
|
||||
obr_(obr),
|
||||
prefix_(prefix),
|
||||
names_(),
|
||||
filePtrs_()
|
||||
prefix_(prefix)
|
||||
{}
|
||||
|
||||
|
||||
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 * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjectFile::~functionObjectFile()
|
||||
@ -230,72 +109,6 @@ Foam::functionObjectFile::~functionObjectFile()
|
||||
|
||||
// * * * * * * * * * * * * * * * 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
|
||||
{
|
||||
return IOstream::defaultPrecision() + addChars;
|
||||
|
||||
@ -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
|
||||
@ -40,9 +40,6 @@ SourceFiles
|
||||
#define functionObjectFile_H
|
||||
|
||||
#include "objectRegistry.H"
|
||||
#include "OFstream.H"
|
||||
#include "PtrList.H"
|
||||
#include "HashSet.H"
|
||||
#include "IOmanip.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -57,22 +54,17 @@ namespace Foam
|
||||
|
||||
class functionObjectFile
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to the database
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Prefix
|
||||
const word prefix_;
|
||||
|
||||
//- File names
|
||||
wordList names_;
|
||||
|
||||
//- File pointer
|
||||
PtrList<OFstream> filePtrs_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
@ -85,21 +77,9 @@ protected:
|
||||
//- Return the base directory for the current time value
|
||||
virtual fileName baseTimeDir() const;
|
||||
|
||||
//- Create the output file
|
||||
virtual void createFiles();
|
||||
|
||||
//- File header information
|
||||
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
|
||||
virtual Omanip<int> valueWidth(const label offset = 0) const;
|
||||
|
||||
@ -121,25 +101,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Construct from objectRegistry
|
||||
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
|
||||
virtual ~functionObjectFile();
|
||||
@ -147,18 +111,6 @@ public:
|
||||
|
||||
// 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
|
||||
void writeCommented
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,8 +23,6 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "OStringStream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
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
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user