Add import functions in tests (and three data files).

This commit is contained in:
Guillaume Damiand 2011-11-07 11:18:28 +00:00
parent c12db887c8
commit 6321bfb03e
6 changed files with 79316 additions and 37 deletions

3
.gitattributes vendored
View File

@ -2057,6 +2057,9 @@ Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h -text
Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.h -text Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_3_test.h -text
Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.h -text Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_4_test.h -text
Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_test.cpp -text Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_test.cpp -text
Linear_cell_complex/test/Linear_cell_complex/data/armadillo.off -text
Linear_cell_complex/test/Linear_cell_complex/data/graph.txt -text
Linear_cell_complex/test/Linear_cell_complex/data/points.txt -text
MacOSX/auxiliary/cgal_app.icns -text MacOSX/auxiliary/cgal_app.icns -text
Maintenance/MacOSX_Installer/CGAL-3.2-absolute.pmproj -text Maintenance/MacOSX_Installer/CGAL-3.2-absolute.pmproj -text
Maintenance/MacOSX_Installer/CGAL-3.2.pmproj -text Maintenance/MacOSX_Installer/CGAL-3.2.pmproj -text

View File

@ -1,5 +1,7 @@
#include <CGAL/Linear_cell_complex.h> #include <CGAL/Linear_cell_complex.h>
#include <CGAL/Combinatorial_map_operations.h> #include <CGAL/Combinatorial_map_operations.h>
#include <CGAL/Linear_cell_complex_constructors.h>
#include <fstream>
template<typename LCC> template<typename LCC>
bool check_number_of_cells_2(LCC& lcc, unsigned int nbv, unsigned int nbe, bool check_number_of_cells_2(LCC& lcc, unsigned int nbv, unsigned int nbe,
@ -151,13 +153,18 @@ bool test_LCC_2()
if ( !check_number_of_cells_2(lcc, 0, 0, 0, 0) ) if ( !check_number_of_cells_2(lcc, 0, 0, 0, 0) )
return false; return false;
/* import_from_polyhedron<LCC>(lcc,ap); {
std::ifstream in("data/graph.txt");
if ( in.fail() )
{
std::cout<<"Error: impossible to open 'data/graph.txt'"<<std::endl;
return false;
}
CGAL:: import_from_plane_graph<LCC>(lcc,in);
if ( !check_number_of_cells_2(lcc, 61, 160, 101, 1) )
return false;
lcc.clear(); lcc.clear();
}
import_from_plane_graph<LCC>(lcc,ais);
lcc.clear();*/
return true; return true;
} }

View File

