PhasicFlow
v0.1
www.cemf.ir
geometric.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 "
geometric.hpp
"
23
24
25
template
<>
26
bool
pFlow::dataToVTK
(
vtkFile
& vtk,
const
triSurface
& surface )
27
{
28
29
30
auto
nP = surface.
numPoints
();
31
auto
hPoints = surface.
points
().
hostVector
();
32
33
vtk() <<
"DATASET POLYDATA"
<<
endl
;
34
vtk() <<
"POINTS "
<< nP <<
" float"
<<
endl
;
35
36
37
for
(
auto
i=0; i<nP; i++ )
38
{
39
vtk() << hPoints[i].x() <<
" "
<< hPoints[i].y() <<
" "
<< hPoints[i].z() <<
endl
;
40
if
(!vtk)
return
false
;
41
}
42
43
auto
nV = surface.
numTriangles
();
44
auto
hVertices = surface.
vertices
().
hostVector
();
45
46
vtk() <<
"POLYGONS "
<< nV <<
" "
<< 4*nV <<
endl
;
47
48
for
(
auto
i=0; i<nV; i++)
49
{
50
vtk()<< 3 <<
" "
<< hVertices[i].x() <<
" "
<< hVertices[i].y() <<
" "
<<hVertices[i].z()<<
endl
;
51
if
(!vtk)
return
false
;
52
}
53
54
return
true
;
55
}
56
57
template
<>
58
bool
pFlow::dataToVTK
(
vtkFile
& vtk,
const
multiTriSurface
& surface )
59
{
60
61
auto
nP = surface.
numPoints
();
62
auto
hPoints = surface.
points
().
hostVector
();
63
64
vtk() <<
"DATASET POLYDATA"
<<
endl
;
65
vtk() <<
"POINTS "
<< nP <<
" float"
<<
endl
;
66
67
68
for
(
auto
i=0; i<nP; i++ )
69
{
70
vtk() << hPoints[i].x() <<
" "
<< hPoints[i].y() <<
" "
<< hPoints[i].z() <<
endl
;
71
if
(!vtk)
return
false
;
72
}
73
74
auto
nV = surface.
numTriangles
();
75
auto
hVertices = surface.
vertices
().
hostVector
();
76
77
vtk() <<
"POLYGONS "
<< nV <<
" "
<< 4*nV <<
endl
;
78
79
for
(
auto
i=0; i<nV; i++)
80
{
81
vtk()<< 3 <<
" "
<< hVertices[i].x() <<
" "
<< hVertices[i].y() <<
" "
<<hVertices[i].z()<<
endl
;
82
if
(!vtk)
return
false
;
83
}
84
85
return
true
;
86
87
}
pFlow::VectorSingle::hostVector
const INLINE_FUNCTION_H auto hostVector() const
Definition:
VectorSingle.hpp:336
pFlow::vtkFile
Definition:
vtkFile.hpp:33
geometric.hpp
pFlow::endl
iOstream & endl(iOstream &os)
Definition:
iOstream.hpp:312
pFlow::triSurface::points
const realx3Vector_D & points() const
Definition:
triSurface.hpp:184
pFlow::multiTriSurface
Definition:
multiTriSurface.hpp:33
pFlow::triSurface::numTriangles
size_t numTriangles() const
Definition:
triSurface.hpp:154
pFlow::triSurface::numPoints
size_t numPoints() const
Definition:
triSurface.hpp:149
pFlow::triSurface::vertices
const int32x3Vector_D & vertices() const
Definition:
triSurface.hpp:214
pFlow::triSurface
Definition:
triSurface.hpp:38
pFlow::dataToVTK
bool dataToVTK(vtkFile &vtk, const Type &dataEntity)
Definition:
geometric.hpp:61
utilities
pFlowToVTK
geometric.cpp
Generated by
1.8.17