28 get_vmpeak_vmsize(pid_t pid,
unsigned int &vmpeak_kb,
unsigned int &vmsize_kb)
30 std::string filename =
"/proc/" + std::to_string(pid) +
"/status";
31 std::ifstream file(filename);
34 std::cout <<
"Failed to open file '" << filename <<
"'" << std::endl;
49 else if(word ==
"VmSize:")
58 template<
typename MeshT >
64 if(argc < 2 || argc > 5)
66 std::cout <<
"Load a .p3d file generated by the Compression Valence "
67 "filter, then decompress it."
69 std::cout <<
"Usage: " << argv[0]
70 <<
" p3d_file [output_mesh_file [reference_mesh_file "
71 "[relative_tolerance]]]"
73 std::cout <<
"Example: " << argv[0] <<
" airplane.p3d" << std::endl;
74 std::cout <<
"Example: " << argv[0]
75 <<
" airplane.p3d airplane_uncompressed.off" << std::endl;
76 std::cout <<
"Example: " << argv[0]
77 <<
" airplane.p3d airplane_uncompressed.off airplane.ref.obj"
80 <<
"Example: " << argv[0]
81 <<
" airplane.p3d airplane_uncompressed.off airplane.ref.obj 1e-04"
86 std::string input_file_path;
87 std::string output_file_path;
88 std::string reference_file_path;
89 float relative_tolerance = 0.0f;
91 input_file_path = argv[1];
93 output_file_path = argv[2];
95 reference_file_path = argv[3];
97 relative_tolerance = (float)std::atof(argv[4]);
100 std::cout <<
"\nParameters summary:" << std::endl;
101 std::cout <<
" - input file: " << input_file_path << std::endl;
102 std::cout <<
" - output file: " << output_file_path << std::endl;
103 std::cout <<
" - ref. file: " << reference_file_path << std::endl;
104 std::cout <<
" - rel. tolerance: " << relative_tolerance << std::endl;
108 pid_t pid = getpid();
112 get_vmpeak_vmsize(pid, vmpeak_kb, vmsize_kb);
113 std::cout <<
"before loading and decompression vmpeak=" << vmpeak_kb
114 <<
" kB vmsize=" << vmsize_kb <<
" kB" << std::endl;
124 auto pm =
get(boost::vertex_point, m);
127 using VertexColorMap =
139 get_vmpeak_vmsize(pid, vmpeak2_kb, vmsize_kb);
140 std::cout <<
"after decompression vmpeak=" << vmpeak2_kb
141 <<
" kB vmsize=" << vmsize_kb
142 <<
" kB extra.vmpeak=" << vmpeak2_kb - vmpeak_kb <<
" kB"
147 if(!output_file_path.empty())
151 if(!reference_file_path.empty())
153 std::cout <<
"Comparing output file" << std::endl;
154 std::cout <<
" '" << output_file_path <<
"'" << std::endl;
155 std::cout <<
"with reference file" << std::endl;
156 std::cout <<
" '" << reference_file_path <<
"'" << std::endl;
157 std::cout <<
"..." << std::endl;
169 std::cout <<
"Files are different!" << std::endl;
178 std::cout <<
"Files are different!" << std::endl;
183 std::cout <<
"Files are identical." << std::endl;