MEPP2 Project
Testing
AIF
test_generic_writer_aif.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 Lesser General Public License as
6
// published by the Free Software Foundation; either version 3 of
7
// the License, 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
#include "
FEVV/DataStructures/AIF/AIFMesh.hpp
"
12
#include "
FEVV/DataStructures/AIF/AIFMeshHelpers.h
"
13
14
#include "
FEVV/Wrappings/Graph_traits_aif.h
"
15
#include "
FEVV/Wrappings/Graph_traits_extension_aif.h
"
16
#include "
FEVV/Wrappings/Geometry_traits_aif.h
"
17
#include "
FEVV/Wrappings/Graph_properties_aif.h
"
18
19
#include "
FEVV/Wrappings/properties_aif.h
"
20
#include "
FEVV/Filters/Generic/generic_reader.hpp
"
21
#include "
FEVV/Filters/Generic/generic_writer.hpp
"
22
23
#include "
FEVV/Tools/IO/FileUtilities.hpp
"
24
#include "
Testing/Utils/utils_are_meshes_identical.hpp
"
25
#include "
Testing/Utils/utils_identical_text_based_files.hpp
"
26
27
#include <iostream>
28
#include <string>
29
30
31
using
MeshT
=
FEVV::DataStructures::AIF::AIFMesh
;
32
33
34
int
35
main
(
int
argc,
const
char
**argv)
36
{
37
if
(argc != 4)
38
{
39
std::cout <<
"Load a mesh from an input file using the generic reader, "
40
"write it to an output file using the generic writer, then "
41
"compare the output file with a reference file."
42
<< std::endl;
43
std::cout <<
"Usage: "
<< argv[0]
44
<<
" input_mesh_file output_mesh_file reference_mesh_file"
45
<< std::endl;
46
std::cout <<
"Example: "
<< argv[0]
47
<<
" airplane.off airplane.out.obj airplane.ref.obj"
48
<< std::endl;
49
return
EXIT_FAILURE;
50
}
51
52
std::string input_file_path = argv[1];
53
std::string output_file_path = argv[2];
54
std::string reference_file_path = argv[3];
55
56
//--------------------------------------------------
57
58
// read mesh from file
59
MeshT
m;
60
FEVV::PMapsContainer
pmaps;
61
FEVV::Filters::read_mesh
(input_file_path, m, pmaps);
62
63
// write mesh to file
64
FEVV::Filters::write_mesh
(output_file_path, m, pmaps);
65
66
// check output file
67
std::cout <<
"Comparing output file '"
<< output_file_path
68
<<
"' with reference file '"
<< reference_file_path <<
"'..."
69
<< std::endl;
70
71
if
(
FEVV::FileUtils::has_extension
(output_file_path,
".off"
) ||
72
FEVV::FileUtils::has_extension
(output_file_path,
".coff"
))
73
{
74
// use OFF file comparator
75
if
(!
are_meshes_equal
(output_file_path, reference_file_path,
false
))
76
{
77
std::cout <<
"Files are different!"
<< std::endl;
78
return
EXIT_FAILURE;
79
}
80
}
81
else
82
{
83
// use text file comparator
84
if
(!
identical_text_based_files
(output_file_path, reference_file_path))
85
{
86
std::cout <<
"Files are different!"
<< std::endl;
87
return
EXIT_FAILURE;
88
}
89
}
90
91
std::cout <<
"Files are identical."
<< std::endl;
92
93
return
0;
94
}
Graph_traits_extension_aif.h
generic_reader.hpp
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
properties_aif.h
FEVV::PMapsContainer
std::map< std::string, boost::any > PMapsContainer
Definition:
properties.h:99
Graph_properties_aif.h
AIFMesh.hpp
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
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
Graph_traits_aif.h
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
generic_writer.hpp
AIFMeshHelpers.h
Geometry_traits_aif.h
utils_are_meshes_identical.hpp
FEVV::DataStructures::AIF::AIFMesh
This class represents an AIF structure. AIF structure can deal with both manifold and non-manifold su...
Definition:
AIFMesh.hpp:47
main
int main(int argc, const char **argv)
Definition:
test_generic_writer_aif.cpp:35
FEVV::FileUtils::has_extension
bool has_extension(const std::string &file_name)
Definition:
FileUtilities.hpp:58
AIFMesh
FEVV::DataStructures::AIF::AIFMesh AIFMesh
Definition:
Graph_properties_aif.h:19
FileUtilities.hpp
Generated by
1.8.20