# PhasicFlow: src/phasicFlow/repository/IOobject/IOfileHeader.hpp Source File
PhasicFlow is an open-source parallel DEM (discrete element method) package for simulating granular flow. It is developed in C++ and can be exectued on both GPU (like CUDA) and CPU.

IOfileHeader.hpp
Go to the documentation of this file.
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __IOfileHeader_hpp__
#define __IOfileHeader_hpp__
#include "uniquePtr.hpp"
#include "objectFile.hpp"
#include "streams.hpp"
namespace pFlow
{
class repository;
class IOfileHeader
:
public objectFile
{
protected:
// object name read from file
word objectName_;
// object type read from file
word objectType_;
word fileFormat_ = "ASCII";
// - input file stream
uniquePtr<iFstream> inStream()const;
// - ouput file stream
uniquePtr<oFstream> outStream()const;
uniquePtr<oFstream> dummyOutStream()const;
public:
// with owner
IOfileHeader(const objectFile& objf);
// - object name
const word& objectName()const
{
return objectName_;
}
// - object type
const word& objectType()const
{
return objectType_;
}
// - pointer to owner repository
virtual
const repository* owner()const
{
return nullptr;
}
virtual
bool isIncluded(const word& objName)const
{
return false;
}
virtual
bool isExcluded(const word& objName)const
{
return false;
}
// - path to file name
fileSystem path() const;
bool outFileBinary()const;
bool inFileBinary()const;
// - should be used for read operations
// check if the file exist,
// read the header of the file to check if it is ok
bool headerOk(bool silent = false);
bool implyRead() const;
bool implyWrite() const;
bool fileExist() const;
bool readIfPresent()const;
bool writeHeader()const;
bool writeHeader(iOstream& os, const word& typeName, bool forceWrite = false ) const;
bool writeHeader(iOstream& os, bool forceWrite = false) const;
bool readHeader()const;
bool readHeader(iIstream& is, bool silent=false);
bool writeBanner(iOstream& os)const;
bool writeSeparator(iOstream& os)const;
};
}
#endif //__objectFile_hpp__
pFlow::IOfileHeader::isExcluded
virtual bool isExcluded(const word &objName) const
Definition: IOfileHeader.hpp:94
pFlow::IOfileHeader::objectType
const word & objectType() const
Definition: IOfileHeader.hpp:75
pFlow::IOfileHeader::readIfPresent
bool readIfPresent() const
Check read if present.
Definition: IOfileHeader.cpp:139
pFlow::IOfileHeader::outFileBinary
bool outFileBinary() const
Definition: IOfileHeader.cpp:79
pFlow::IOfileHeader::objectType_
word objectType_
Definition: IOfileHeader.hpp:48
pFlow::IOfileHeader::fileExist
bool fileExist() const
Check if file exists.
Definition: IOfileHeader.cpp:134
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::IOfileHeader::writeHeader
bool writeHeader() const
Check if the header should be written to file True: on master + implyWrite + readWriteHeader = true F...
Definition: IOfileHeader.cpp:144
pFlow
Definition: demGeometry.hpp:27
pFlow::fileSystem
Manages file pathes, manupulate and combines them.
Definition: fileSystem.hpp:71
uniquePtr.hpp
pFlow::IOfileHeader::outStream
uniquePtr< oFstream > outStream() const
Definition: IOfileHeader.cpp:32
pFlow::iIstream
Interface class for any input stream
Definition: iIstream.hpp:37
pFlow::IOfileHeader::path
fileSystem path() const
Definition: IOfileHeader.cpp:63
pFlow::IOfileHeader::fileFormat_
word fileFormat_
file format read from file
Definition: IOfileHeader.hpp:51
pFlow::IOfileHeader::objectName_
word objectName_
Definition: IOfileHeader.hpp:45
pFlow::objectFile
Definition: objectFile.hpp:30
objectFile.hpp
streams.hpp
pFlow::IOfileHeader::inStream
uniquePtr< iFstream > inStream() const
Definition: IOfileHeader.cpp:24
pFlow::IOfileHeader::implyRead
bool implyRead() const
Imply read.
Definition: IOfileHeader.cpp:121
pFlow::IOfileHeader
Definition: IOfileHeader.hpp:35
pFlow::IOfileHeader::writeSeparator
bool writeSeparator(iOstream &os) const
wirte a separator line
Definition: IOfileHeader.cpp:249
pFlow::IOfileHeader::headerOk
bool headerOk(bool silent=false)
Definition: IOfileHeader.cpp:92
pFlow::uniquePtr
Definition: uniquePtr.hpp:42
pFlow::IOfileHeader::readHeader
bool readHeader() const
Check if header should be read from file.
Definition: IOfileHeader.cpp:189
pFlow::IOfileHeader::objectName
const word & objectName() const
Definition: IOfileHeader.hpp:69
pFlow::IOfileHeader::IOfileHeader
IOfileHeader(const objectFile &objf)
Definition: IOfileHeader.cpp:58
pFlow::IOfileHeader::inFileBinary
bool inFileBinary() const
Definition: IOfileHeader.cpp:87
pFlow::repository
Definition: repository.hpp:34
pFlow::IOfileHeader::dummyOutStream
uniquePtr< oFstream > dummyOutStream() const
Definition: IOfileHeader.cpp:45
pFlow::IOfileHeader::implyWrite
bool implyWrite() const
Imply write.
Definition: IOfileHeader.cpp:127
pFlow::IOfileHeader::isIncluded
virtual bool isIncluded(const word &objName) const
Definition: IOfileHeader.hpp:88
pFlow::iOstream
Interface class for any output stream.
Definition: iOstream.hpp:59
pFlow::IOfileHeader::owner
virtual const repository * owner() const
Definition: IOfileHeader.hpp:82
pFlow::IOfileHeader::writeBanner
bool writeBanner(iOstream &os) const
write the banner
Definition: IOfileHeader.cpp:238