Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sbalzarini Lab
S
Software
P
Parallel Computing
OpenFPM
openfpm_io
Commits
5f6474ec
Commit
5f6474ec
authored
Aug 02, 2017
by
incardon
Browse files
test and binary output VTK
parent
973a7c52
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/VTKWriter/VTKWriter_grids_util.hpp
View file @
5f6474ec
...
...
@@ -385,6 +385,8 @@ struct meta_prop<I, ele_g,St, T[N1][N2],is_writable>
// if there is the next element
while
(
it
.
isNext
())
{
T
tmp
;
if
(
ft
==
file_type
::
ASCII
)
{
// Print the property
...
...
@@ -392,7 +394,7 @@ struct meta_prop<I, ele_g,St, T[N1][N2],is_writable>
}
else
{
auto
tmp
=
vg
.
get
(
k
).
g
.
get_o
(
it
.
get
()).
template
get
<
I
::
value
>()[
i1
][
i2
];
tmp
=
vg
.
get
(
k
).
g
.
get_o
(
it
.
get
()).
template
get
<
I
::
value
>()[
i1
][
i2
];
tmp
=
swap_endian_lt
(
tmp
);
v_out
.
append
((
const
char
*
)
&
tmp
,
sizeof
(
tmp
));
}
...
...
@@ -401,6 +403,9 @@ struct meta_prop<I, ele_g,St, T[N1][N2],is_writable>
++
it
;
}
}
if
(
ft
==
file_type
::
BINARY
)
v_out
+=
"
\n
"
;
}
}
}
...
...
@@ -437,10 +442,18 @@ template<unsigned int dims,typename T> inline void output_point(Point<dims,T> &
}
else
{
for
(
size_t
i
=
0
;
i
<
dims
;
i
++
)
size_t
i
=
0
;
for
(
;
i
<
dims
;
i
++
)
{
// we use float so we have to convert to float
auto
tmp
=
p
.
get
(
i
);
tmp
=
swap_endian_lt
(
tmp
);
v_out
.
write
((
const
char
*
)
&
tmp
,
sizeof
(
tmp
));
}
for
(
;
i
<
3
;
i
++
)
{
// we use float so we have to convert to float
float
tmp
=
p
.
get
(
i
);
auto
tmp
=
p
.
get
(
i
);
tmp
=
swap_endian_lt
(
tmp
);
v_out
.
write
((
const
char
*
)
&
tmp
,
sizeof
(
tmp
));
}
...
...
src/VTKWriter/VTKWriter_point_set.hpp
View file @
5f6474ec
...
...
@@ -231,13 +231,17 @@ class VTKWriter<pair,VECTOR_POINTS>
*
*/
std
::
string
get_point_properties_list
()
std
::
string
get_point_properties_list
(
file_type
ft
)
{
//! vertex property output string
std
::
string
v_out
;
// write the number of vertex
v_out
+=
"POINTS "
+
std
::
to_string
(
get_total
())
+
" float"
+
"
\n
"
;
if
(
ft
==
file_type
::
ASCII
)
v_out
+=
"POINTS "
+
std
::
to_string
(
get_total
())
+
" float"
+
"
\n
"
;
else
v_out
+=
"POINTS "
+
std
::
to_string
(
get_total
())
+
" "
+
getType
<
typename
pair
::
first
::
value_type
::
coord_type
>
()
+
"
\n
"
;
// return the vertex properties string
return
v_out
;
...
...
@@ -410,7 +414,7 @@ public:
vtk_header
+=
"DATASET POLYDATA
\n
"
;
// point properties header
point_prop_header
=
get_point_properties_list
();
point_prop_header
=
get_point_properties_list
(
ft
);
// Get point list
point_list
=
get_point_list
(
ft
);
...
...
src/VTKWriter/VTKWriter_unit_tests.hpp
View file @
5f6474ec
...
...
@@ -1175,7 +1175,7 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set_binary )
vtk_v
.
write
(
"vtk_points_2d_bin.vtk"
,
stub
,
"vtk output"
,
file_type
::
BINARY
);
// Check that match
bool
test
=
compare
(
"vtk_points_2d_bin.vtk"
,
"vtk_points_2d_bin_test.vtk"
);
bool
test
=
compare
(
"vtk_points_2d_bin.vtk"
,
"
test_data/
vtk_points_2d_bin_test.vtk"
);
BOOST_REQUIRE_EQUAL
(
test
,
true
);
...
...
@@ -1186,7 +1186,7 @@ BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set_binary )
vtk_v2
.
write
(
"vtk_points_2d_pp_bin.vtk"
,
stub
,
"vtk output"
,
file_type
::
BINARY
);
// Check that match
test
=
compare
(
"vtk_points_2d_pp_bin.vtk"
,
"vtk_points_2d_pp_bin_test.vtk"
);
test
=
compare
(
"vtk_points_2d_pp_bin.vtk"
,
"
test_data/
vtk_points_2d_pp_bin_test.vtk"
);
BOOST_REQUIRE_EQUAL
(
test
,
true
);
}
}
...
...
vtk_points_2d_bin_test.vtk
→
test_data/
vtk_points_2d_bin_test.vtk
View file @
5f6474ec
No preview for this file type
test_data/vtk_points_bin_test.vtk
View file @
5f6474ec
No preview for this file type
test_data/vtk_points_pp_bin_test.vtk
View file @
5f6474ec
No preview for this file type
vtk_points_2d_pp_bin_test.vtk
deleted
100644 → 0
View file @
973a7c52
File deleted
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment