PhasicFlow
v0.1
www.cemf.ir
vtkFile.cpp
Go to the documentation of this file.
1
/*------------------------------- phasicFlow ---------------------------------
2
O C enter of
3
O O E ngineering and
4
O O M ultiscale modeling of
5
OOOOOOO F luid flow
6
------------------------------------------------------------------------------
7
Copyright (C): www.cemf.ir
8
email: hamid.r.norouzi AT gmail.com
9
------------------------------------------------------------------------------
10
Licence:
11
This file is part of phasicFlow code. It is a free software for simulating
12
granular and multiphase flows. You can redistribute it and/or modify it under
13
the terms of GNU General Public License v3 or any other later versions.
14
15
phasicFlow is distributed to help others in their research in the field of
16
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
19
-----------------------------------------------------------------------------*/
20
21
22
#include "
vtkFile.hpp
"
23
24
bool
pFlow::vtkFile::openStream
()
25
{
26
oStream_
= makeUnique<oFstream>(
fileName
() );
27
if
( !
oStream_
)
return
false
;
28
return
writeHeader
();
29
}
30
31
bool
pFlow::vtkFile::vtkFile::writeHeader()
32
{
33
34
if
(!oStream_)
return
false
;
35
36
oStream_() <<
"# vtk DataFile Version 2.0"
<<
endl
;
37
38
oStream_() <<
"vtk file for time : "
<< time_ <<
endl
;
39
40
oStream_() <<
"ASCII"
<<
endl
;
41
42
if
( oStream_().fail() )
return
false
;
43
44
return
true
;
45
46
}
47
48
pFlow::vtkFile::vtkFile
49
(
50
const
fileSystem
dir,
51
const
word
& bName,
52
real
time
53
)
54
:
55
dirPath_(dir),
56
baseName_(bName),
57
time_(time)
58
{
59
60
if
(!openStream())
61
{
62
fatalErrorInFunction
<<
63
" error in creating vtkFile "
<<fileName()<<
endl
;
64
fatalExit
;
65
}
66
67
}
68
69
70
pFlow::fileSystem
pFlow::vtkFile::fileName
()
const
71
{
72
word
fName = baseName_ +
"-"
+
int322Word
(10000*time_) +
".vtk"
;
73
return
dirPath_ +fName;
74
}
75
pFlow::real
float real
Definition:
builtinTypes.hpp:46
fatalExit
#define fatalExit
Definition:
error.hpp:57
pFlow::vtkFile::fileName
virtual fileSystem fileName() const
Definition:
vtkFile.cpp:70
pFlow::word
std::string word
Definition:
builtinTypes.hpp:63
pFlow::vtkFile::openStream
bool openStream()
Definition:
vtkFile.cpp:24
pFlow::vtkFile::writeHeader
virtual bool writeHeader()
pFlow::endl
iOstream & endl(iOstream &os)
Definition:
iOstream.hpp:312
pFlow::fileSystem
Definition:
fileSystem.hpp:63
fatalErrorInFunction
#define fatalErrorInFunction
Definition:
error.hpp:42
pFlow::vtkFile::vtkFile
vtkFile(const fileSystem dir, const word &bName, real time)
Definition:
vtkFile.cpp:49
pFlow::int322Word
word int322Word(const int32 &v)
Definition:
bTypesFunctions.cpp:67
pFlow::vtkFile::oStream_
uniquePtr< oFstream > oStream_
Definition:
vtkFile.hpp:43
vtkFile.hpp
utilities
Utilities
vtkFile
vtkFile.cpp
Generated by
1.8.17