OpenFPM  5.2.0
Project that contain the implementation of distributed structures
VTKWriter_unit_tests.hpp
1 /*
2  * VTKWriter_unit_tests.hpp
3  *
4  * Created on: May 6, 2015
5  * Author: Pietro Incardona
6  *
7  * Modified by Abhinav Singh May 17, 2021
8  */
9 
10 #ifndef VTKWRITER_UNIT_TESTS_HPP_
11 #define VTKWRITER_UNIT_TESTS_HPP_
12 
13 #include "data_type/aggregate.hpp"
14 #include <random>
15 #include "VTKWriter.hpp"
16 #include "util/SimpleRNG.hpp"
17 
18 BOOST_AUTO_TEST_SUITE( vtk_writer_test )
19 
20 
23 struct vertex
24 {
26  typedef boost::fusion::vector<float,float,float,float,size_t,double,unsigned char,long int> type;
27 
29  typedef float s_type;
30 
32  struct attributes
33  {
34  static const std::string name[];
35  };
36 
39 
41  static const unsigned int x = 0;
43  static const unsigned int y = 1;
45  static const unsigned int z = 2;
47  static const unsigned int prp1 = 3;
49  static const unsigned int prp2 = 4;
51  static const unsigned int prp3 = 5;
53  static const unsigned int prp4 = 6;
55  static const unsigned int prp5 = 7;
56 
58  static const unsigned int max_prop = 8;
59 
65  {
66 
67  }
68 
69  static inline bool noPointers()
70  {
71  return true;
72  }
73 
81  vertex(float x, float y, float z)
82  {
83  boost::fusion::at_c<vertex::x>(data) = x;
84  boost::fusion::at_c<vertex::y>(data) = y;
85  boost::fusion::at_c<vertex::z>(data) = z;
86  }
87 };
88 
89 const std::string vertex::attributes::name[] = {"x","y","z","prp1","prp2","prp3","prp4","prp5"};
90 
91 struct vertex2
92 {
94  typedef boost::fusion::vector<float[3],size_t,double> type;
95 
97  typedef float s_type;
98 
100  struct attributes
101  {
102  static const std::string name[];
103  };
104 
107 
109  static const unsigned int x = 0;
110  static const unsigned int prp1 = 1;
111  static const unsigned int prp2 = 2;
112 
114  static const unsigned int max_prop = 3;
115 
121  {
122 
123  }
124 
125  static inline bool noPointers()
126  {
127  return true;
128  }
129 
137  vertex2(float x, float y, float z)
138  {
139  boost::fusion::at_c<vertex::x>(data)[0] = x;
140  boost::fusion::at_c<vertex::x>(data)[1] = y;
141  boost::fusion::at_c<vertex::x>(data)[2] = z;
142  }
143 };
144 
145 // use the vertex like the edge
146 typedef vertex edge;
147 
148 const std::string vertex2::attributes::name[] = {"x","prp1","prp2"};
149 
150 
151 
152 BOOST_AUTO_TEST_CASE( vtk_writer_use_graph3D )
153 {
154  Vcluster<> & v_cl = create_vcluster();
155 
156  if (v_cl.getProcessUnitID() != 0)
157  return;
158 
159  // Create some graphs and output them
160 
161  // Graph
162 
164 
165  // Create a cube graph
166 
167  gr.addVertex(vertex2(0.0,0.0,0.0));
168  gr.addVertex(vertex2(0.0,0.0,1.0));
169  gr.addVertex(vertex2(0.0,1.0,0.0));
170  gr.addVertex(vertex2(0.0,1.0,1.0));
171  gr.addVertex(vertex2(1.0,0.0,0.0));
172  gr.addVertex(vertex2(1.0,0.0,1.0));
173  gr.addVertex(vertex2(1.0,1.0,0.0));
174  gr.addVertex(vertex2(1.0,1.0,1.0));
175 
176  gr.addEdge(0,6);
177  gr.addEdge(6,4);
178  gr.addEdge(4,0);
179 
180  gr.addEdge(0,2);
181  gr.addEdge(2,6);
182  gr.addEdge(6,0);
183 
184  gr.addEdge(0,3);
185  gr.addEdge(3,2);
186  gr.addEdge(2,0);
187 
188  gr.addEdge(0,1);
189  gr.addEdge(1,3);
190  gr.addEdge(3,0);
191 
192  gr.addEdge(2,7);
193  gr.addEdge(7,6);
194  gr.addEdge(6,2);
195 
196  gr.addEdge(2,3);
197  gr.addEdge(3,7);
198  gr.addEdge(7,2);
199 
200  gr.addEdge(4,6);
201  gr.addEdge(6,7);
202  gr.addEdge(7,4);
203 
204  gr.addEdge(4,7);
205  gr.addEdge(7,5);
206  gr.addEdge(5,4);
207 
208  gr.addEdge(0,4);
209  gr.addEdge(4,5);
210  gr.addEdge(5,0);
211 
212  gr.addEdge(0,5);
213  gr.addEdge(5,1);
214  gr.addEdge(1,0);
215 
216  gr.addEdge(1,5);
217  gr.addEdge(5,7);
218  gr.addEdge(7,1);
219 
220  gr.addEdge(1,7);
221  gr.addEdge(7,3);
222  gr.addEdge(3,1);
223 
224  // Write the VTK file
225 
226  std::string c2 = std::string("test_data/vtk_graph_v2_test.vtk");
227 
228  VTKWriter<Graph_CSR<vertex2,edge>,VTK_GRAPH> vtk(gr);
229  vtk.write("vtk_graph_v2.vtk");
230 
231  // check that match
232 
233  bool test = compare("vtk_graph_v2.vtk",c2);
234  BOOST_REQUIRE_EQUAL(true,test);
235 }
236 
237 BOOST_AUTO_TEST_CASE( vtk_writer_use_graph3D_edge )
238 {
239  Vcluster<> & v_cl = create_vcluster();
240 
241  if (v_cl.getProcessUnitID() != 0)
242  return;
243 
244  // Create some graphs and output them
245 
246  // Graph
247 
249 
250  // Create a cube graph
251 
252  gr.addVertex(vertex2(0.0,0.0,0.0));
253  gr.addVertex(vertex2(0.0,0.0,1.0));
254  gr.addVertex(vertex2(0.0,1.0,0.0));
255  gr.addVertex(vertex2(0.0,1.0,1.0));
256  gr.addVertex(vertex2(1.0,0.0,0.0));
257  gr.addVertex(vertex2(1.0,0.0,1.0));
258  gr.addVertex(vertex2(1.0,1.0,0.0));
259  gr.addVertex(vertex2(1.0,1.0,1.0));
260 
261  gr.addEdge(0,6,vertex2(0.0,0.0,1.0));
262  gr.addEdge(6,4,vertex2(0.0,0.0,1.0));
263  gr.addEdge(4,0,vertex2(0.0,0.0,1.0));
264 
265  gr.addEdge(0,2,vertex2(0.0,0.0,1.0));
266  gr.addEdge(2,6,vertex2(0.0,0.0,1.0));
267  gr.addEdge(6,0,vertex2(0.0,0.0,1.0));
268 
269  gr.addEdge(0,3,vertex2(0.0,0.0,1.0));
270  gr.addEdge(3,2,vertex2(0.0,0.0,1.0));
271  gr.addEdge(2,0,vertex2(0.0,0.0,1.0));
272 
273  gr.addEdge(0,1,vertex2(0.0,0.0,1.0));
274  gr.addEdge(1,3,vertex2(0.0,0.0,1.0));
275  gr.addEdge(3,0,vertex2(0.0,0.0,1.0));
276 
277  gr.addEdge(2,7,vertex2(0.0,0.0,1.0));
278  gr.addEdge(7,6,vertex2(0.0,0.0,1.0));
279  gr.addEdge(6,2,vertex2(0.0,0.0,1.0));
280 
281  gr.addEdge(2,3,vertex2(0.0,0.0,1.0));
282  gr.addEdge(3,7,vertex2(0.0,0.0,1.0));
283  gr.addEdge(7,2,vertex2(0.0,0.0,1.0));
284 
285  gr.addEdge(4,6,vertex2(0.0,0.0,1.0));
286  gr.addEdge(6,7,vertex2(0.0,0.0,1.0));
287  gr.addEdge(7,4,vertex2(0.0,0.0,1.0));
288 
289  gr.addEdge(4,7,vertex2(0.0,0.0,1.0));
290  gr.addEdge(7,5,vertex2(0.0,0.0,1.0));
291  gr.addEdge(5,4,vertex2(0.0,0.0,1.0));
292 
293  gr.addEdge(0,4,vertex2(0.0,0.0,1.0));
294  gr.addEdge(4,5,vertex2(0.0,0.0,1.0));
295  gr.addEdge(5,0,vertex2(0.0,0.0,1.0));
296 
297  gr.addEdge(0,5,vertex2(0.0,0.0,1.0));
298  gr.addEdge(5,1,vertex2(0.0,0.0,1.0));
299  gr.addEdge(1,0,vertex2(0.0,0.0,1.0));
300 
301  gr.addEdge(1,5,vertex2(0.0,0.0,1.0));
302  gr.addEdge(5,7,vertex2(0.0,0.0,1.0));
303  gr.addEdge(7,1,vertex2(0.0,0.0,1.0));
304 
305  gr.addEdge(1,7,vertex2(0.0,0.0,1.0));
306  gr.addEdge(7,3,vertex2(0.0,0.0,1.0));
307  gr.addEdge(3,1,vertex2(0.0,0.0,1.0));
308 
309  // Write the VTK file
310 
311  std::string c2 = std::string("test_data/vtk_graph_v4_test.vtk");
312 
313  VTKWriter<Graph_CSR<vertex2,vertex2>,VTK_GRAPH> vtk(gr);
314  vtk.write("vtk_graph_v4.vtk");
315 
316  // check that match
317 
318  bool test = compare("vtk_graph_v4.vtk",c2);
319  BOOST_REQUIRE_EQUAL(true,test);
320 }
321 
322 struct vertex3
323 {
325  typedef boost::fusion::vector<float[2],size_t,double> type;
326 
328  typedef float s_type;
329 
331  struct attributes
332  {
333  static const std::string name[];
334  };
335 
338 
340  static const unsigned int x = 0;
341  static const unsigned int prp1 = 1;
342  static const unsigned int prp2 = 2;
343 
345  static const unsigned int max_prop = 3;
346 
352  {
353 
354  }
355 
356  static inline bool noPointers()
357  {
358  return true;
359  }
360 
366  vertex3(float x, float y)
367  {
368  boost::fusion::at_c<vertex::x>(data)[0] = x;
369  boost::fusion::at_c<vertex::x>(data)[1] = y;
370  }
371 };
372 
373 // use the vertex like the edge
374 typedef vertex edge;
375 
376 const std::string vertex3::attributes::name[] = {"x","prp1","prp2"};
377 
378 BOOST_AUTO_TEST_CASE( vtk_writer_use_graph2D )
379 {
380  Vcluster<> & v_cl = create_vcluster();
381 
382  if (v_cl.getProcessUnitID() != 0)
383  return;
384 
385  // Create some graphs and output them
386 
387  // Graph
388 
390 
391  // Create a cube graph
392 
393  gr.addVertex(vertex3(0.0,0.0));
394  gr.addVertex(vertex3(0.0,1.0));
395  gr.addVertex(vertex3(1.0,0.0));
396  gr.addVertex(vertex3(1.0,1.0));
397 
398  gr.addEdge(0,1);
399  gr.addEdge(1,3);
400  gr.addEdge(3,2);
401  gr.addEdge(2,0);
402 
403  // Write the VTK file
404 
405  std::string c2 = std::string("test_data/vtk_graph_v3_test.vtk");
406 
407  VTKWriter<Graph_CSR<vertex3,edge>,VTK_GRAPH> vtk(gr);
408  vtk.write("vtk_graph_v3.vtk");
409 
410  // check that match
411 
412  bool test = compare("vtk_graph_v3.vtk",c2);
413  BOOST_REQUIRE_EQUAL(true,test);
414 }
415 
416 BOOST_AUTO_TEST_CASE( vtk_writer_use_graph)
417 {
418  Vcluster<> & v_cl = create_vcluster();
419 
420  if (v_cl.getProcessUnitID() != 0)
421  return;
422 
423  // Create some graphs and output them
424 
425  std::cout << "Graph unit test start" << "\n";
426 
427  // Graph
428 
430 
431  // Create a cube graph
432 
433  gr.addVertex(vertex(0.0,0.0,0.0));
434  gr.addVertex(vertex(0.0,0.0,1.0));
435  gr.addVertex(vertex(0.0,1.0,0.0));
436  gr.addVertex(vertex(0.0,1.0,1.0));
437  gr.addVertex(vertex(1.0,0.0,0.0));
438  gr.addVertex(vertex(1.0,0.0,1.0));
439  gr.addVertex(vertex(1.0,1.0,0.0));
440  gr.addVertex(vertex(1.0,1.0,1.0));
441 
442  gr.addEdge(0,6);
443  gr.addEdge(6,4);
444  gr.addEdge(4,0);
445 
446  gr.addEdge(0,2);
447  gr.addEdge(2,6);
448  gr.addEdge(6,0);
449 
450  gr.addEdge(0,3);
451  gr.addEdge(3,2);
452  gr.addEdge(2,0);
453 
454  gr.addEdge(0,1);
455  gr.addEdge(1,3);
456  gr.addEdge(3,0);
457 
458  gr.addEdge(2,7);
459  gr.addEdge(7,6);
460  gr.addEdge(6,2);
461 
462  gr.addEdge(2,3);
463  gr.addEdge(3,7);
464  gr.addEdge(7,2);
465 
466  gr.addEdge(4,6);
467  gr.addEdge(6,7);
468  gr.addEdge(7,4);
469 
470  gr.addEdge(4,7);
471  gr.addEdge(7,5);
472  gr.addEdge(5,4);
473 
474  gr.addEdge(0,4);
475  gr.addEdge(4,5);
476  gr.addEdge(5,0);
477 
478  gr.addEdge(0,5);
479  gr.addEdge(5,1);
480  gr.addEdge(1,0);
481 
482  gr.addEdge(1,5);
483  gr.addEdge(5,7);
484  gr.addEdge(7,1);
485 
486  gr.addEdge(1,7);
487  gr.addEdge(7,3);
488  gr.addEdge(3,1);
489 
490  std::string c2 = std::string("test_data/vtk_graph_test.vtk");
491 
492  // Write the VTK file
493 
494  VTKWriter<Graph_CSR<vertex,edge>,VTK_GRAPH> vtk(gr);
495  vtk.write("vtk_graph.vtk");
496 
497  // check that match
498 
499  bool test = compare("vtk_graph.vtk",c2);
500  BOOST_REQUIRE_EQUAL(true,test);
501 }
502 
503 BOOST_AUTO_TEST_CASE( vtk_writer_use_vector_box)
504 {
505  Vcluster<> & v_cl = create_vcluster();
506 
507  if (v_cl.getProcessUnitID() != 0)
508  return;
509 
510  std::string c2 = std::string("test_data/vtk_box_test.vtk");
511  std::string c3 = std::string("test_data/vtk_box_3D_test.vtk");
512  std::string c4 = std::string("test_data/vtk_box_3D_2_test.vtk");
513 
514  // Create a vector of boxes
516 
517  vb.add(Box<2,float>({0.2,0.2},{1.0,0.5}));
518  vb.add(Box<2,float>({0.0,0.0},{0.2,0.2}));
519  vb.add(Box<2,float>({0.2,0.0},{0.5,0.2}));
520  vb.add(Box<2,float>({0.5,0.0},{1.0,0.2}));
521  vb.add(Box<2,float>({0.0,0.2},{0.2,0.5}));
522  vb.add(Box<2,float>({0.0,0.5},{1.0,1.0}));
523 
524  // Create a writer and write
525  VTKWriter<openfpm::vector<Box<2,float>>,VECTOR_BOX> vtk_box;
526  vtk_box.add(vb);
527  vtk_box.write("vtk_box.vtk");
528 
529  // Check that match
530  bool test = compare("vtk_box.vtk",c2);
531  BOOST_REQUIRE_EQUAL(test,true);
532 
533  // Create a vector of boxes
535 
536  vb2.add(Box<3,float>({0.2,0.2,0.0},{1.0,0.5,0.5}));
537  vb2.add(Box<3,float>({0.0,0.0,0.0},{0.2,0.2,0.5}));
538  vb2.add(Box<3,float>({0.2,0.0,0.0},{0.5,0.2,0.5}));
539  vb2.add(Box<3,float>({0.5,0.0,0.0},{1.0,0.2,0.5}));
540  vb2.add(Box<3,float>({0.0,0.2,0.0},{0.2,0.5,0.5}));
541  vb2.add(Box<3,float>({0.0,0.5,0.0},{1.0,1.0,0.5}));
542 
543  // Create a writer and write
544  VTKWriter<openfpm::vector<Box<3,float>>,VECTOR_BOX> vtk_box2;
545  vtk_box2.add(vb2);
546  vtk_box2.write("vtk_box_3D.vtk");
547 
548  // Check that match
549  test = compare("vtk_box_3D.vtk",c3);
550  BOOST_REQUIRE_EQUAL(test,true);
551 
552  // Create a vector of boxes
554  vb3.add(Box<3,float>({0.2,0.2,0.5},{1.0,0.5,1.0}));
555  vb3.add(Box<3,float>({0.0,0.0,0.5},{0.2,0.2,1.0}));
556  vb3.add(Box<3,float>({0.2,0.0,0.5},{0.5,0.2,1.0}));
557  vb3.add(Box<3,float>({0.5,0.0,0.5},{1.0,0.2,1.0}));
558  vb3.add(Box<3,float>({0.0,0.2,0.5},{0.2,0.5,1.0}));
559  vb3.add(Box<3,float>({0.0,0.5,0.5},{1.0,1.0,1.0}));
560 
561  // Create a writer and write
562  VTKWriter<openfpm::vector<Box<3,float>>,VECTOR_BOX> vtk_box3;
563  vtk_box3.add(vb2);
564  vtk_box3.add(vb3);
565  vtk_box3.write("vtk_box_3D_2.vtk");
566 
567  // Check that match
568  test = compare("vtk_box_3D_2.vtk",c4);
569  BOOST_REQUIRE_EQUAL(test,true);
570 }
571 
577 template<typename grid_type> void fill_grid_some_data(grid_type & g)
578 {
579  typedef Point_test<float> p;
580 
581  auto it = g.getIterator();
582 
583  while (it.isNext())
584  {
585  g.template get<p::x>(it.get()) = it.get().get(0);
586  if (grid_type::dims != 1)
587  {g.template get<p::y>(it.get()) = it.get().get(1);}
588  else
589  {g.template get<p::y>(it.get()) = 0.0;}
590  g.template get<p::z>(it.get()) = 0;
591  g.template get<p::s>(it.get()) = 1.0;
592  g.template get<p::v>(it.get())[0] = g.getGrid().LinId(it.get());
593  g.template get<p::v>(it.get())[1] = g.getGrid().LinId(it.get());
594  g.template get<p::v>(it.get())[2] = g.getGrid().LinId(it.get());
595 
596  g.template get<p::t>(it.get())[0][0] = g.getGrid().LinId(it.get());
597  g.template get<p::t>(it.get())[0][1] = g.getGrid().LinId(it.get());
598  g.template get<p::t>(it.get())[0][2] = g.getGrid().LinId(it.get());
599  g.template get<p::t>(it.get())[1][0] = g.getGrid().LinId(it.get());
600  g.template get<p::t>(it.get())[1][1] = g.getGrid().LinId(it.get());
601  g.template get<p::t>(it.get())[1][2] = g.getGrid().LinId(it.get());
602  g.template get<p::t>(it.get())[2][0] = g.getGrid().LinId(it.get());
603  g.template get<p::t>(it.get())[2][1] = g.getGrid().LinId(it.get());
604  g.template get<p::t>(it.get())[2][2] = g.getGrid().LinId(it.get());
605 
606  ++it;
607  }
608 }
609 
615 void fill_grid_some_data_prp(grid_cpu<2,Point_test_prp<float>> & g)
616 {
617  typedef Point_test<float> p;
618 
619  auto it = g.getIterator();
620 
621  while (it.isNext())
622  {
623  g.template get<p::x>(it.get()) = it.get().get(0);
624  g.template get<p::y>(it.get()) = it.get().get(1);
625  g.template get<p::z>(it.get()) = 0;
626  g.template get<p::s>(it.get()) = 1.0;
627  g.template get<p::v>(it.get())[0] = g.getGrid().LinId(it.get());
628  g.template get<p::v>(it.get())[1] = g.getGrid().LinId(it.get());
629  g.template get<p::v>(it.get())[2] = g.getGrid().LinId(it.get());
630 
631  g.template get<p::t>(it.get())[0][0] = g.getGrid().LinId(it.get());
632  g.template get<p::t>(it.get())[0][1] = g.getGrid().LinId(it.get());
633  g.template get<p::t>(it.get())[0][2] = g.getGrid().LinId(it.get());
634  g.template get<p::t>(it.get())[1][0] = g.getGrid().LinId(it.get());
635  g.template get<p::t>(it.get())[1][1] = g.getGrid().LinId(it.get());
636  g.template get<p::t>(it.get())[1][2] = g.getGrid().LinId(it.get());
637  g.template get<p::t>(it.get())[2][0] = g.getGrid().LinId(it.get());
638  g.template get<p::t>(it.get())[2][1] = g.getGrid().LinId(it.get());
639  g.template get<p::t>(it.get())[2][2] = g.getGrid().LinId(it.get());
640 
641  ++it;
642  }
643 }
644 
649 void fill_grid_some_data_scal(grid_cpu<2,Point_test_scal<float>> & g)
650 {
651  typedef Point_test<float> p;
652 
653  auto it = g.getIterator();
654 
655  while (it.isNext())
656  {
657  g.template get<p::x>(it.get()) = it.get().get(0);
658  g.template get<p::y>(it.get()) = it.get().get(1);
659  g.template get<p::z>(it.get()) = 0;
660  g.template get<p::s>(it.get()) = 1.0;
661 
662  ++it;
663  }
664 }
665 
666 BOOST_AUTO_TEST_CASE( vtk_writer_use_grids)
667 {
668  Vcluster<> & v_cl = create_vcluster();
669 
670  if (v_cl.getProcessUnitID() != 0)
671  {return;}
672 
673  std::string c2 = std::string("test_data/vtk_grids_test_1d.vtk");
674  std::string c3 = std::string("test_data/vtk_grids_test.vtk");
675  std::string c4 = std::string("test_data/vtk_grids_st_test.vtk");
676  std::string c5 = std::string("test_data/vtk_grids_prp_test.vtk");
677  std::string c6 = std::string("test_data/vtk_grids_test.vtk");
678 
679  {
680 
681  // Create box grids
682  Point<1,double> offset1({0.0});
683  Point<1,double> spacing1({0.1});
684  Box<1,size_t> d1({1},{14});
685 
686  // Create box grids
687  Point<1,double> offset2({5.0});
688  Point<1,float> spacing2({0.2});
689  Box<1,size_t> d2({2},{13});
690 
691  // Create box grids
692  Point<1,double> offset3({0.0});
693  Point<1,double> spacing3({0.05});
694  Box<1,size_t> d3({3},{11});
695 
696  // Create box grids
697  Point<1,double> offset4({5.0});
698  Point<1,double> spacing4({0.1});
699  Box<1,size_t> d4({1},{7});
700 
701  size_t sz[] = {16};
703  g1.setMemory();
704  fill_grid_some_data(g1);
706  g2.setMemory();
707  fill_grid_some_data(g2);
709  g3.setMemory();
710  fill_grid_some_data(g3);
712  g4.setMemory();
713  fill_grid_some_data(g4);
714 
715  g4.template get<Point_test<double>::s>(0) = 1.0/3.0;
716 
717  // Create a writer and write
719  vtk_g.add(g1,offset1,spacing1,d1);
720  vtk_g.add(g2,offset2,spacing2,d2);
721  vtk_g.add(g3,offset3,spacing3,d3);
722  vtk_g.add(g4,offset4,spacing4,d4);
723 
725  vtk_g.write("vtk_grids_1d.vtk",prp_names);
726 
727  #ifndef SE_CLASS3
728 
729  // Check that match
730  bool test = compare("vtk_grids_1d.vtk",c2);
731  BOOST_REQUIRE_EQUAL(test,true);
732 
733  #endif
734  }
735 
736  {
737 
738  // Create box grids
739  Point<2,float> offset1({0.0,0.0});
740  Point<2,float> spacing1({0.1,0.2});
741  Box<2,size_t> d1({1,2},{14,15});
742 
743  // Create box grids
744  Point<2,float> offset2({5.0,7.0});
745  Point<2,float> spacing2({0.2,0.1});
746  Box<2,size_t> d2({2,1},{13,15});
747 
748  // Create box grids
749  Point<2,float> offset3({0.0,7.0});
750  Point<2,float> spacing3({0.05,0.07});
751  Box<2,size_t> d3({3,2},{11,10});
752 
753  // Create box grids
754  Point<2,float> offset4({5.0,0.0});
755  Point<2,float> spacing4({0.1,0.1});
756  Box<2,size_t> d4({1,1},{7,7});
757 
758  size_t sz[] = {16,16};
760  g1.setMemory();
761  fill_grid_some_data(g1);
763  g2.setMemory();
764  fill_grid_some_data(g2);
766  g3.setMemory();
767  fill_grid_some_data(g3);
769  g4.setMemory();
770  fill_grid_some_data(g4);
771 
772  // Create a writer and write
774  vtk_g.add(g1,offset1,spacing1,d1);
775  vtk_g.add(g2,offset2,spacing2,d2);
776  vtk_g.add(g3,offset3,spacing3,d3);
777  vtk_g.add(g4,offset4,spacing4,d4);
778 
780  vtk_g.write("vtk_grids.vtk",prp_names);
781 
782  #ifndef SE_CLASS3
783 
784  // Check that match
785  bool test = compare("vtk_grids.vtk",c3);
786  BOOST_REQUIRE_EQUAL(test,true);
787 
788  #endif
789  }
790 
791  {
792  // Create box grids
793  Point<2,float> offset1({0.0,0.0});
794  Point<2,float> spacing1({0.1,0.1});
795  Box<2,size_t> d1({1,2},{14,15});
796 
797  // Create box grids
798  Point<2,float> offset2({0.0,0.0});
799  Point<2,float> spacing2({0.1,0.1});
800  Box<2,size_t> d2({2,1},{13,15});
801 
802  // Create box grids
803  Point<2,float> offset3({5.0,5.0});
804  Point<2,float> spacing3({0.1,0.1});
805  Box<2,size_t> d3({3,2},{11,10});
806 
807  // Create box grids
808  Point<2,float> offset4({5.0,5.0});
809  Point<2,float> spacing4({0.1,0.1});
810  Box<2,size_t> d4({1,1},{7,7});
811 
812  size_t sz[] = {16,16};
814  g1.setMemory();
815  fill_grid_some_data(g1);
817  g2.setMemory();
818  fill_grid_some_data(g2);
820  g3.setMemory();
821  fill_grid_some_data(g3);
823  g4.setMemory();
824  fill_grid_some_data(g4);
825 
826  comb<2> cmb;
827  cmb.zero();
828 
829  comb<2> cmb2;
830  cmb2.mone();
831 
832  // Create a writer and write
833  VTKWriter<boost::mpl::pair<grid_cpu<2,Point_test<float>>,float>,VECTOR_ST_GRIDS> vtk_g;
834  vtk_g.add(0,g1,offset1,spacing1,d1,cmb);
835  vtk_g.add(0,g2,offset2,spacing2,d2,cmb);
836  vtk_g.add(1,g3,offset3,spacing3,d3,cmb);
837  vtk_g.add(1,g4,offset4,spacing4,d4,cmb2);
838 
839  vtk_g.write("vtk_grids_st.vtk");
840 
841  // Check that match
842  bool test = compare("vtk_grids_st.vtk",c4);
843  BOOST_REQUIRE_EQUAL(test,true);
844  }
845 
846  {
847  // Create box grids
848  Point<2,float> offset1({0.0,0.0});
849  Point<2,float> spacing1({0.1,0.1});
850  Box<2,size_t> d1({1,2},{14,15});
851 
852  // Create box grids
853  Point<2,float> offset2({0.0,0.0});
854  Point<2,float> spacing2({0.1,0.1});
855  Box<2,size_t> d2({2,1},{13,15});
856 
857  // Create box grids
858  Point<2,float> offset3({5.0,5.0});
859  Point<2,float> spacing3({0.1,0.1});
860  Box<2,size_t> d3({3,2},{11,10});
861 
862  // Create box grids
863  Point<2,float> offset4({5.0,5.0});
864  Point<2,float> spacing4({0.1,0.1});
865  Box<2,size_t> d4({1,1},{7,7});
866 
867  size_t sz[] = {16,16};
869  g1.setMemory();
870  fill_grid_some_data_scal(g1);
872  g2.setMemory();
873  fill_grid_some_data_scal(g2);
875  g3.setMemory();
876  fill_grid_some_data_scal(g3);
878  g4.setMemory();
879  fill_grid_some_data_scal(g4);
880 
881  // Create a writer and write
883  vtk_g.add(g1,offset1,spacing1,d1);
884  vtk_g.add(g2,offset2,spacing2,d2);
885  vtk_g.add(g3,offset3,spacing3,d3);
886  vtk_g.add(g4,offset4,spacing4,d4);
887 
889  vtk_g.write("vtk_grids_prp.vtk",prp_names);
890 
891  // Check that match
892  bool test = compare("vtk_grids_prp.vtk",c5);
893  BOOST_REQUIRE_EQUAL(test,true);
894  }
895 
896  {
897  // Create box grids
898  Point<2,float> offset1({0.0,0.0});
899  Point<2,float> spacing1({0.1,0.2});
900  Box<2,size_t> d1({1,2},{14,15});
901 
902  // Create box grids
903  Point<2,float> offset2({5.0,7.0});
904  Point<2,float> spacing2({0.2,0.1});
905  Box<2,size_t> d2({2,1},{13,15});
906 
907  // Create box grids
908  Point<2,float> offset3({0.0,7.0});
909  Point<2,float> spacing3({0.05,0.07});
910  Box<2,size_t> d3({3,2},{11,10});
911 
912  // Create box grids
913  Point<2,float> offset4({5.0,0.0});
914  Point<2,float> spacing4({0.1,0.1});
915  Box<2,size_t> d4({1,1},{7,7});
916 
917  size_t sz[] = {16,16};
919  g1.setMemory();
920  fill_grid_some_data(g1);
922  g2.setMemory();
923  fill_grid_some_data(g2);
925  g3.setMemory();
926  fill_grid_some_data(g3);
928  g4.setMemory();
929  fill_grid_some_data(g4);
930 
931  // Create a writer and write
933  vtk_g.add(g1,offset1,spacing1,d1);
934  vtk_g.add(g2,offset2,spacing2,d2);
935  vtk_g.add(g3,offset3,spacing3,d3);
936  vtk_g.add(g4,offset4,spacing4,d4);
937 
939  vtk_g.write("vtk_grids_unk.vtk",prp_names);
940 
941 #ifndef SE_CLASS3
942 
943  // Check that match
944  bool test = compare("vtk_grids_unk.vtk",c6);
945  BOOST_REQUIRE_EQUAL(test,true);
946 
947 #endif
948 
949  }
950 
951  // Try
952 
953  {
954  bool ret = is_vtk_writable<Point<3,float>>::value;
955  BOOST_REQUIRE_EQUAL(ret,true);
956  ret = is_vtk_writable<Point<3,double>>::value;
957  BOOST_REQUIRE_EQUAL(ret,true);
958 
959  int dims = vtk_dims<Point<3,float>>::value;
960  BOOST_REQUIRE_EQUAL(dims,3);
961 
963  BOOST_REQUIRE_EQUAL(dims,1);
964  }
965 
966 }
967 
968 
969 BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set )
970 {
971  Vcluster<> & v_cl = create_vcluster();
972 
973  if (v_cl.getProcessUnitID() != 0)
974  return;
975 
976  std::string c2 = std::string("test_data/vtk_points_test.vtk");
977  std::string c3 = std::string("test_data/vtk_points_pp_test.vtk");
978  std::string c4 = std::string("test_data/vtk_points_pp_header_test.vtk");
979 
980  {
981  // Create 3 vectors with random particles
989 
990  // set the seed
991  // create the random generator engine
992  SimpleRNG rng;
993 
994  // fill the vector with random data
995  v1ps.resize(100);
996  v2ps.resize(100);
997  v3ps.resize(100);
998 
999  v1pp.resize(100);
1000  v2pp.resize(100);
1001  v3pp.resize(100);
1002  v4pp.resize(100);
1003 
1004  for (size_t i = 0 ; i < v1ps.size(); i++)
1005  {
1006  v1ps.template get<0>(i)[0] = rng.GetUniform();
1007  v1ps.template get<0>(i)[1] = rng.GetUniform();
1008  v1ps.template get<0>(i)[2] = rng.GetUniform();
1009 
1010  v2ps.template get<0>(i)[0] = rng.GetUniform()*0.5;
1011  v2ps.template get<0>(i)[1] = rng.GetUniform()*0.5;
1012  v2ps.template get<0>(i)[2] = rng.GetUniform()*0.5;
1013 
1014  v3ps.template get<0>(i)[0] = rng.GetUniform()*0.3;
1015  v3ps.template get<0>(i)[1] = rng.GetUniform()*0.3;
1016  v3ps.template get<0>(i)[2] = rng.GetUniform()*0.3;
1017 
1018  v1pp.template get<0>(i) = rng.GetUniform();
1019  v1pp.template get<1>(i)[0] = rng.GetUniform();
1020  v1pp.template get<1>(i)[1] = rng.GetUniform();
1021  v1pp.template get<1>(i)[2] = rng.GetUniform();
1022 
1023  v2pp.template get<0>(i) = rng.GetUniform();
1024  v2pp.template get<1>(i)[0] = rng.GetUniform();
1025  v2pp.template get<1>(i)[1] = rng.GetUniform();
1026  v2pp.template get<1>(i)[2] = rng.GetUniform();
1027 
1028  v3pp.template get<0>(i) = rng.GetUniform();
1029  v3pp.template get<1>(i)[0] = rng.GetUniform();
1030  v3pp.template get<1>(i)[1] = rng.GetUniform();
1031  v3pp.template get<1>(i)[2] = rng.GetUniform();
1032 
1033  v4pp.template get<0>(i) = rng.GetUniform();
1034  v4pp.template get<1>(i).get(0) = rng.GetUniform();
1035  v4pp.template get<1>(i).get(1) = rng.GetUniform();
1036  v4pp.template get<1>(i).get(2) = rng.GetUniform();
1037  }
1038 
1039  // Create a writer and write
1041  vtk_v.add(v1ps,v1pp,75);
1042  vtk_v.add(v2ps,v2pp,88);
1043  vtk_v.add(v3ps,v3pp,90);
1044 
1045  openfpm::vector<std::string> prp_names;
1046  vtk_v.write("vtk_points.vtp",prp_names);
1047  //auto &v_cl=create_vcluster();
1048  //size_t n=v_cl.size();
1049  vtk_v.write_pvtp("vtk_points",prp_names,2);
1050 
1051 
1052 #ifndef SE_CLASS3
1053 
1054  bool test = true;
1055 
1056  // Check that match
1057  test = compare("vtk_points.vtp","test_data/vtk_points_test.vtp");
1058  BOOST_REQUIRE_EQUAL(test,true);
1059 
1060  //It just checks generation of the format and not actual data (File names)
1061  test = compare("vtk_points.pvtp","test_data/pvtp_points_test.pvtp");
1062  BOOST_REQUIRE_EQUAL(test,true);
1063 
1064 #endif
1065 
1066  // Create a writer and write
1068  vtk_v2.add(v1ps,v4pp,75);
1069 
1070  vtk_v2.write("vtk_points_pp.vtp",prp_names);
1071 
1072 #ifndef SE_CLASS3
1073 
1074  // Check that match
1075  test = compare("vtk_points_pp.vtp","test_data/vtk_points_pp_test.vtp");
1076  BOOST_REQUIRE_EQUAL(test,true);
1077 
1078 #endif
1079 
1080  // Create a writer and write
1082  vtk_v3.add(v1ps,v4pp,75);
1083 
1084  vtk_v3.write("vtk_points_pp_header.vtp",prp_names,"points","time=5.123");
1085 
1086  // We try binary
1087  vtk_v3.write("vtk_points_pp_header_bin.vtp",prp_names,"points","time=5.123",file_type::BINARY);
1088 
1089 #ifndef SE_CLASS3
1090 
1091  // Check that match
1092  test = compare("vtk_points_pp_header.vtp","test_data/vtk_points_pp_header_test.vtp");
1093  BOOST_REQUIRE_EQUAL(test,true);
1094 
1095  test = compare("vtk_points_pp_header_bin.vtp","test_data/vtk_points_pp_header_bin_test.vtp");
1096  BOOST_REQUIRE_EQUAL(test,true);
1097 
1098 #endif
1099 
1100  }
1101 }
1102 
1103 BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set_properties )
1104 {
1105  Vcluster<> & v_cl = create_vcluster();
1106 
1107  if (v_cl.getProcessUnitID() != 0)
1108  return;
1109 
1110  std::string c2 = std::string("test_data/vtk_points_with_prp_names_test.vtk");
1111 
1112  {
1113  // Create 3 vectors with random particles
1116 
1117  // set the seed
1118  // create the random generator engine
1119  SimpleRNG rng;
1120 
1121  // fill the vector with random data
1122  v1ps.resize(100);
1123  v1pp.resize(100);
1124 
1125  for (size_t i = 0 ; i < v1ps.size(); i++)
1126  {
1127  v1ps.template get<0>(i)[0] = rng.GetUniform();
1128  v1ps.template get<0>(i)[1] = rng.GetUniform();
1129  v1ps.template get<0>(i)[2] = rng.GetUniform();
1130 
1131 
1132  v1pp.template get<0>(i) = rng.GetUniform();
1133  v1pp.template get<1>(i)[0] = rng.GetUniform();
1134  v1pp.template get<1>(i)[1] = rng.GetUniform();
1135  v1pp.template get<1>(i)[2] = rng.GetUniform();
1136  }
1137 
1138  openfpm::vector<std::string> prop_names;
1139 
1140  // Create a writer and write adding names to the properties
1142  vtk_v.add(v1ps,v1pp,75);
1143  openfpm::vector<std::string> prp_names({"scalar","vector"});
1144  vtk_v.write("vtk_points_with_prp_names.vtp",prp_names);
1145 
1146 #ifndef SE_CLASS3
1147 
1148  // Check that match
1149  bool test = compare("vtk_points_with_prp_names.vtp","test_data/vtk_points_with_prp_names_test.vtp");
1150  BOOST_REQUIRE_EQUAL(test,true);
1151 
1152 #endif
1153 
1154  }
1155 }
1156 
1157 BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set_check_out_precision )
1158 {
1159  Vcluster<> & v_cl = create_vcluster();
1160 
1161  if (v_cl.getProcessUnitID() != 0)
1162  return;
1163 
1164  std::string c2 = std::string("test_data/vtk_points_with_prp_names_prec_check_test.vtk");
1165 
1166  {
1167  // Create 3 vectors with random particles
1170 
1171  // fill the vector with random data
1172  v1ps.resize(100);
1173  v1pp.resize(100);
1174 
1175  for (size_t i = 0 ; i < v1ps.size(); i++)
1176  {
1177  v1ps.template get<0>(i)[0] = std::numeric_limits<double>::max();
1178  v1ps.template get<0>(i)[1] = std::numeric_limits<double>::max();
1179  v1ps.template get<0>(i)[2] = std::numeric_limits<double>::max();
1180 
1181 
1182  v1pp.template get<0>(i) = std::numeric_limits<float>::max();
1183  v1pp.template get<1>(i)[0] = std::numeric_limits<double>::max();
1184  v1pp.template get<1>(i)[1] = std::numeric_limits<double>::max();
1185  v1pp.template get<1>(i)[2] = std::numeric_limits<double>::max();
1186  }
1187 
1188  openfpm::vector<std::string> prop_names;
1189 
1190  // Create a writer and write adding names to the properties
1192  vtk_v.add(v1ps,v1pp,75);
1193  openfpm::vector<std::string> prp_names({"scalar","vector"});
1194  vtk_v.write("vtk_points_with_prp_names_prec_check.vtp",prp_names);
1195 
1196 #ifndef SE_CLASS3
1197 
1198  // Check that match
1199  bool test = compare("vtk_points_with_prp_names_prec_check.vtp","test_data/vtk_points_with_prp_names_prec_check_test.vtp");
1200  BOOST_REQUIRE_EQUAL(test,true);
1201 
1202 #endif
1203 
1204  }
1205 }
1206 
1207 BOOST_AUTO_TEST_CASE( vtk_writer_use_point_set_binary )
1208 {
1209  Vcluster<> & v_cl = create_vcluster();
1210 
1211  if (v_cl.getProcessUnitID() != 0)
1212  return;
1213 
1214  std::string c2 = std::string("test_data/vtk_points_bin_test.vtk");
1215  std::string c3 = std::string("test_data/vtk_points_pp_bin_test.vtk");
1216  std::string c4 = std::string("test_data/vtk_points_2d_bin_test.vtk");
1217  std::string c5 = std::string("test_data/vtk_points_2d_pp_bin_test.vtk");
1218 
1219  {
1220  // Create 3 vectors with random particles
1228 
1229  // set the seed
1230  // create the random generator engine
1231  SimpleRNG rng;
1232 
1233  // fill the vector with random data
1234  v1ps.resize(100);
1235  v2ps.resize(100);
1236  v3ps.resize(100);
1237 
1238  v1pp.resize(100);
1239  v2pp.resize(100);
1240  v3pp.resize(100);
1241  v4pp.resize(100);
1242 
1243  for (size_t i = 0 ; i < v1ps.size(); i++)
1244  {
1245  v1ps.template get<0>(i)[0] = rng.GetUniform();
1246  v1ps.template get<0>(i)[1] = rng.GetUniform();
1247  v1ps.template get<0>(i)[2] = rng.GetUniform();
1248 
1249  v2ps.template get<0>(i)[0] = rng.GetUniform()*0.5;
1250  v2ps.template get<0>(i)[1] = rng.GetUniform()*0.5;
1251  v2ps.template get<0>(i)[2] = rng.GetUniform()*0.5;
1252 
1253  v3ps.template get<0>(i)[0] = rng.GetUniform()*0.3;
1254  v3ps.template get<0>(i)[1] = rng.GetUniform()*0.3;
1255  v3ps.template get<0>(i)[2] = rng.GetUniform()*0.3;
1256 
1257  v1pp.template get<0>(i) = rng.GetUniform();
1258  v1pp.template get<1>(i)[0] = rng.GetUniform();
1259  v1pp.template get<1>(i)[1] = rng.GetUniform();
1260  v1pp.template get<1>(i)[2] = rng.GetUniform();
1261 
1262  v2pp.template get<0>(i) = rng.GetUniform();
1263  v2pp.template get<1>(i)[0] = rng.GetUniform();
1264  v2pp.template get<1>(i)[1] = rng.GetUniform();
1265  v2pp.template get<1>(i)[2] = rng.GetUniform();
1266 
1267  v3pp.template get<0>(i) = rng.GetUniform();
1268  v3pp.template get<1>(i)[0] = rng.GetUniform();
1269  v3pp.template get<1>(i)[1] = rng.GetUniform();
1270  v3pp.template get<1>(i)[2] = rng.GetUniform();
1271 
1272  v4pp.template get<0>(i) = rng.GetUniform();
1273  v4pp.template get<1>(i).get(0) = rng.GetUniform();
1274  v4pp.template get<1>(i).get(1) = rng.GetUniform();
1275  v4pp.template get<1>(i).get(2) = rng.GetUniform();
1276  }
1277 
1278  // Create a writer and write
1280  vtk_v.add(v1ps,v1pp,75);
1281  vtk_v.add(v2ps,v2pp,88);
1282  vtk_v.add(v3ps,v3pp,90);
1283 
1284  openfpm::vector<std::string> prp_names;
1285  vtk_v.write("vtk_points_bin.vtp",prp_names,"vtk output","",file_type::BINARY);
1286  vtk_v.write("vtk_points_bin2.vtp",prp_names,"vtk output","",file_type::BINARY);
1287 
1288 #ifndef SE_CLASS3
1289 
1290  bool test = true;
1291 
1292  // Check that match
1293  test = compare("vtk_points_bin.vtp","test_data/vtk_points_bin_test.vtp");
1294  BOOST_REQUIRE_EQUAL(test,true);
1295  test = compare("vtk_points_bin2.vtp","test_data/vtk_points_bin_test.vtp");
1296  BOOST_REQUIRE_EQUAL(test,true);
1297 
1298 #endif
1299 
1300  // Create a writer and write
1302  vtk_v2.add(v1ps,v4pp,75);
1303 
1304  vtk_v2.write("vtk_points_pp_bin.vtp",prp_names,"vtk output","",file_type::BINARY);
1305 
1306 #ifndef SE_CLASS3
1307 
1308  // Check that match
1309  test = compare("vtk_points_pp_bin.vtp","test_data/vtk_points_pp_bin_test.vtp");
1310  BOOST_REQUIRE_EQUAL(test,true);
1311 
1312 #endif
1313 
1314  }
1315 
1316 
1317  {
1318  // Create 3 vectors with random particles
1326 
1327  // set the seed
1328  // create the random generator engine
1329  SimpleRNG rng;
1330 
1331  // fill the vector with random data
1332  v1ps.resize(100);
1333  v2ps.resize(100);
1334  v3ps.resize(100);
1335 
1336  v1pp.resize(100);
1337  v2pp.resize(100);
1338  v3pp.resize(100);
1339  v4pp.resize(100);
1340 
1341  for (size_t i = 0 ; i < v1ps.size(); i++)
1342  {
1343  v1ps.template get<0>(i)[0] = rng.GetUniform();
1344  v1ps.template get<0>(i)[1] = rng.GetUniform();
1345 
1346  v2ps.template get<0>(i)[0] = rng.GetUniform()*0.5;
1347  v2ps.template get<0>(i)[1] = rng.GetUniform()*0.5;
1348 
1349  v3ps.template get<0>(i)[0] = rng.GetUniform()*0.3;
1350  v3ps.template get<0>(i)[1] = rng.GetUniform()*0.3;
1351 
1352  v1pp.template get<0>(i) = rng.GetUniform();
1353  v1pp.template get<1>(i)[0][0] = rng.GetUniform();
1354  v1pp.template get<1>(i)[0][1] = rng.GetUniform();
1355  v1pp.template get<1>(i)[0][2] = rng.GetUniform();
1356  v1pp.template get<1>(i)[1][0] = rng.GetUniform();
1357  v1pp.template get<1>(i)[1][1] = rng.GetUniform();
1358  v1pp.template get<1>(i)[1][2] = rng.GetUniform();
1359  v1pp.template get<1>(i)[2][0] = rng.GetUniform();
1360  v1pp.template get<1>(i)[2][1] = rng.GetUniform();
1361  v1pp.template get<1>(i)[2][2] = rng.GetUniform();
1362 
1363  v2pp.template get<0>(i) = rng.GetUniform();
1364  v2pp.template get<1>(i)[0][0] = rng.GetUniform();
1365  v2pp.template get<1>(i)[0][1] = rng.GetUniform();
1366  v2pp.template get<1>(i)[0][2] = rng.GetUniform();
1367  v2pp.template get<1>(i)[1][0] = rng.GetUniform();
1368  v2pp.template get<1>(i)[1][1] = rng.GetUniform();
1369  v2pp.template get<1>(i)[1][2] = rng.GetUniform();
1370  v2pp.template get<1>(i)[2][0] = rng.GetUniform();
1371  v2pp.template get<1>(i)[2][1] = rng.GetUniform();
1372  v2pp.template get<1>(i)[2][2] = rng.GetUniform();
1373 
1374  v3pp.template get<0>(i) = rng.GetUniform();
1375  v3pp.template get<1>(i)[0][0] = rng.GetUniform();
1376  v3pp.template get<1>(i)[0][1] = rng.GetUniform();
1377  v3pp.template get<1>(i)[0][2] = rng.GetUniform();
1378  v3pp.template get<1>(i)[1][0] = rng.GetUniform();
1379  v3pp.template get<1>(i)[1][1] = rng.GetUniform();
1380  v3pp.template get<1>(i)[1][2] = rng.GetUniform();
1381  v3pp.template get<1>(i)[2][0] = rng.GetUniform();
1382  v3pp.template get<1>(i)[2][1] = rng.GetUniform();
1383  v3pp.template get<1>(i)[2][2] = rng.GetUniform();
1384 
1385  v4pp.template get<0>(i)[0] = rng.GetUniform();
1386  v4pp.template get<0>(i)[1] = rng.GetUniform();
1387  v4pp.template get<0>(i)[2] = rng.GetUniform();
1388  v4pp.template get<1>(i)[0] = rng.GetUniform();
1389  v4pp.template get<1>(i)[1] = rng.GetUniform();
1390  }
1391 
1392  // Create a writer and write
1394  vtk_v.add(v1ps,v1pp,75);
1395  vtk_v.add(v2ps,v2pp,88);
1396  vtk_v.add(v3ps,v3pp,90);
1397 
1399 
1400  vtk_v.write("vtk_points_2d_bin.vtp",stub,"vtk output","",file_type::BINARY);
1401 
1402 #ifndef SE_CLASS3
1403 
1404  bool test = true;
1405 
1406  // Check that match
1407  test = compare("vtk_points_2d_bin.vtp","test_data/vtk_points_2d_bin_test.vtp");
1408  BOOST_REQUIRE_EQUAL(test,true);
1409 
1410 #endif
1411 
1412  // Create a writer and write
1414  vtk_v2.add(v1ps,v4pp,75);
1415 
1416  vtk_v2.write("vtk_points_2d_pp_bin.vtp",stub,"vtk output","",file_type::BINARY);
1417 
1418 #ifndef SE_CLASS3
1419 
1420  // Check that match
1421  test = compare("vtk_points_2d_pp_bin.vtp","test_data/vtk_points_2d_pp_bin_test.vtp");
1422  BOOST_REQUIRE_EQUAL(test,true);
1423 
1424 #endif
1425  }
1426 }
1427 
1428 BOOST_AUTO_TEST_SUITE_END()
1429 
1430 #endif /* VTKWRITER_UNIT_TESTS_HPP_ */
This class represent an N-dimensional box.
Definition: Box.hpp:60
Structure that store a graph in CSR format or basically in compressed adjacency matrix format.
Definition: map_graph.hpp:305
void addVertex(const V &vrt)
add vertex
Definition: map_graph.hpp:860
auto addEdge(size_t v1, size_t v2, const E &ed) -> decltype(e.get(0))
add edge on the graph
Definition: map_graph.hpp:900
Test structure used for several test.
Definition: Point_test.hpp:415
point test with only scalar properties
Definition: Point_test.hpp:568
Test structure used for several test.
Definition: Point_test.hpp:106
This class implement the point shape in an N-dimensional space.
Definition: Point.hpp:28
SimpleRNG is a simple random number generator based on George Marsaglia's MWC (multiply with carry) g...
Definition: SimpleRNG.hpp:19
size_t getProcessUnitID()
Get the process unit id.
Implementation of VCluster class.
Definition: VCluster.hpp:59
This is a distributed grid.
auto get(const grid_dist_key_dx< dim, bg_key > &v1) const -> typename std::add_lvalue_reference< decltype(loc_grid.get(v1.getSub()).template get< p >(v1.getKey()))>::type
Get the reference of the selected element.
static const unsigned int dims
Number of dimensions.
Implementation of 1-D std::vector like structure.
Definition: map_vector.hpp:204
size_t size()
Stub size.
Definition: map_vector.hpp:212
Position of the element of dimension d in the hyper-cube of dimension dim.
Definition: comb.hpp:35
void mone()
Set all the elements to -1.
Definition: comb.hpp:95
void zero()
Set all the elements to zero.
Definition: comb.hpp:83
check for T to be writable
static const unsigned int x
computation property id in boost::fusion::vector
vertex2(float x, float y, float z)
Initialize the VTKVertex.
boost::fusion::vector< float[3], size_t, double > type
The node contain 3 unsigned long integer for communication computation memory and id.
static const unsigned int max_prop
total number of properties boost::fusion::vector
float s_type
type of the positional field
type data
The data.
float s_type
type of the positional field
boost::fusion::vector< float[2], size_t, double > type
The node contain 3 unsigned long integer for communication computation memory and id.
vertex3(float x, float y)
Initialize the VTKVertex.
static const unsigned int x
computation property id in boost::fusion::vector
type data
The data.
static const unsigned int max_prop
total number of properties boost::fusion::vector
Sub-domain vertex graph node.
boost::fusion::vector< float, float, float, float, size_t, double, unsigned char, long int > type
The node contain 3 unsigned long integer for communication computation memory and id.
float s_type
type of the positional field
type data
The data.
vertex(float x, float y, float z)
Initialize the VTKVertex.
If it has not dims property defined the object is considered scalar.