@ -1,9 +1,14 @@
#include <CGAL/Linear_cell_complex.h> #include <CGAL/Linear_cell_complex.h>
#include <CGAL/Combinatorial_map_operations.h> #include <CGAL/Combinatorial_map_operations.h>
#include <CGAL/Linear_cell_complex_constructors.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <fstream>
template<typename LCC> template<typename LCC>
bool check_number_of_cells_3(LCC& lcc, unsigned int nbv, unsigned int nbe, bool check_number_of_cells_3(LCC& lcc, unsigned int nbv, unsigned int nbe,
unsigned int nbf, unsigned int nbvol, unsigned int nbcc) unsigned int nbf, unsigned int nbvol,
unsigned int nbcc)
{ {
if ( !lcc.is_valid() ) if ( !lcc.is_valid() )
{ {
@ -15,7 +20,8 @@ bool check_number_of_cells_3(LCC& lcc, unsigned int nbv, unsigned int nbe,
std::vector<unsigned int> nbc; std::vector<unsigned int> nbc;
nbc=lcc.count_all_cells(); nbc=lcc.count_all_cells();
if (nbv!=nbc[0] || nbe!=nbc[1] || nbf!=nbc[2] || nbvol!=nbc[3] || nbcc!=nbc[4]) if (nbv!=nbc[0] || nbe!=nbc[1] || nbf!=nbc[2] || nbvol!=nbc[3] ||
nbcc!=nbc[4])
{ {
std::cout<<"ERROR: the number of cells is not correct. We must have " std::cout<<"ERROR: the number of cells is not correct. We must have "
<<" ("<<nbv<<", "<<nbe<<", "<<nbf<<", "<<nbvol<<", "<<nbcc <<" ("<<nbv<<", "<<nbe<<", "<<nbf<<", "<<nbvol<<", "<<nbcc
@ -29,8 +35,8 @@ bool check_number_of_cells_3(LCC& lcc, unsigned int nbv, unsigned int nbe,
if ( nbv!=lcc.number_of_vertex_attributes() ) if ( nbv!=lcc.number_of_vertex_attributes() )
{ {
std::cout<<"ERROR: the number of vertices ("<<nbv<<") is different than " std::cout<<"ERROR: the number of vertices ("<<nbv<<") is different than "
<<"the number of vertex attributes ("<<lcc.number_of_vertex_attributes() <<"the number of vertex attributes ("
<<")"<<std::endl; <<lcc.number_of_vertex_attributes()<<")"<<std::endl;
assert(false); assert(false);
return false; return false;
@ -39,6 +45,17 @@ bool check_number_of_cells_3(LCC& lcc, unsigned int nbv, unsigned int nbe,
return true; return true;
} }
// An off, used to test the import_from_polyhedron function.
const char* triangle = "OFF\n"
"3 1 0\n"
"0 0 0\n"
"1 0 0\n"
"0 1 0\n"
"3 0 1 2\n";
// 3D points, used to test the import_from_triangulation_3 function.
template<typename LCC> template<typename LCC>
bool test_LCC_3() bool test_LCC_3()
{ {
@ -190,13 +207,37 @@ bool test_LCC_3()
if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) ) if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) )
return false; return false;
/* import_from_polyhedron<LCC>(lcc,ap);
{
CGAL::Polyhedron_3<typename LCC::Traits> P;
std::ifstream in("data/armadillo.off");
if ( in.fail() )
{
std::cout<<"Error: impossible to open 'data/armadillo.off'"<<std::endl;
return false;
}
in >> P;
CGAL::import_from_polyhedron<LCC>(lcc,P);
if ( !check_number_of_cells_3(lcc, 26002, 78000, 52000, 1, 1) )
return false;
lcc.clear(); lcc.clear();
}
import_from_plane_graph<LCC>(lcc,ais); {
CGAL::Triangulation_3<typename LCC::Traits> T;
lcc.clear();*/ std::ifstream in("data/points.txt");
if ( in.fail() )
{
std::cout<<"Error: impossible to open 'data/points.txt'"<<std::endl;
return false;
}
std::istream_iterator < Point > begin (in), end;
T.insert (begin, end);
CGAL::import_from_triangulation_3<LCC>(lcc,T);
if ( !check_number_of_cells_3(lcc, 795, 4156, 6722, 3361, 1) )
return false;
lcc.clear();
}
return true; return true;
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,224 @@
61 160
-5 -5
-3 -5
-3 -3
-5 -3
-3 -1
-5 -1
-3 1
-5 1
-3 3
-5 3
-3 5
-5 5
-1 -5
-1 -3
-1 -1
-1 1
-1 3
-1 5
1 -5
1 -3
1 -1
1 1
1 3
1 5
3 -5
3 -3
3 -1
3 1
3 3
3 5
5 -5
5 -3
5 -1
5 1
5 3
5 5
4 4
4 2
4 0
4 -2
4 -4
2 4
2 2
2 0
2 -2
2 -4
0 4
0 2
0 0
0 -2
0 -4
-2 4
-2 2
-2 0
-2 -2
-2 -4
-4 4
-4 2
-4 0
-4 -2
-4 -4
0 1
1 2
2 3
3 0
2 4
4 5
5 3
4 6
6 7
7 5
6 8
8 9
9 7
8 10
10 11
11 9
1 12
12 13
13 2
13 14
14 4
14 15
15 6
15 16
16 8
16 17
17 10
12 18
18 19
19 13
19 20
20 14
20 21
21 15
21 22
22 16
22 23
23 17
18 24
24 25
25 19
25 26
26 20
26 27
27 21
27 28
28 22
28 29
29 23
24 30
30 31
31 25
31 32
32 26
32 33
33 27
33 34
34 28
34 35
35 29
28 36
29 36
35 36
34 36
27 37
28 37
34 37
33 37
26 38
27 38
33 38
32 38
25 39
26 39
32 39
31 39
24 40
25 40
31 40
30 40
22 41
23 41
29 41
28 41
21 42
22 42
28 42
27 42
20 43
21 43
27 43
26 43
19 44
20 44
26 44
25 44
18 45
19 45
25 45
24 45
16 46
17 46
23 46
22 46
15 47
16 47
22 47
21 47
14 48
15 48
21 48
20 48
13 49
14 49
20 49
19 49
12 50
13 50
19 50
18 50
8 51
10 51
17 51
16 51
6 52
8 52
16 52
15 52
4 53
6 53
15 53
14 53
2 54
4 54
14 54
13 54
1 55
2 55
13 55
12 55
9 56
11 56
10 56
8 56
7 57
9 57
8 57
6 57
5 58
7 58
6 58
4 58
3 59
5 59
4 59
2 59
0 60
3 60
2 60
1 60

File diff suppressed because it is too large Load Diff