Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openfpm_data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sbalzarini Lab
Software
Parallel Computing
OpenFPM
openfpm_data
Commits
d5d69140
Commit
d5d69140
authored
9 years ago
by
Pietro Incardona
Browse files
Options
Downloads
Plain Diff
Merge branch 'Antonio_DLB' of
ssh://ppmcore.mpi-cbg.de/incardon/openfpm_io
into Antonio_DLB
parents
199dec5f
6406c98f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
configure.ac
+1
-1
1 addition, 1 deletion
configure.ac
src/VTKWriter_dist_graph.hpp
+127
-104
127 additions, 104 deletions
src/VTKWriter_dist_graph.hpp
src/main.cpp
+1
-0
1 addition, 0 deletions
src/main.cpp
with
129 additions
and
105 deletions
configure.ac
+
1
−
1
View file @
d5d69140
...
...
@@ -96,7 +96,7 @@ fi
####### include openfpm_devices include path
INCLUDES_PATH+="-I. -Iconfig
-I../../openfpm_vcluster/src
-I../../openfpm_data/src -I../../openfpm_devices/src -I$pdata_dir "
INCLUDES_PATH+="-I. -Iconfig -I../../openfpm_data/src -I../../openfpm_devices/src
-I../../openfpm_vcluster/src
-I$pdata_dir "
########
...
...
This diff is collapsed.
Click to expand it.
src/VTKWriter_dist_graph.hpp
+
127
−
104
View file @
d5d69140
...
...
@@ -8,6 +8,8 @@
#ifndef VTKWRITER_DIST_GRAPH_HPP_
#define VTKWRITER_DIST_GRAPH_HPP_
#include
"VCluster.hpp"
/*! Property data store for scalar and vector
*
*/
...
...
@@ -881,7 +883,7 @@ struct dist_prop_out_edge
template
<
typename
Graph
>
class
VTKWriter
<
Graph
,
DIST_GRAPH
>
{
const
Graph
&
g
;
Graph
&
g
;
/*! \brief It get the vertex properties list
*
...
...
@@ -996,7 +998,7 @@ class VTKWriter<Graph, DIST_GRAPH>
vtk_dist_vertex_node
<
Graph
,
attr
>
vn
(
v_out
,
obj
,
x
);
// Iterate through all the vertex and create the vertex list
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
0
,
Graph
::
V_type
::
max_prop
-
1
>
>
(
vn
);
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
0
,
Graph
::
V_type
::
max_prop
>
>
(
vn
);
// write the node string
vn
.
write
();
...
...
@@ -1100,7 +1102,7 @@ public:
* \param g Graph to write
*
*/
VTKWriter
(
const
Graph
&
g
)
:
VTKWriter
(
Graph
&
g
)
:
g
(
g
)
{
}
...
...
@@ -1117,116 +1119,137 @@ public:
template
<
int
prp
=
-
1
>
bool
write
(
std
::
string
file
,
std
::
string
graph_name
=
"Graph"
,
file_type
ft
=
file_type
::
ASCII
)
{
// Check that the Vertex type define x y and z attributes
if
(
has_attributes
<
typename
Graph
::
V_type
>::
value
==
false
)
{
std
::
cerr
<<
"Error writing a graph: Vertex must has defines x,y,z properties"
<<
"
\n
"
;
return
false
;
}
Vcluster
&
v_cl
=
*
global_v_cluster
;
// Header for the vtk
std
::
string
vtk_header
;
// Point list of the VTK
std
::
string
point_list
;
// Vertex list of the VTK
std
::
string
vertex_list
;
// Graph header
std
::
string
vtk_binary_or_ascii
;
// Edge list of the GraphML
std
::
string
edge_list
;
// vertex properties header
std
::
string
point_prop_header
;
// edge properties header
std
::
string
vertex_prop_header
;
// edge properties header
std
::
string
edge_prop_header
;
// Data point header
std
::
string
point_data_header
;
// Ids point
std
::
string
point_ids
;
// Data point
std
::
string
point_data
;
// Cell data header
std
::
string
cell_data_header
;
// Cell data
std
::
string
cell_data
;
// VTK header
vtk_header
=
"# vtk DataFile Version 3.0
\n
"
+
graph_name
+
"
\n
"
;
// Choose if binary or ASCII
if
(
ft
==
file_type
::
ASCII
)
{
vtk_header
+=
"ASCII
\n
"
;
}
else
g
.
deleteGhosts
();
if
(
v_cl
.
getProcessUnitID
()
==
0
)
{
vtk_header
+=
"BINARY
\n
"
;
for
(
size_t
i
=
0
;
i
<
g
.
getTotNVertex
();
++
i
)
{
g
.
reqVertex
(
i
);
}
}
// Data type for graph is DATASET POLYDATA
vtk_header
+=
"DATASET POLYDATA
\n
"
;
// point properties header
point_prop_header
=
get_point_properties_list
();
// Get point list
point_list
=
get_point_list
<
has_attributes
<
typename
Graph
::
V_type
>::
value
>
();
// vertex properties header
vertex_prop_header
=
get_vertex_properties_list
();
// Get vertex list
vertex_list
=
get_vertex_list
();
// Edge properties header
edge_prop_header
=
get_edge_properties_list
();
// Get the edge graph list
edge_list
=
get_edge_list
();
// Get the point data header
point_data_header
=
get_point_data_header
();
g
.
sync
();
// Get the point info
point_ids
=
get_point_info
();
// Get the cell data header
cell_data_header
=
get_cell_data_header
();
// For each property in the vertex type produce a point data
dist_prop_out_vertex
<
Graph
>
pp
(
point_data
,
g
);
if
(
prp
==
-
1
)
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
0
,
Graph
::
V_type
::
max_prop
>
>
(
pp
);
else
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
prp
,
prp
>
>
(
pp
);
// For each property in the edge type produce a point data
dist_prop_out_edge
<
Graph
>
ep
(
cell_data
,
g
);
if
(
prp
==
-
1
)
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
0
,
Graph
::
E_type
::
max_prop
>
>
(
ep
);
else
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
prp
,
prp
>
>
(
ep
);
// write the file
std
::
ofstream
ofs
(
file
);
// Check if the file is open
if
(
ofs
.
is_open
()
==
false
)
if
(
v_cl
.
getProcessUnitID
()
==
0
)
{
std
::
cerr
<<
"Error cannot create the VTK file: "
+
file
;
}
ofs
<<
vtk_header
<<
point_prop_header
<<
point_list
<<
vertex_prop_header
<<
vertex_list
<<
edge_prop_header
<<
edge_list
<<
point_data_header
<<
point_ids
<<
point_data
<<
cell_data_header
<<
cell_data
;
// Check that the Vertex type define x y and z attributes
if
(
has_attributes
<
typename
Graph
::
V_type
>::
value
==
false
)
{
std
::
cerr
<<
"Error writing a graph: Vertex must has defines x,y,z properties"
<<
"
\n
"
;
return
false
;
}
// Header for the vtk
std
::
string
vtk_header
;
// Point list of the VTK
std
::
string
point_list
;
// Vertex list of the VTK
std
::
string
vertex_list
;
// Graph header
std
::
string
vtk_binary_or_ascii
;
// Edge list of the GraphML
std
::
string
edge_list
;
// vertex properties header
std
::
string
point_prop_header
;
// edge properties header
std
::
string
vertex_prop_header
;
// edge properties header
std
::
string
edge_prop_header
;
// Data point header
std
::
string
point_data_header
;
// Ids point
std
::
string
point_ids
;
// Data point
std
::
string
point_data
;
// Cell data header
std
::
string
cell_data_header
;
// Cell data
std
::
string
cell_data
;
// VTK header
vtk_header
=
"# vtk DataFile Version 3.0
\n
"
+
graph_name
+
"
\n
"
;
// Choose if binary or ASCII
if
(
ft
==
file_type
::
ASCII
)
{
vtk_header
+=
"ASCII
\n
"
;
}
else
{
vtk_header
+=
"BINARY
\n
"
;
}
// Data type for graph is DATASET POLYDATA
vtk_header
+=
"DATASET POLYDATA
\n
"
;
// point properties header
point_prop_header
=
get_point_properties_list
();
// Get point list
point_list
=
get_point_list
<
has_attributes
<
typename
Graph
::
V_type
>::
value
>
();
// vertex properties header
vertex_prop_header
=
get_vertex_properties_list
();
// Get vertex list
vertex_list
=
get_vertex_list
();
// Edge properties header
edge_prop_header
=
get_edge_properties_list
();
// Get the edge graph list
edge_list
=
get_edge_list
();
// Get the point data header
point_data_header
=
get_point_data_header
();
// Get the point info
point_ids
=
get_point_info
();
// Get the cell data header
cell_data_header
=
get_cell_data_header
();
// For each property in the vertex type produce a point data
dist_prop_out_vertex
<
Graph
>
pp
(
point_data
,
g
);
if
(
prp
==
-
1
)
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
0
,
Graph
::
V_type
::
max_prop
>
>
(
pp
);
else
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
prp
,
prp
>
>
(
pp
);
// For each property in the edge type produce a point data
dist_prop_out_edge
<
Graph
>
ep
(
cell_data
,
g
);
if
(
prp
==
-
1
)
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
0
,
Graph
::
E_type
::
max_prop
>
>
(
ep
);
else
boost
::
mpl
::
for_each
<
boost
::
mpl
::
range_c
<
int
,
prp
,
prp
>
>
(
ep
);
// write the file
std
::
ofstream
ofs
(
file
);
// Check if the file is open
if
(
ofs
.
is_open
()
==
false
)
{
std
::
cerr
<<
"Error cannot create the VTK file: "
+
file
;
}
ofs
<<
vtk_header
<<
point_prop_header
<<
point_list
<<
vertex_prop_header
<<
vertex_list
<<
edge_prop_header
<<
edge_list
<<
point_data_header
<<
point_ids
<<
point_data
<<
cell_data_header
<<
cell_data
;
// Close the file
ofs
.
close
();
// Close the file
}
ofs
.
close
();
g
.
deleteGhosts
();
// Completed succefully
return
true
;
...
...
This diff is collapsed.
Click to expand it.
src/main.cpp
+
1
−
0
View file @
d5d69140
...
...
@@ -6,6 +6,7 @@
#define BOOST_TEST_MODULE "C++ test module for OpenFPM_io project"
#include
<boost/test/included/unit_test.hpp>
#include
"VCluster.hpp"
#include
"CSVWriter/CSVWriter_unit_tests.hpp"
#include
"GraphMLWriter/GraphMLWriter_unit_tests.hpp"
#include
"VTKWriter/VTKWriter_unit_tests.hpp"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment