Commit 7988298e authored by Pietro Incardona's avatar Pietro Incardona

Fix and small changes

parent c54eca6e
...@@ -181,9 +181,10 @@ class CSVWriter ...@@ -181,9 +181,10 @@ class CSVWriter
* *
* \param v_pos vector that contain the positional information * \param v_pos vector that contain the positional information
* \param v_prp vector that contain the property information * \param v_prp vector that contain the property information
* \param offset from where to start
* *
*/ */
std::string get_csv_data(v_pos & vp, v_prp & vpr) std::string get_csv_data(v_pos & vp, v_prp & vpr, size_t offset)
{ {
std::stringstream str; std::stringstream str;
...@@ -195,7 +196,7 @@ class CSVWriter ...@@ -195,7 +196,7 @@ class CSVWriter
} }
// Write the data // Write the data
for (size_t i = 0 ; i < vp.size() ; i++) for (size_t i = offset ; i < vp.size() ; i++)
{ {
for (size_t j = 0 ; j < v_pos::value_type::dims ; j++) for (size_t j = 0 ; j < v_pos::value_type::dims ; j++)
{ {
...@@ -228,10 +229,11 @@ public: ...@@ -228,10 +229,11 @@ public:
* \param file path where to write * \param file path where to write
* \param v_pos positional vector * \param v_pos positional vector
* \param v_prp properties vector * \param v_prp properties vector
* \param offset from where to start to write
* *
*/ */
bool write(std::string file, v_pos & v , v_prp & prp) bool write(std::string file, v_pos & v , v_prp & prp, size_t offset=0)
{ {
// Header for csv (colums name) // Header for csv (colums name)
std::string csv_header; std::string csv_header;
...@@ -242,7 +244,7 @@ public: ...@@ -242,7 +244,7 @@ public:
csv_header = get_csv_colums(); csv_header = get_csv_colums();
// For each property in the vertex type produce a point data // For each property in the vertex type produce a point data
point_data = get_csv_data(v,prp); point_data = get_csv_data(v,prp,offset);
// write the file // write the file
std::ofstream ofs(file); std::ofstream ofs(file);
......
...@@ -131,7 +131,10 @@ BOOST_AUTO_TEST_CASE( graphml_writer_use) ...@@ -131,7 +131,10 @@ BOOST_AUTO_TEST_CASE( graphml_writer_use)
// Box // Box
Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0}); Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
Graph_CSR<ne_cp,ne_cp> g_csr = g_factory.construct<5,float,2,ne_cp::x,ne_cp::y,ne_cp::z>(sz,box); // Boundary conditions, non periodic
size_t bc[] = {NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
Graph_CSR<ne_cp,ne_cp> g_csr = g_factory.construct<5,float,2,ne_cp::x,ne_cp::y,ne_cp::z>(sz,box,bc);
// Create a graph ML // Create a graph ML
GraphMLWriter<Graph_CSR<ne_cp,ne_cp>> gw(g_csr); GraphMLWriter<Graph_CSR<ne_cp,ne_cp>> gw(g_csr);
......
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