GIT: Initial state after latest Foundation merge

This commit is contained in:
Andrew Heather
2016-09-20 14:49:08 +01:00
4571 changed files with 115696 additions and 74609 deletions

View File

@ -0,0 +1,143 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "logFiles.H"
#include "Time.H"
#include "IFstream.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::functionObjects::logFiles::createFiles()
{
if (Pstream::master())
{
const word startTimeName =
fileObr_.time().timeName(fileObr_.time().startTime().value());
forAll(names_, i)
{
if (!filePtrs_.set(i))
{
filePtrs_.set(i, createFile(names_[i]);
initStream(filePtrs_[i]);
}
}
}
}
void Foam::functionObjects::logFiles::resetNames(const wordList& names)
{
names_.clear();
names_.append(names);
if (Pstream::master())
{
filePtrs_.clear();
filePtrs_.setSize(names_.size());
}
}
void Foam::functionObjects::logFiles::resetName(const word& name)
{
names_.clear();
names_.append(name);
resetFile(name);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::logFiles::logFiles
(
const objectRegistry& obr,
const word& prefix
)
:
writeFile(obr, prefix),
names_(),
filePtrs_()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::logFiles::~logFiles()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::wordList& Foam::functionObjects::logFiles::names() const
{
return names_;
}
Foam::PtrList<Foam::OFstream>& Foam::functionObjects::logFiles::files()
{
if (!Pstream::master())
{
FatalErrorInFunction
<< "Request for files() can only be done by the master process"
<< abort(FatalError);
}
return filePtrs_;
}
Foam::OFstream& Foam::functionObjects::logFiles::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];
}
bool Foam::functionObjects::logFiles::write()
{
createFiles();
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,141 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::functionObjects::logFiles
Description
functionObject base class for creating, maintaining and writing log
files e.g. integrated or averaged field data vs time.
See also
Foam::functionObject
Foam::functionObjects::writeFile
SourceFiles
logFiles.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_logFiles_H
#define functionObjects_logFiles_H
#include "writeFile.H"
#include "OFstream.H"
#include "PtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class logFiles Declaration
\*---------------------------------------------------------------------------*/
class logFiles
:
public writeFile
{
protected:
// Protected data
//- File names
wordList names_;
//- File pointer
PtrList<OFstream> filePtrs_;
// Protected Member Functions
//- Create the output file
virtual void createFiles();
//- 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);
//- File header information
virtual void writeFileHeader(const label i = 0) = 0;
private:
// Private Member Functions
//- Disallow default bitwise copy construct
logFiles(const logFiles&);
//- Disallow default bitwise assignment
void operator=(const logFiles&);
public:
// Constructors
//- Construct from objectRegistry and prefix
logFiles
(
const objectRegistry& obr,
const word& prefix
);
//- Destructor
virtual ~logFiles();
// Member Functions
//- Return const access to the names
const wordList& names() const;
//- Return access to the files
PtrList<OFstream>& files();
//- Return file 'i'
OFstream& file(const label i);
//- Write function
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //