-
Notifications
You must be signed in to change notification settings - Fork 3
/
draw.cpp
89 lines (51 loc) · 1.8 KB
/
draw.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include"cpFEM.h"
#include"simu.h"
void draw(Triangulation& T, const std::string file_name ) {
// cout << "draw on step "<< simu.current_step() << endl;
std::stringstream mkdir;
std::stringstream dirname;
dirname << simu.time();
mkdir << "mkdir -p " << dirname.str();
// cout << "running : " << mkdir.str() << endl;
system(mkdir.str().c_str());
std::stringstream namefile;
namefile << dirname.str() << '/' << file_name;
// cout << "writing on file : " << namefile.str() << endl;
std::ofstream main_data;
main_data.open(namefile.str().c_str() );
for(F_v_it vit=T.finite_vertices_begin();
vit != T.finite_vertices_end();
vit++) {
Point p = vit->point().point();
#include"printout.h"
}
main_data << endl;
main_data.close();
}
void draw_diagram(Triangulation& T, const std::string file_name ) {
// cout << "draw on step "<< simu.current_step() << endl;
std::stringstream mkdir;
std::stringstream dirname;
dirname << simu.time();
mkdir << "mkdir -p " << dirname.str();
system(mkdir.str().c_str());
std::stringstream namefile;
namefile << dirname.str() << '/' << file_name;
//cout << "writing on file : " << namefile.str() << endl;
std::ofstream main_data;
main_data.open(namefile.str().c_str() );
for ( F_e_it eit = T.finite_edges_begin() ;
eit !=T.finite_edges_end(); ++eit) {
CGAL::Object o = T.dual(eit);
const Segment * Vor_segment = CGAL::object_cast<Segment>( &o );
if (! Vor_segment ) continue;
// cout << " l0 = " << std::sqrt(Vor_segment->squared_length()) << endl;
Point p1 = Vor_segment->source() ;
Point p2 = Vor_segment->target() ;
main_data << p1 << endl;
main_data << p2 << endl;
main_data << endl;
}
main_data << endl;
main_data.close();
}