MEPP2 Project
Testing
CGAL
Point_set
test_reader_writer_cgal_point_set.cpp
Go to the documentation of this file.
1
// Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2
// All rights reserved.
3
//
4
// This file is part of MEPP2; you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published
6
// by the Free Software Foundation; either version 3 of the License,
7
// or (at your option) any later version.
8
//
9
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11
12
#include "
FEVV/DataStructures/DataStructures_cgal_point_set.h
"
13
//#include "FEVV/Wrappings/Graph_traits_cgal_point_set.h"
14
#include "
FEVV/Wrappings/Geometry_traits_cgal_point_set.h
"
15
#include "
FEVV/Wrappings/Graph_properties_cgal_point_set.h
"
16
#include "
FEVV/Wrappings/properties_cgal_point_set.h
"
17
#include "
FEVV/Wrappings/Graph_traits_extension_cgal_point_set.h
"
18
19
#include "
FEVV/Filters/CGAL/Point_set/cgal_point_set_reader.hpp
"
20
#include "
FEVV/Filters/CGAL/Point_set/cgal_point_set_writer.hpp
"
21
22
#include "
FEVV/Tools/IO/FileUtilities.hpp
"
23
#include "
Testing/Utils/utils_are_meshes_identical.hpp
"
24
#include "
Testing/Utils/utils_identical_text_based_files.hpp
"
25
26
#include <iostream>
27
#include <string>
28
29
30
// main
31
int
main
(
int
argc,
char
*argv[])
32
{
33
// parse arguments
34
if
(argc != 4)
35
{
36
std::cout <<
"Usage: "
<< argv[0]
37
<<
" input_mesh_filename output_mesh_filename reference_mesh_filename"
<< std::endl;
38
std::cout <<
"Example: "
<< argv[0] <<
" ../Testing/Data/tetra.xyz tetra.out.ply tetra.out.ref.ply"
39
<< std::endl;
40
return
EXIT_FAILURE;
41
}
42
std::string input_file = argv[1];
43
std::string output_file = argv[2];
44
std::string reference_file = argv[3];
45
46
//----------------------------------
47
48
// create point cloud
49
typedef
FEVV::CGALPointSet
PointCloudT;
50
PointCloudT pc;
51
52
// load point cloud
53
std::cout <<
"Reading file "
<< input_file <<
"..."
<< std::endl;
54
FEVV::PMapsContainer
pmaps_bag;
55
FEVV::Filters::read_mesh
(input_file, pc, pmaps_bag);
56
57
std::cout <<
FEVV::size_of_vertices
(pc) <<
" points were successfully read."
<< std::endl;
58
59
//----------------------------------
60
61
// save point cloud
62
std::cout <<
"Saving to file "
<< output_file <<
"..."
<< std::endl;
63
FEVV::Filters::write_mesh
(output_file, pc, pmaps_bag);
64
65
//----------------------------------
66
67
// check output file
68
std::cout <<
"Comparing output file '"
<< output_file
69
<<
"' with reference file '"
<< reference_file <<
"'..."
70
<< std::endl;
71
72
if
(
FEVV::FileUtils::has_extension
(output_file,
".off"
) ||
73
FEVV::FileUtils::has_extension
(output_file,
".coff"
))
74
{
75
// use OFF file comparator
76
if
(!
are_meshes_equal
(output_file, reference_file,
false
))
77
{
78
std::cout <<
"Files are different!"
<< std::endl;
79
return
EXIT_FAILURE;
80
}
81
}
82
else
83
{
84
// use text file comparator
85
if
(!
identical_text_based_files
(output_file, reference_file))
86
{
87
std::cout <<
"Files are different!"
<< std::endl;
88
return
EXIT_FAILURE;
89
}
90
}
91
92
std::cout <<
"Files are identical."
<< std::endl;
93
94
return
0;
95
}
FEVV::CGALPointSet
CGAL::Point_set_3< CGALPointSetPoint > CGALPointSet
Definition:
DataStructures_cgal_point_set.h:71
DataStructures_cgal_point_set.h
main
int main(int argc, char *argv[])
Definition:
test_reader_writer_cgal_point_set.cpp:31
Geometry_traits_cgal_point_set.h
utils_identical_text_based_files.hpp
are_meshes_equal
bool are_meshes_equal(std::string filename_a, std::string filename_b, bool verbose)
Definition:
utils_are_meshes_identical.inl:925
FEVV::PMapsContainer
std::map< std::string, boost::any > PMapsContainer
Definition:
properties.h:99
identical_text_based_files
bool identical_text_based_files(std::string filename_a, std::string filename_b, const std::vector< std::string > &skip=std::vector< std::string >())
Definition:
utils_identical_text_based_files.hpp:27
Graph_traits_extension_cgal_point_set.h
cgal_point_set_writer.hpp
FEVV::Filters::read_mesh
void read_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps, bool=false)
Load mesh from file.
Definition:
cgal_point_set_reader.hpp:110
cgal_point_set_reader.hpp
FEVV::Filters::write_mesh
void write_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps)
Write mesh to file.
Definition:
cgal_point_set_writer.hpp:42
utils_are_meshes_identical.hpp
FEVV::FileUtils::has_extension
bool has_extension(const std::string &file_name)
Definition:
FileUtilities.hpp:58
FileUtilities.hpp
properties_cgal_point_set.h
FEVV::size_of_vertices
boost::graph_traits< MeshT >::vertices_size_type size_of_vertices(const MeshT &g)
Real current number of vertices of the mesh. Generic version.
Definition:
Graph_traits_extension.h:29
Graph_properties_cgal_point_set.h
Generated by
1.8.20