OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
VTKWriter_dist_graph.hpp
1/*
2 * VTKWriter_graph.hpp
3 *
4 * Created on: May 5, 2015
5 * Author: Pietro Incardona
6 */
7
8#ifndef VTKWRITER_DIST_GRAPH_HPP_
9#define VTKWRITER_DIST_GRAPH_HPP_
10
11#include "VCluster/VCluster.hpp"
12
16template<bool is_array>
18{
30 template<typename T, typename ele_v, typename G, typename s_type>
31 static inline void move(typename G::V_container &vo, s_type (&x)[3], bool &z_set)
32 {
33 if (G::V_type::attributes::name[T::value] == "x")
34 {
35 x[0] = convert<typename boost::remove_reference<decltype(vo.template get<T::value>())>::type>::template to<s_type>(vo.template get<T::value>());
36 }
37 else if (G::V_type::attributes::name[T::value] == "y")
38 {
39 x[1] = convert<typename boost::remove_reference<decltype(vo.template get<T::value>())>::type>::template to<s_type>(vo.template get<T::value>());
40 }
41 else if (G::V_type::attributes::name[T::value] == "z")
42 {
43 x[2] = convert<typename boost::remove_reference<decltype(vo.template get<T::value>())>::type>::template to<s_type>(vo.template get<T::value>());
44 z_set = true;
45 }
46 }
47};
48
52template<>
54{
66 template<typename T, typename ele_v, typename G, typename s_type>
67 static inline void move(typename G::V_container &vo, s_type (&x)[3], bool &z_set)
68 {
69 if (std::extent<ele_v>::value == 3)
70 z_set = true;
71
72 for (size_t i = 0; i < std::extent<ele_v>::value; i++)
73 x[i] = convert<typename boost::remove_reference<decltype(vo.template get<T::value>()[i])>::type>::template to<s_type>(vo.template get<T::value>()[i]);
74
75 }
76};
77
90template<typename G, bool attr>
92{
94 typedef typename G::V_type::s_type s_type;
95
97 bool z_set;
98
100 s_type (&x)[3];
101
103 typename G::V_container & vo;
104
106 std::string & v_node;
107
117 vtk_dist_vertex_node(std::string & v_node, typename G::V_container & n_obj, s_type (&x)[3])
118 :z_set(false),x(x), vo(n_obj), v_node(v_node)
119 {
120 }
121
123 void write()
124 {
125 v_node += std::to_string(x[0]) + " " + std::to_string(x[1]) + " " + std::to_string(x[2]) + "\n";
126 }
127
133 template<typename T>
134 void operator()(T& t)
135 {
136 typedef typename boost::mpl::at<typename G::V_type::type, boost::mpl::int_<T::value>>::type ele_v;
137
138 // if the attribute name is x y or z, create a string with the value of the properties and store it
139
141
142 }
143};
144
158template<typename G>
159struct vtk_dist_vertex_node<G, false>
160{
162 typename G::V_container & vo;
163
165 std::string & v_node;
166
175 vtk_dist_vertex_node(std::string & v_node, typename G::V_container & n_obj) :
176 vo(n_obj), v_node(v_node)
177 {
178 }
179
185 template<typename T>
186 void operator()(T& t)
187 {
188 v_node += "0 0 0\n";
189 }
190};
191
201template<typename G>
203{
205 typename G::E_container & vo;
206
208 std::string & e_node;
209
218 vtk_dist_edge_node(std::string & e_node, typename G::E_container & n_obj)
219 :vo(n_obj), e_node(e_node)
220 {
221 }
222
230 void new_node(size_t vc, size_t s, size_t d)
231 {
232 // start a new node
233 e_node += "2 " + std::to_string(s) + " " + std::to_string(d) + "\n";
234 }
235};
236
240template<bool is_array>
242{
253 template<typename ele_v, typename Graph, unsigned int i>
254 static inline void write(std::string &v_out, const Graph &g, size_t p)
255 {
256 v_out += std::to_string(g.vertex(p).template get<i>()) + "\n";
257 }
258};
259
263template<>
265{
276 template<typename ele_v, typename Graph, unsigned int i>
277 static inline void write(std::string &v_out, const Graph &g, size_t p)
278 {
279 for (size_t j = 0; j < 2; j++)
280 {
281 v_out += std::to_string(g.vertex(p).template get<i>()[j]) + " ";
282 }
283
284 if (std::extent<ele_v>::value == 2)
285 v_out += "0";
286 else
287 v_out += std::to_string(g.vertex(p).template get<i>()[2]);
288
289 v_out += "\n";
290 }
291};
292
296template<bool is_array>
298{
309 template<typename ele_v, typename Graph, unsigned int i>
310 static inline void write(std::string &v_out, const Graph &g, const typename Graph::E_container &edge)
311 {
312 v_out += std::to_string(edge.template get<i>()) + "\n";
313 }
314};
315
319template<>
321{
332 template<typename ele_v, typename Graph, unsigned int i>
333 static inline void write(std::string &v_out, const Graph &g, const typename Graph::E_container &edge)
334 {
335 for (size_t j = 0; j < 2; j++)
336 {
337 v_out += std::to_string(edge.template get<i>()[j]) + " ";
338 }
339
340 if (std::extent<ele_v>::value == 2)
341 v_out += "0";
342 else
343 v_out += std::to_string(edge.template get<i>()[2]);
344
345 v_out += "\n";
346 }
347};
348
352template<bool is_array>
354{
359 static inline void write(std::string &v_out)
360 {
361 v_out += "0\n";
362 }
363};
364
368template<>
370{
375 static inline void write(std::string &v_out)
376 {
377 v_out += "0 0 0\n";
378 }
379};
380
395template<bool has_attributes, typename Graph, unsigned int i>
397{
398public:
399
408 static std::string get_point_data(const Graph & g)
409 {
411 std::string v_out;
412
414 auto it = g.getVertexIterator();
415
416 // if there is the next element
417 while (it.isNext())
418 {
419 typedef typename boost::mpl::at<typename Graph::V_type::type, boost::mpl::int_<i>>::type ele_v;
420 dist_prop_output_array_scalar_selector_vertex<std::is_array<ele_v>::value>::template write<ele_v, Graph, i>(v_out, g, it.get());
421
422 // increment the iterator and counter
423 ++it;
424 }
425
426 return v_out;
427 }
428
437 static std::string get_cell_data(const Graph & g)
438 {
440 std::string e_out;
441
443 auto it_v = g.getVertexIterator();
444
445 // if there is the next element
446 while (it_v.isNext())
447 {
448 // Print the property
449 typedef typename boost::mpl::at<typename Graph::E_type::type, boost::mpl::int_<i>>::type ele_v;
451
452 // increment the iterator and counter
453 ++it_v;
454 }
455
457 auto it_e = g.getEdgeIterator();
458
459 // if there is the next element
460 while (it_e.isNext())
461 {
462 typedef typename boost::mpl::at<typename Graph::E_type::type, boost::mpl::int_<i>>::type ele_v;
463 dist_prop_output_array_scalar_selector_edge<std::is_array<ele_v>::value>::template write<ele_v, Graph, i>(e_out, g, g.edge(it_e.get()));
464
465 // increment the iterator and counter
466 ++it_e;
467 }
468
469 return e_out;
470 }
471
479 static std::string get_point_property_header(size_t prop)
480 {
482 std::string v_out;
483
484 // Type of the property
485 std::string type;
486
487 typedef typename boost::mpl::at<typename Graph::V_type::type, boost::mpl::int_<i>>::type T;
488
489 // Check if T is a supported format
490 // for now we support only scalar of native type
491 if (std::is_array<T>::value == true && std::is_array<typename std::remove_extent<T>::type>::value == false)
492 {
493 //Get type of the property
494 type = getType<typename std::remove_all_extents<T>::type>();
495
496 // if the type is not supported return
497 if (type.size() == 0)
498 return v_out;
499
500 // Create point data properties
501 v_out += "VECTORS " + get_attributes_vertex() + " " + type + "\n";
502 }
503 else
504 {
505 type = getType<T>();
506
507 // if the type is not supported return
508 if (type.size() == 0)
509 return v_out;
510
511 // Create point data properties
512 v_out += "SCALARS " + get_attributes_vertex() + " " + type + "\n";
513
514 // Default lookup table
515 v_out += "LOOKUP_TABLE default\n";
516
517 }
518
519 // return the vertex list
520 return v_out;
521 }
522
530 static std::string get_cell_property_header(size_t prop)
531 {
533 std::string e_out;
534
535 // Type of the property
536 std::string type;
537
538 typedef typename boost::mpl::at<typename Graph::E_type::type, boost::mpl::int_<i>>::type T;
539
540 // Check if T is a supported format
541 // for now we support only scalar of native type
542 if (std::is_array<T>::value == true && std::is_array<typename std::remove_extent<T>::type>::value == false)
543 {
544 //Get type of the property
545 type = getType<typename std::remove_all_extents<T>::type>();
546
547 // if the type is not supported return
548 if (type.size() == 0)
549 return e_out;
550
551 // Create point data properties
552 e_out += "VECTORS " + get_attributes_edge() + " " + type + "\n";
553 }
554 else
555 {
556 type = getType<T>();
557
558 // if the type is not supported return
559 if (type.size() == 0)
560 return e_out;
561
562 // Create point data properties
563 e_out += "SCALARS " + get_attributes_edge() + " " + type + "\n";
564
565 // Default lookup table
566 e_out += "LOOKUP_TABLE default\n";
567
568 }
569
570 // return the vertex list
571 return e_out;
572 }
573
579 static std::string get_attributes_vertex()
580 {
581 return Graph::V_type::attributes::name[i];
582 }
583
589 static std::string get_attributes_edge()
590 {
591 return Graph::E_type::attributes::name[i];
592 }
593};
594
608template<typename Graph, unsigned int i>
609class dist_prop_output<false, Graph, i>
610{
618 static std::string get_point_data(Graph & g)
619 {
621 std::string v_out;
622
624 auto it = g.getVertexIterator();
625
626 // if there is the next element
627 while (it.isNext())
628 {
629 // Print the property
630 v_out += std::to_string(g.vertex(it.get()).template get<i>()) + "\n";
631
632 // increment the iterator and counter
633 ++it;
634 }
635
636 return v_out;
637 }
638
646 static std::string get_cell_data(const Graph & g)
647 {
649 std::string e_out;
650
652 auto it_v = g.getVertexIterator();
653
654 // if there is the next element
655 while (it_v.isNext())
656 {
657 // Print the property
658 e_out += std::to_string(0) + "\n";
659
660 // increment the iterator and counter
661 ++it_v;
662 }
663
665 auto it_e = g.getEdgeIterator();
666
667 // if there is the next element
668 while (it_e.isNext())
669 {
670 // Print the property
671 e_out += std::to_string(g.edge(it_e.get()).template get<i>()) + "\n";
672
673 // increment the iterator and counter
674 ++it_e;
675 }
676
677 return e_out;
678 }
679
687 static std::string get_point_property_header(size_t prop)
688 {
690 std::string v_out;
691
692 // Check if T is a supported format
693 // for now we support only scalar of native type
694
695 std::string type = getType<boost::fusion::result_of::at<typename Graph::V_type::type, boost::mpl::int_<i>>>("attr" + std::to_string(prop));
696
697 // if the type is not supported return
698 if (type.size() == 0)
699 {
700 return v_out;
701 }
702
703 // Create point data properties
704 v_out += "SCALARS " + get_attributes_vertex() + " " + type + "\n";
705
706 // Default lookup table
707 v_out += "LOOKUP_TABLE default\n";
708
709 // return the vertex list
710 return v_out;
711 }
712
720 static std::string get_cell_property_header(size_t prop)
721 {
723 std::string e_out;
724
725 // Type of the property
726 std::string type;
727
728 typedef typename boost::mpl::at<typename Graph::E_type::type, boost::mpl::int_<i>>::type T;
729
730 // Check if T is a supported format
731 // for now we support only scalar of native type
732 if (std::is_array<T>::value == true && std::is_array<typename std::remove_extent<T>::type>::value == false)
733 {
734 //Get type of the property
735 type = getType<typename std::remove_all_extents<T>::type>();
736
737 // if the type is not supported return
738 if (type.size() == 0)
739 return e_out;
740
741 // Create point data properties
742 e_out += "VECTORS " + get_attributes_edge() + " " + type + "\n";
743 }
744 else
745 {
746 type = getType<T>();
747
748 // if the type is not supported return
749 if (type.size() == 0)
750 return e_out;
751
752 // Create point data properties
753 e_out += "SCALARS " + get_attributes_edge() + " " + type + "\n";
754
755 // Default lookup table
756 e_out += "LOOKUP_TABLE default\n";
757
758 }
759
760 // return the vertex list
761 return e_out;
762 }
763
769 static std::string get_attributes_vertex()
770 {
771 return Graph::V_type::attributes::name[i];
772 }
773
779 static std::string get_attributes_edge()
780 {
781 return Graph::E_type::attributes::name[i];
782 }
783};
784
798template<typename Graph>
800{
802 std::string & v_out;
803
805 const Graph & g;
806
813 dist_prop_out_vertex(std::string & v_out, const Graph & g)
814 :v_out(v_out), g(g)
815 {
816 }
817
823 template<typename T>
824 void operator()(T& t) const
825 {
826 // actual string size
827 size_t sz = v_out.size();
828
829 // Produce the point properties header
830 v_out += dist_prop_output<has_attributes<typename Graph::V_type>::value, Graph, T::value>::get_point_property_header(t);
831
832 // If the output has changed, we have to write the properties
833 if (v_out.size() != sz)
834 {
835 std::string attr = dist_prop_output<has_attributes<typename Graph::V_type>::value, Graph, T::value>::get_attributes_vertex();
836
837 // Produce point data
838 v_out += dist_prop_output<has_attributes<typename Graph::V_type>::value, Graph, T::value>::get_point_data(g);
839 }
840 }
841};
842
856template<typename Graph>
858{
860 std::string & e_out;
861
863 const Graph & g;
864
871 dist_prop_out_edge(std::string & e_out, const Graph & g) :
872 e_out(e_out), g(g)
873 {};
874
880 template<typename T>
881 void operator()(T& t) const
882 {
883 // actual string size
884 size_t sz = e_out.size();
885
886 // Produce the point properties header
887 e_out += dist_prop_output<has_attributes<typename Graph::E_type>::value, Graph, T::value>::get_cell_property_header(t);
888
889 // If the output has changed, we have to write the properties
890 if (e_out.size() != sz)
891 {
892 std::string attr = dist_prop_output<has_attributes<typename Graph::E_type>::value, Graph, T::value>::get_attributes_edge();
893
894 // Produce cell data
896 }
897 }
898};
899
908template<typename Graph>
909class VTKWriter<Graph, DIST_GRAPH>
910{
912 Graph & g;
913
923 {
925 std::string v_out;
926
927 // write the number of vertex
928 v_out += "VERTICES " + std::to_string(g.getNVertex()) + " " + std::to_string(g.getNVertex() * 2) + "\n";
929
930 // return the vertex properties string
931 return v_out;
932 }
933
943 {
945 std::string v_out;
946
947 // write the number of vertex
948 v_out += "POINTS " + std::to_string(g.getNVertex()) + " float" + "\n";
949
950 // return the vertex properties string
951 return v_out;
952 }
953
959 std::string get_point_info()
960 {
962 std::string v_out;
963
964 // write the ids
965 v_out += "SCALARS id unsigned_long\nLOOKUP_TABLE default\n";
966
967 for (size_t i = 0; i < g.getNVertex(); ++i)
968 {
969 v_out += std::to_string(g.getVertexId(i)) + "\n";
970 }
971
972 // write the ids
973 v_out += "SCALARS gid unsigned_long\nLOOKUP_TABLE default\n";
974
975 for (size_t i = 0; i < g.getNVertex(); ++i)
976 {
977 v_out += std::to_string(g.getVertexGlobalId(i)) + "\n";
978 }
979
980 // return the vertex properties string
981 return v_out;
982 }
983
993 {
995 std::string e_out;
996
997 // write the number of lines
998 e_out += "LINES " + std::to_string(g.getNEdge()) + " " + std::to_string(3 * g.getNEdge()) + "\n";
999
1000 // return the vertex properties string
1001 return e_out;
1002 }
1003
1012 template<bool attr> std::string get_point_list()
1013 {
1015 typename Graph::V_type::s_type x[3] = { 0, 0, 0 };
1016
1018 std::string v_out;
1019
1021 auto it = g.getVertexIterator();
1022
1023 // if there is the next element
1024 while (it.isNext())
1025 {
1026 // Get vtk vertex node
1027 auto obj = g.vertex(it.get());
1028
1029 // create a vertex list functor
1030 vtk_dist_vertex_node<Graph, attr> vn(v_out, obj, x);
1031
1032 // Iterate through all the vertex and create the vertex list
1033 boost::mpl::for_each<boost::mpl::range_c<int, 0, Graph::V_type::max_prop> >(vn);
1034
1035 // write the node string
1036 vn.write();
1037
1038 // increment the iterator and counter
1039 ++it;
1040 }
1041
1042 // return the vertex list
1043 return v_out;
1044 }
1045
1053 std::string get_vertex_list()
1054 {
1056 std::string v_out;
1057
1059 for (size_t i = 0; i < g.getNVertex(); i++)
1060 {
1061 v_out += "1 " + std::to_string(i) + "\n";
1062 }
1063
1064 // return the vertex list
1065 return v_out;
1066 }
1067
1075 {
1076 std::string v_out;
1077
1078 v_out += "POINT_DATA " + std::to_string(g.getNVertex()) + "\n";
1079
1080 return v_out;
1081 }
1082
1090 {
1091 std::string v_out;
1092
1093 v_out += "CELL_DATA " + std::to_string(g.getNVertex() + g.getNEdge()) + "\n";
1094
1095 return v_out;
1096 }
1097
1104 std::string get_edge_list()
1105 {
1107 std::string e_out;
1108
1110 auto it = g.getEdgeIterator();
1111
1112 // if there is the next element
1113 while (it.isNext())
1114 {
1115 e_out += "2 " + std::to_string(it.source()) + " " + std::to_string(g.nodeById(it.target())) + "\n";
1116
1117 // increment the operator
1118 ++it;
1119 }
1120
1121 // return the edge list
1122 return e_out;
1123 }
1124
1125public:
1126
1134 VTKWriter(Graph & g) :
1135 g(g)
1136 {
1137 }
1138
1150 template<int prp = -1> bool write(std::string file, std::string graph_name = "Graph", file_type ft = file_type::ASCII)
1151 {
1152
1153 Vcluster<> & v_cl = create_vcluster();
1154
1155 g.deleteGhosts();
1156
1157 if (v_cl.getProcessUnitID() == 0)
1158 {
1159 for (size_t i = 0; i < g.getTotNVertex(); ++i)
1160 {
1161 g.reqVertex(i);
1162 }
1163 }
1164
1165 g.sync();
1166
1167 if (v_cl.getProcessUnitID() == 0)
1168 {
1169 // Check that the Vertex type define x y and z attributes
1170
1172 {
1173 std::cerr << "Error writing a graph: Vertex must has defines x,y,z properties" << "\n";
1174 return false;
1175 }
1176
1177 // Header for the vtk
1178 std::string vtk_header;
1179 // Point list of the VTK
1180 std::string point_list;
1181 // Vertex list of the VTK
1182 std::string vertex_list;
1183 // Graph header
1184 std::string vtk_binary_or_ascii;
1185 // Edge list of the GraphML
1186 std::string edge_list;
1187 // vertex properties header
1188 std::string point_prop_header;
1189 // edge properties header
1190 std::string vertex_prop_header;
1191 // edge properties header
1192 std::string edge_prop_header;
1193 // Data point header
1194 std::string point_data_header;
1195 // Ids point
1196 std::string point_ids;
1197 // Data point
1198 std::string point_data;
1199 // Cell data header
1200 std::string cell_data_header;
1201 // Cell data
1202 std::string cell_data;
1203
1204 // VTK header
1205 vtk_header = "# vtk DataFile Version 3.0\n" + graph_name + "\n";
1206
1207 // Choose if binary or ASCII
1208 if (ft == file_type::ASCII)
1209 {
1210 vtk_header += "ASCII\n";
1211 }
1212 else
1213 {
1214 vtk_header += "BINARY\n";
1215 }
1216
1217 // Data type for graph is DATASET POLYDATA
1218 vtk_header += "DATASET POLYDATA\n";
1219
1220 // point properties header
1221 point_prop_header = get_point_properties_list();
1222
1223 // Get point list
1224 point_list = get_point_list<has_attributes<typename Graph::V_type>::value>();
1225
1226 // vertex properties header
1227 vertex_prop_header = get_vertex_properties_list();
1228
1229 // Get vertex list
1230 vertex_list = get_vertex_list();
1231
1232 // Edge properties header
1233 edge_prop_header = get_edge_properties_list();
1234
1235 // Get the edge graph list
1236 edge_list = get_edge_list();
1237
1238 // Get the point data header
1239 point_data_header = get_point_data_header();
1240
1241 // Get the point info
1242 point_ids = get_point_info();
1243
1244 // Get the cell data header
1245 cell_data_header = get_cell_data_header();
1246
1247 // For each property in the vertex type produce a point data
1248
1249 dist_prop_out_vertex<Graph> pp(point_data, g);
1250
1251 if (prp == -1)
1252 boost::mpl::for_each<boost::mpl::range_c<int, 0, Graph::V_type::max_prop> >(pp);
1253 else
1254 boost::mpl::for_each<boost::mpl::range_c<int, prp, prp> >(pp);
1255
1256 // For each property in the edge type produce a point data
1257
1258 dist_prop_out_edge<Graph> ep(cell_data, g);
1259
1260 if (prp == -1)
1261 boost::mpl::for_each<boost::mpl::range_c<int, 0, Graph::E_type::max_prop> >(ep);
1262 else
1263 boost::mpl::for_each<boost::mpl::range_c<int, prp, prp> >(ep);
1264
1265 // write the file
1266 std::ofstream ofs(file);
1267
1268 // Check if the file is open
1269 if (ofs.is_open() == false)
1270 {
1271 std::cerr << "Error cannot create the VTK file: " + file;
1272 }
1273
1274 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;
1275
1276 // Close the file
1277
1278 ofs.close();
1279
1280 }
1281
1282 g.deleteGhosts();
1283
1284 // Completed succefully
1285 return true;
1286 }
1287};
1288
1289#endif /* VTKWRITER_GRAPH_HPP_ */
std::string get_vertex_list()
Create the VTK vertex definition.
std::string get_cell_data_header()
Get the point data header.
std::string get_vertex_properties_list()
It get the vertex properties list.
std::string get_edge_list()
Return the edge list.
bool write(std::string file, std::string graph_name="Graph", file_type ft=file_type::ASCII)
It write a VTK file from a graph.
std::string get_edge_properties_list()
It get the edge properties list.
std::string get_point_properties_list()
It get the vertex properties list.
std::string get_point_info()
Get the VTK point info string.
std::string get_point_list()
Create the VTK point definition.
std::string get_point_data_header()
Get the point data header.
size_t getProcessUnitID()
Get the process unit id.
Implementation of VCluster class.
Definition VCluster.hpp:59
Set a conversion map between A and B.
static std::string get_point_data(Graph &g)
For each vertex output the property string.
static std::string get_attributes_vertex()
Get the attributes name for vertex.
static std::string get_cell_data(const Graph &g)
For each edge output the property string.
static std::string get_point_property_header(size_t prop)
Given a Graph return the point data header for a typename T.
static std::string get_cell_property_header(size_t prop)
Given a Graph return the cell data header for a typename T.
static std::string get_attributes_edge()
Get the attributes name for edge.
This class specialize functions in the case the type T has or not defined attributes.
static std::string get_cell_property_header(size_t prop)
Given a Graph return the cell data header for a typename T.
static std::string get_point_data(const Graph &g)
For each vertex set the value.
static std::string get_attributes_edge()
Get the attributes name for edge.
static std::string get_cell_data(const Graph &g)
For each edge set the value, set 1 on vertices, needed by vtk file format.
static std::string get_attributes_vertex()
Get the attributes name for vertex.
static std::string get_point_property_header(size_t prop)
Given a Graph return the point data header for a typename T.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
this class is a functor for "for_each" algorithm
const Graph & g
Graph that we are processing.
std::string & e_out
property output string
dist_prop_out_edge(std::string &e_out, const Graph &g)
constructor
void operator()(T &t) const
It produce an output for each property.
this class is a functor for "for_each" algorithm
dist_prop_out_vertex(std::string &v_out, const Graph &g)
constructor
const Graph & g
Graph that we are processing.
std::string & v_out
property output string
void operator()(T &t) const
It produce an output for each property.
static void write(std::string &v_out, const Graph &g, const typename Graph::E_container &edge)
Writer in case the property is an array.
static void write(std::string &v_out)
Writer in case the property is an array.
Property writer for scalar and vector, it fill the vertex data (needed for edge representation in vtk...
static void write(std::string &v_out)
Writer in case the property is not an array.
Property writer for scalar and vector.
static void write(std::string &v_out, const Graph &g, const typename Graph::E_container &edge)
Writer in case the property is not an array.
static void write(std::string &v_out, const Graph &g, size_t p)
Writer in case the property is an array.
Property writer for scalar and vector.
static void write(std::string &v_out, const Graph &g, size_t p)
Writer in case the property is not an array.
Sub-domain vertex graph node.
this class is a functor for "for_each" algorithm
G::E_container & vo
Vertex object container.
vtk_dist_edge_node(std::string &e_node, typename G::E_container &n_obj)
Constructor.
void new_node(size_t vc, size_t s, size_t d)
Create an edge.
std::string & e_node
edge node string
std::string & v_node
vertex position string
void operator()(T &t)
It call the functor for each attribute.
G::V_container & vo
Vertex object container.
vtk_dist_vertex_node(std::string &v_node, typename G::V_container &n_obj)
Constructor.
static void move(typename G::V_container &vo, s_type(&x)[3], bool &z_set)
Store the geometric informations in case it is an array.
static void move(typename G::V_container &vo, s_type(&x)[3], bool &z_set)
this class is a functor for "for_each" algorithm
void write()
Write collected information.
std::string & v_node
vertex position converted to string
bool z_set
indicate if the z coordinate has been set
G::V_type::s_type s_type
Vertex spatial type information.
vtk_dist_vertex_node(std::string &v_node, typename G::V_container &n_obj, s_type(&x)[3])
Constructor.
s_type(& x)[3]
coordinate of the vertex node
void operator()(T &t)
It call the functor for each attribute.
G::V_container & vo
Vertex object container.