pFlowToVTK finalized and tested

- geometry conversion now can handle separate vtk files.
This commit is contained in:
Hamidreza Norouzi
2024-03-30 08:35:16 -07:00
parent 815b134e1e
commit ef0e752929
13 changed files with 460 additions and 382 deletions

View File

@ -33,7 +33,6 @@ bool pFlow::fileSystem::checkFileName(const word& name)
"Invalid file name supplied " << name <<
"the following characters are not allowd: " <<
notPermittedCharsFile << endl;
fatalExit;
return false;
}
@ -57,9 +56,9 @@ pFlow::fileSystem::fileSystem( const word& dir, const word& file)
{
isDir_ = file.empty();
if( !isDir_)
if( !isDir_ && !checkFileName(file))
{
checkFileName(file);
fatalExit;
}
try
@ -240,7 +239,10 @@ pFlow::fileSystem pFlow::fileSystem::operator()
void pFlow::fileSystem::operator += (const word& fileName)
{
checkFileName(fileName);
if(!checkFileName(fileName))
{
fatalExit;
}
if( isDir())
{

View File

@ -70,13 +70,30 @@ void pFlow::fileStream::openOutFile
if(binary_)
{
outStream_ = makeUnique< std::ofstream>(
if(append_)
{
outStream_ = makeUnique< std::ofstream>(
path.wordPath(), std::ios_base::out| std::ios::binary|std::ios::app);
}
else
{
outStream_ = makeUnique< std::ofstream>(
path.wordPath(), std::ios_base::out| std::ios::binary);
}
}
else
outStream_ = makeUnique< std::ofstream>(
{
if(append_)
{
outStream_ = makeUnique< std::ofstream>(
path.wordPath(), std::ios_base::out|std::ios::app);
}
else
{
outStream_ = makeUnique< std::ofstream>(
path.wordPath(), std::ios_base::out);
}
}
if(!outStream_->is_open())
{
@ -103,12 +120,14 @@ pFlow::fileStream::fileStream
(
const fileSystem& path,
bool outStream,
bool binary
bool binary,
bool append
)
:
inStream_(nullptr),
outStream_(nullptr),
binary_(binary)
binary_(binary),
append_(append)
{
if(outStream)

View File

@ -52,6 +52,8 @@ protected:
bool binary_ = false;
bool append_ = false;
/// open input file
void openInFile(const fileSystem& path);
@ -66,7 +68,7 @@ public:
//// - Constructors
/// From file path and input type and format.
fileStream( const fileSystem& path, bool outStream = false, bool binary = false);
fileStream( const fileSystem& path, bool outStream = false, bool binary = false, bool append = false);
/// No copy
fileStream(const fileStream&)= delete;

View File

@ -22,9 +22,9 @@ Licence:
#include "oFstream.hpp"
pFlow::oFstream::oFstream (const fileSystem& path, bool binary)
pFlow::oFstream::oFstream (const fileSystem& path, bool binary, bool append)
:
fileStream(path, true, binary),
fileStream(path, true, binary, append),
Ostream
(
fileStream::outStream(),

View File

@ -45,7 +45,7 @@ public:
//// - Constructors
/// From file path and format
oFstream (const fileSystem& path, bool binary = false);
oFstream (const fileSystem& path, bool binary = false, bool append = false);
/// No copy constructor
oFstream( const oFstream& src) = delete;