PhasicFlow
v0.1
www.cemf.ir
rectMeshFieldToVTK.hpp
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
#ifndef __rectMeshFieldToVTK_hpp__
22
#define __rectMeshFieldToVTK_hpp__
23
24
25
namespace
pFlow
26
{
27
28
template
<
typename
T>
29
bool
convertRectMeshField
(
iOstream
& os,
rectMeshField_H<T>
& field)
30
{
31
fatalErrorInFunction
<<
"this type is not supported "
<<
32
field.typeName()<<
endl
;
33
fatalExit
;
34
return
false
;
35
}
36
37
38
template
<>
39
bool
convertRectMeshField
(
iOstream
& os,
rectMeshField_H<real>
& field)
40
{
41
42
os<<
"FIELD FieldData 1 "
<< field.
name
() <<
" 1 "
<< field.
size
() <<
" float\n"
;
43
for
(
int32
k=0; k<field.
nz
(); k++)
44
{
45
for
(
int32
j=0; j<field.
ny
(); j++)
46
{
47
for
(
int32
i=0; i<field.
nx
(); i++)
48
{
49
os<< field(i,j,k)<<
"\n"
;
50
}
51
}
52
}
53
os<<
endl
;
54
return
true
;
55
}
56
57
template
<>
58
bool
convertRectMeshField
(
iOstream
& os,
rectMeshField_H<realx3>
& field)
59
{
60
61
os<<
"FIELD FieldData 1 "
<< field.
name
() <<
" 3 "
<< field.
size
() <<
" float\n"
;
62
for
(
int32
k=0; k<field.
nz
(); k++)
63
{
64
for
(
int32
j=0; j<field.
ny
(); j++)
65
{
66
for
(
int32
i=0; i<field.
nx
(); i++)
67
{
68
os<< field(i,j,k).x()<<
" "
<<field(i,j,k).y()<<
" "
<<field(i,j,k).z()<<
"\n"
;
69
}
70
}
71
}
72
os<<
endl
;
73
return
true
;
74
}
75
76
template
<>
77
bool
convertRectMeshField
(
iOstream
& os,
rectMeshField_H<int32>
& field)
78
{
79
80
os<<
"FIELD FieldData 1 "
<< field.
name
() <<
" 1 "
<< field.
size
() <<
" int\n"
;
81
for
(
int32
k=0; k<field.
nz
(); k++)
82
{
83
for
(
int32
j=0; j<field.
ny
(); j++)
84
{
85
for
(
int32
i=0; i<field.
nx
(); i++)
86
{
87
os<< field(i,j,k)<<
"\n"
;
88
}
89
}
90
}
91
os<<
endl
;
92
return
true
;
93
}
94
95
}
96
97
98
#endif
pFlow::rectMeshField::size
INLINE_FUNCTION_HD int64 size() const
Definition:
rectMeshField.hpp:100
fatalExit
#define fatalExit
Definition:
error.hpp:57
pFlow::rectMeshField
Definition:
rectMeshField.hpp:31
pFlow::endl
iOstream & endl(iOstream &os)
Definition:
iOstream.hpp:312
pFlow
Definition:
demComponent.hpp:28
pFlow::convertRectMeshField
bool convertRectMeshField(iOstream &os, rectMeshField_H< T > &field)
Definition:
rectMeshFieldToVTK.hpp:29
pFlow::rectMeshField::nx
auto nx() const
Definition:
rectMeshField.hpp:105
pFlow::rectMeshField::ny
auto ny() const
Definition:
rectMeshField.hpp:110
fatalErrorInFunction
#define fatalErrorInFunction
Definition:
error.hpp:42
pFlow::int32
int int32
Definition:
builtinTypes.hpp:53
pFlow::rectMeshField::name
const INLINE_FUNCTION_H word & name() const
Definition:
rectMeshField.hpp:94
pFlow::rectMeshField::nz
auto nz() const
Definition:
rectMeshField.hpp:115
pFlow::iOstream
Definition:
iOstream.hpp:53
utilities
postprocessPhasicFlow
rectMeshFieldToVTK.hpp
Generated by
1.8.17