# PhasicFlow: src/phasicFlow/repository/IOobject/objectFile.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.

objectFile.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 __objectFile_hpp__
#define __objectFile_hpp__
#include "types.hpp"
#include "fileSystem.hpp"
namespace pFlow
{
class objectFile
{
public:
enum readFlag
{
READ_ALWAYS,
READ_NEVER,
READ_IF_PRESENT
};
enum writeFlag
{
WRITE_ALWAYS,
WRITE_NEVER
};
private:
word name_;
readFlag rFlag_ = readFlag::READ_NEVER;
writeFlag wFlag_ = writeFlag::WRITE_NEVER;
fileSystem localPath_ = "";
int numBytesForReal_ = numBytesForReal__;
bool readWriteHeader_ = true;
public:
// constructors
explicit objectFile
(
const word& name
);
objectFile
(
const word& name,
const fileSystem& localPath,
const readFlag& rf = readFlag::READ_NEVER,
const writeFlag& wf = writeFlag::WRITE_NEVER,
bool rwHeader = true
);
// copy construct
objectFile( const objectFile & src) = default;
objectFile( objectFile&& src) = default;
objectFile& operator = (const objectFile & rhs) = default;
objectFile& operator = (objectFile && rhs) = default;
virtual ~objectFile()=default;
virtual
const word& name() const
{
return name_;
}
virtual
const fileSystem& localPath()const
{
return localPath_;
}
inline
readFlag rFlag()const
{
return rFlag_;
}
inline
writeFlag wFlag()const
{
return wFlag_;
}
inline
bool isReadAlways()const
{
return rFlag_ == readFlag::READ_ALWAYS;
}
inline
bool isReadNever()const
{
return rFlag_ == readFlag::READ_NEVER;
}
inline
bool isReadIfPresent()const
{
return rFlag_ == readFlag::READ_IF_PRESENT;
}
inline
bool isWriteAlways()const
{
return wFlag_ == writeFlag::WRITE_ALWAYS;
}
inline
bool isWriteNever()const
{
return wFlag_ == writeFlag::WRITE_NEVER;
}
inline
bool readWriteHeader()const
{
return readWriteHeader_;
}
};
}
#endif //__objectFile_hpp__
pFlow::objectFile::~objectFile
virtual ~objectFile()=default
pFlow::objectFile::objectFile
objectFile(const word &name)
Definition: objectFile.cpp:24
pFlow::numBytesForReal__
const int numBytesForReal__
Definition: builtinTypes.hpp:66
types.hpp
pFlow::objectFile::isReadNever
bool isReadNever() const
Definition: objectFile.hpp:131
pFlow::objectFile::isWriteNever
bool isWriteNever() const
Definition: objectFile.hpp:149
pFlow::objectFile::readFlag
readFlag
Definition: objectFile.hpp:34
pFlow::objectFile::isReadAlways
bool isReadAlways() const
Definition: objectFile.hpp:125
pFlow::word
std::string word
Definition: builtinTypes.hpp:64
pFlow::objectFile::localPath_
fileSystem localPath_
Local path of entity.
Definition: objectFile.hpp:60
pFlow::objectFile::WRITE_ALWAYS
@ WRITE_ALWAYS
Definition: objectFile.hpp:43
pFlow::objectFile::writeFlag
writeFlag
Definition: objectFile.hpp:41
fileSystem.hpp
pFlow
Definition: demGeometry.hpp:27
pFlow::objectFile::WRITE_NEVER
@ WRITE_NEVER
Definition: objectFile.hpp:44
pFlow::fileSystem
Manages file pathes, manupulate and combines them.
Definition: fileSystem.hpp:71
pFlow::objectFile::rFlag_
readFlag rFlag_
Read flag.
Definition: objectFile.hpp:54
pFlow::objectFile::operator=
objectFile & operator=(const objectFile &rhs)=default
pFlow::objectFile::name
virtual const word & name() const
Definition: objectFile.hpp:101
pFlow::objectFile::READ_ALWAYS
@ READ_ALWAYS
Definition: objectFile.hpp:36
pFlow::objectFile::readWriteHeader
bool readWriteHeader() const
Definition: objectFile.hpp:155
pFlow::objectFile
Definition: objectFile.hpp:30
pFlow::objectFile::readWriteHeader_
bool readWriteHeader_
Does the objectFile read & write the header?
Definition: objectFile.hpp:66
pFlow::objectFile::isWriteAlways
bool isWriteAlways() const
Definition: objectFile.hpp:143
pFlow::objectFile::READ_NEVER
@ READ_NEVER
Definition: objectFile.hpp:37
pFlow::objectFile::isReadIfPresent
bool isReadIfPresent() const
Definition: objectFile.hpp:137
pFlow::objectFile::numBytesForReal_
int numBytesForReal_
Number of bytes used for writing/reading real variable (used for binray)
Definition: objectFile.hpp:63
pFlow::objectFile::localPath
virtual const fileSystem & localPath() const
Definition: objectFile.hpp:107
pFlow::objectFile::READ_IF_PRESENT
@ READ_IF_PRESENT
Definition: objectFile.hpp:38
pFlow::objectFile::name_
word name_
Name of the entity.
Definition: objectFile.hpp:51
pFlow::objectFile::wFlag
writeFlag wFlag() const
Definition: objectFile.hpp:119
pFlow::objectFile::wFlag_
writeFlag wFlag_
Write flag.
Definition: objectFile.hpp:57
pFlow::objectFile::rFlag
readFlag rFlag() const
Definition: objectFile.hpp:113