Commit 5f6474ec authored by incardon's avatar incardon

test and binary output VTK

parent 973a7c52
......@@ -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));
}
......
......@@ -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);
......
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment