25 #include <boost/test/minimal.hpp>
26 #include <boost/shared_ptr.hpp>
27 #include <boost/timer.hpp>
37 void computeFlatPolytope(
const std::vector< boost::shared_ptr<Hyperplane_Rn> >& vectOfHyp, boost::shared_ptr<Polytope_Rn> fptop_1, std::string compPol,
bool strongRedundancy) {
38 unsigned int truncationStep = fptop_1->numberOfHalfSpaces();
39 std::vector< boost::shared_ptr<Hyperplane_Rn> >::const_iterator pos;
40 for (pos = vectOfHyp.begin(); pos != vectOfHyp.end(); ++pos)
41 fptop_1->addHalfSpace(*pos);
44 if (!strongRedundancy) {
48 boost::shared_ptr<Polytope_Rn>,
57 boost::shared_ptr<Polytope_Rn>,
62 for (fiteGN1.
begin(); fiteGN1.
end()!=
true; fiteGN1.
next()) {
63 fiteGN1.
current()->dump(std::cout);
65 for (
unsigned int ii=0; ii<fiteGN1.
current()->numberOfFacets(); ii++) {
66 unsigned int fctNumber = fptop_1->getHalfSpaceNumber( fiteGN1.
current()->getFacet(ii) );
67 std::cout <<
" " << fctNumber;
70 std::cout << std::endl;
72 fptop_1->dump(std::cout);
73 boost::shared_ptr<Polytope_Rn> ftop_1Test(
new Polytope_Rn());
82 cout <<
"####################" << endl;
83 cout <<
"# VORONOI DIAGRAMS #" << endl;
84 cout <<
"####################" << endl;
87 boost::shared_ptr<Polytope_Rn> inputSpace(
new Polytope_Rn());
88 inputSpace->createBoundingBox(10);
89 Point_Rn P1(2), P2(2), P3(2), P4(2), P5(2);
90 P1.setCoordinate(0,1);
91 P1.setCoordinate(1,1);
92 P2.setCoordinate(0,8);
93 P2.setCoordinate(1,4);
94 P3.setCoordinate(0,-7);
95 P3.setCoordinate(1,7);
96 P4.setCoordinate(0,-4);
97 P4.setCoordinate(1,-2);
100 std::vector<Point_Rn> listOfPoints;
101 listOfPoints.push_back(P1);listOfPoints.push_back(P2);listOfPoints.push_back(P3);listOfPoints.push_back(P4);listOfPoints.push_back(P5);
102 std::vector< boost::shared_ptr<Polytope_Rn> > allVoronoiCells;
104 string vorPath = string(
"./test/VORONOI/2D/");
105 boost::shared_ptr<Polytope_Rn> Vor_Test(
new Polytope_Rn());
124 boost::shared_ptr<Polytope_Rn> inputSpaceAngers(
new Polytope_Rn());
125 inputSpaceAngers->createBoundingBox(0.5);
127 string vorPath3DAngers = string(
"./test/VORONOI/3D/Angers/");
129 boost::shared_ptr<Polytope_Rn> listOfPointsAsVDesc(
new Polytope_Rn());
131 std::vector<Point_Rn> listOfPoints3DAngers;
134 listOfPoints3DAngers.push_back(
138 std::vector< boost::shared_ptr<Polytope_Rn> > allVoronoiCells_Angers0;
141 std::vector< boost::shared_ptr<Polytope_Rn> > allVoronoiCells_Angers1;
144 std::vector< boost::shared_ptr<Polytope_Rn> > allVoronoiCells_Angers2;
147 std::vector< boost::shared_ptr<Polytope_Rn> > allVoronoiCells_Angers3;
150 std::vector< boost::shared_ptr<Polytope_Rn> > allVoronoiCells_Angers4;
153 std::vector< boost::shared_ptr<Polytope_Rn> > allVoronoiCells_Angers5;
155 BOOST_CHECK( allVoronoiCells_Angers0.size() == allVoronoiCells_Angers1.size() );
156 BOOST_CHECK( allVoronoiCells_Angers1.size() == allVoronoiCells_Angers2.size() );
157 BOOST_CHECK( allVoronoiCells_Angers2.size() == allVoronoiCells_Angers3.size() );
158 BOOST_CHECK( allVoronoiCells_Angers3.size() == allVoronoiCells_Angers4.size() );
159 BOOST_CHECK( allVoronoiCells_Angers4.size() == allVoronoiCells_Angers5.size() );
160 for (
unsigned int cellCounter=0; cellCounter<allVoronoiCells_Angers0.size(); ++cellCounter)
162 for (
unsigned int cellCounter=0; cellCounter<allVoronoiCells_Angers1.size(); ++cellCounter)
164 for (
unsigned int cellCounter=0; cellCounter<allVoronoiCells_Angers2.size(); ++cellCounter)
166 for (
unsigned int cellCounter=0; cellCounter<allVoronoiCells_Angers3.size(); ++cellCounter)
168 for (
unsigned int cellCounter=0; cellCounter<allVoronoiCells_Angers4.size(); ++cellCounter)
170 std::cout <<
"allVoronoiCells_Angers0.size() = " << allVoronoiCells_Angers0.size() << std::endl;
171 std::cout <<
"allVoronoiCells_Angers1.size() = " << allVoronoiCells_Angers1.size() << std::endl;
172 std::cout <<
"allVoronoiCells_Angers2.size() = " << allVoronoiCells_Angers2.size() << std::endl;
173 std::cout <<
"allVoronoiCells_Angers3.size() = " << allVoronoiCells_Angers3.size() << std::endl;
174 std::cout <<
"allVoronoiCells_Angers4.size() = " << allVoronoiCells_Angers4.size() << std::endl;
175 std::cout <<
"allVoronoiCells_Angers5.size() = " << allVoronoiCells_Angers5.size() << std::endl;
181 cout <<
"////////////" << endl;
182 cout <<
"// DATA1 //" << endl;
183 cout <<
"//////////" << endl;
184 string path_test1(
"test/DATA1/");
185 boost::shared_ptr<Polytope_Rn> _polytopeTest(
new Polytope_Rn());
186 cout <<
"######################" << endl;
187 cout <<
"# DATA1: truncations #" << endl;
188 cout <<
"######################" << endl;
193 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 6 );
197 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 6 );
201 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 12 );
205 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 8 );
209 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 4 );
213 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 6 );
218 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 8 );
222 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 8 );
226 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 6 );
230 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 7 );
234 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 7 );
238 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 600 );
242 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 32 );
245 boost::shared_ptr<Polytope_Rn> _polytope2(
new Polytope_Rn());
277 boost::shared_ptr<Polytope_Rn> parallel1(
new Polytope_Rn());
281 boost::shared_ptr<Polytope_Rn> parallel2(
new Polytope_Rn());
304 cout <<
"########################" << endl;
305 cout <<
"# DATA1: intersections #" << endl;
306 cout <<
"########################" << endl;
313 BOOST_REQUIRE( _polytopeTest->numberOfGenerators() == 8 );
314 cout <<
"###############" << endl;
315 cout <<
"# DATA1: sums #" << endl;
316 cout <<
"###############" << endl;
319 boost::shared_ptr<Polytope_Rn> _sum;
326 BOOST_REQUIRE( _sum->numberOfGenerators() == 24 );
327 BOOST_REQUIRE( _sum->numberOfHalfSpaces() == 26 );
330 BOOST_REQUIRE( _sum->numberOfGenerators() == 24 );
331 BOOST_REQUIRE( _sum->numberOfHalfSpaces() == 26 );
334 boost::shared_ptr<Polytope_Rn> _polytope1(
new Polytope_Rn());
343 BOOST_REQUIRE( _sum->numberOfGenerators() == 24 );
344 BOOST_REQUIRE( _sum->numberOfHalfSpaces() == 26 );
348 boost::shared_ptr<Polytope_Rn> _sum2(
new Polytope_Rn());
349 boost::shared_ptr<Polytope_Rn> _polytope3(
new Polytope_Rn());
376 BOOST_REQUIRE( _sum->numberOfGenerators() == 9 );
377 BOOST_REQUIRE( _sum->numberOfHalfSpaces() == 7 );
380 BOOST_REQUIRE( _sum->numberOfGenerators() == 9 );
381 BOOST_REQUIRE( _sum->numberOfHalfSpaces() == 7 );
388 BOOST_REQUIRE( _sum->numberOfGenerators() == 17 );
389 BOOST_REQUIRE( _sum->numberOfHalfSpaces() == 17 );
392 BOOST_REQUIRE( _sum->numberOfGenerators() == 17 );
393 BOOST_REQUIRE( _sum->numberOfHalfSpaces() == 17 );
402 BOOST_REQUIRE( _sum->numberOfGenerators() == 25 );
403 BOOST_REQUIRE( _sum->numberOfHalfSpaces() == 33 );
406 BOOST_REQUIRE( _sum->numberOfGenerators() == 25 );
407 BOOST_REQUIRE( _sum->numberOfHalfSpaces() == 33 );
415 BOOST_REQUIRE( _sum->numberOfGenerators() == 34 );
416 BOOST_REQUIRE( _sum->numberOfHalfSpaces() == 40 );
419 BOOST_REQUIRE( _sum->numberOfGenerators() == 34 );
420 BOOST_REQUIRE( _sum->numberOfHalfSpaces() == 40 );
426 boost::shared_ptr<Polytope_Rn> _pol2compare;
433 std::cout <<
"* Extrusions *" << std::endl;
434 boost::shared_ptr<Polytope_Rn> polytope2extrude(
new Polytope_Rn());
437 std::set< unsigned int > originalSpaceDirections;
438 originalSpaceDirections.insert(1);originalSpaceDirections.insert(2);originalSpaceDirections.insert(6);
444 for (
unsigned int i=0; i<6; ++i)
445 BOOST_REQUIRE( iteHS1.
current()->getCoefficient(i) == iteHS2.
current()->getCoefficient(i) );
451 originalSpaceDirections.clear();
452 originalSpaceDirections.insert(1);originalSpaceDirections.insert(2);
458 for (iteHS1_2D.
begin(),iteHS2_2D.
begin(); iteHS1_2D.
end()!=
true&&iteHS2_2D.
end()!=
true; iteHS1_2D.
next(),iteHS2_2D.
next()) {
459 for (
unsigned int i=0; i<6; ++i)
460 BOOST_REQUIRE( iteHS1_2D.
current()->getCoefficient(i) == iteHS2_2D.
current()->getCoefficient(i) );
462 std::cout <<
"* Box *" << std::endl;
464 Point_Rn Pmin(1., 2., 3.), Pmax(4., 5., 6.);
467 box3D->dump(std::cout);
470 std::cout <<
"* Scaling factor *" << std::endl;
472 box3D->checkTopologyAndGeometry();
478 box3D->checkTopologyAndGeometry();
485 cout <<
"/////////////" << endl;
486 cout <<
"// DATA 2 //" << endl;
487 cout <<
"///////////" << endl;
490 path_test1 = string(
"test/DATA2/");
511 cout <<
"////////////////////////////////////" << endl;
512 cout <<
"// SUMMING A CUBE AND A POLYTOPE //" << endl;
513 cout <<
"//////////////////////////////////" << endl;
514 boost::shared_ptr<Polytope_Rn> pcapa(
new Polytope_Rn());
516 Point_Rn Pmin(-0.01, -0.0005, -0.0005);
517 Point_Rn Pmax(0.01, 0.0005, 0.0005);
525 boost::shared_ptr<Polytope_Rn> pecart(
new Polytope_Rn());
528 boost::numeric::ublas::vector<double> subs(3);
530 subs(1) = 0.01742817;
531 subs(2) = 0.01751706;
538 boost::shared_ptr<Polytope_Rn> _A_0(
new Polytope_Rn());
539 boost::shared_ptr<Polytope_Rn> _A_1(
new Polytope_Rn());
540 boost::shared_ptr<Polytope_Rn> _A_2(
new Polytope_Rn());
541 boost::shared_ptr<Polytope_Rn> _A_3(
new Polytope_Rn());
542 boost::shared_ptr<Polytope_Rn> sum0123(
new Polytope_Rn());
547 std::vector< boost::shared_ptr<Polytope_Rn> > arrayOfPolytopes;
548 arrayOfPolytopes.push_back(_A_0);
549 arrayOfPolytopes.push_back(_A_1);
550 arrayOfPolytopes.push_back(_A_2);
551 arrayOfPolytopes.push_back(_A_3);
560 boost::shared_ptr<Polytope_Rn> shangai0123(
new Polytope_Rn());
665 std::vector< boost::shared_ptr<Polytope_Rn> > arrayOfPolytopes;
666 arrayOfPolytopes.resize(7);
667 path_test1 = string(
"test/DATA2/T1/");
668 string path_test2(
"test/DATA2/T2/");
669 string path_test3(
"test/DATA2/T3/");
670 string path_test4(
"test/DATA2/T4/");
671 string path_test5(
"test/DATA2/T5/");
672 std::vector< string > Ppath1;
673 std::vector< string > Ppath2;
674 std::vector< string > Ppath3;
675 std::vector< string > Ppath4;
676 std::vector< string > Ppath5;
678 Ppath1.push_back(
string(
"outputcthp_0_1-ctl_848_0.ptop") );
679 Ppath1.push_back(
string(
"outputcthp_10_0-ctl_524_1.ptop") );
680 Ppath1.push_back(
string(
"outputcthp_102_1-ctl_221_0.ptop") );
681 Ppath1.push_back(
string(
"outputcthp_103_0-ctl_122_2.ptop") );
682 Ppath1.push_back(
string(
"outputcthp_107_3-ctl_145_1.ptop") );
683 Ppath1.push_back(
string(
"outputcthp_109_2-ctl_452_2.ptop") );
684 Ppath1.push_back(
string(
"outputcthp_113_0-ctl_989_2.ptop") );
685 Ppath2.push_back(
string(
"outputcthp_0_2-ctl_82_2.ptop") );
686 Ppath2.push_back(
string(
"outputcthp_10_3-ctl_99_3.ptop") );
687 Ppath2.push_back(
string(
"outputcthp_100_0-ctl_914_1.ptop") );
688 Ppath2.push_back(
string(
"outputcthp_104_2-ctl_857_3.ptop") );
689 Ppath2.push_back(
string(
"outputcthp_108_3-ctl_196_1.ptop") );
690 Ppath2.push_back(
string(
"outputcthp_109_2-ctl_452_2.ptop") );
691 Ppath2.push_back(
string(
"outputcthp_110_1-ctl_697_0.ptop") );
692 Ppath3.push_back(
string(
"outputcthp_111_1-ctl_111_1.ptop") );
693 Ppath3.push_back(
string(
"outputcthp_162_0-ctl_42_1.ptop") );
694 Ppath3.push_back(
string(
"outputcthp_366_1-ctl_201_0.ptop") );
695 Ppath3.push_back(
string(
"outputcthp_57_3-ctl_330_2.ptop") );
696 Ppath3.push_back(
string(
"outputcthp_586_0-ctl_932_2.ptop") );
697 Ppath3.push_back(
string(
"outputcthp_741_3-ctl_568_0.ptop") );
698 Ppath3.push_back(
string(
"outputcthp_915_3-ctl_803_1.ptop") );
699 Ppath4.push_back(
string(
"outputcthp_177_1-ctl_83_2.ptop") );
700 Ppath4.push_back(
string(
"outputcthp_231_1-ctl_830_2.ptop") );
701 Ppath4.push_back(
string(
"outputcthp_361_1-ctl_578_2.ptop") );
702 Ppath4.push_back(
string(
"outputcthp_44_1-ctl_51_2.ptop") );
703 Ppath4.push_back(
string(
"outputcthp_482_2-ctl_880_0.ptop") );
704 Ppath4.push_back(
string(
"outputcthp_712_1-ctl_693_1.ptop") );
705 Ppath4.push_back(
string(
"outputcthp_899_3-ctl_233_3.ptop") );
706 Ppath5.push_back(
string(
"outputcthp_0_2-ctl_82_2.ptop") );
707 Ppath5.push_back(
string(
"outputcthp_10_0-ctl_524_1.ptop") );
708 Ppath5.push_back(
string(
"outputcthp_101_0-ctl_74_0.ptop") );
709 Ppath5.push_back(
string(
"outputcthp_104_1-ctl_357_2.ptop") );
710 Ppath5.push_back(
string(
"outputcthp_107_2-ctl_186_0.ptop") );
711 Ppath5.push_back(
string(
"outputcthp_112_2-ctl_527_3.ptop") );
712 Ppath5.push_back(
string(
"outputcthp_113_2-ctl_424_1.ptop") );
714 {
for (
unsigned int i=0; i<7; ++i) {
716 boost::shared_ptr<Polytope_Rn> T1(
new Polytope_Rn());
717 boost::shared_ptr<Polytope_Rn> T2(
new Polytope_Rn());
718 boost::shared_ptr<Polytope_Rn> T3(
new Polytope_Rn());
719 boost::shared_ptr<Polytope_Rn> T4(
new Polytope_Rn());
720 boost::shared_ptr<Polytope_Rn> T5(
new Polytope_Rn());
726 cout <<
"##################" << endl;
727 cout <<
"# DATA 2: sums ";
728 cout << i+1 <<
" #" << endl;
729 cout <<
"##################" << endl;
730 boost::shared_ptr<Polytope_Rn> T12(
new Polytope_Rn());
731 boost::shared_ptr<Polytope_Rn> T123(
new Polytope_Rn());
732 boost::shared_ptr<Polytope_Rn> T1234(
new Polytope_Rn());
733 boost::shared_ptr<Polytope_Rn> T12345(
new Polytope_Rn());
738 boost::shared_ptr<Polytope_Rn> T54(
new Polytope_Rn());
739 boost::shared_ptr<Polytope_Rn> T543(
new Polytope_Rn());
740 boost::shared_ptr<Polytope_Rn> T5432(
new Polytope_Rn());
741 boost::shared_ptr<Polytope_Rn> T54321(
new Polytope_Rn());
747 arrayOfPolytopes[i] = T12345;
753 cout <<
"////////////////" << endl;
754 cout <<
"// SSS DISC1 //" << endl;
755 cout <<
"//////////////" << endl;
756 path_test1 = string(
"test/TM/Sss1_disc6/");
757 arrayOfPolytopes.clear();
758 arrayOfPolytopes.resize(12);
759 cout <<
"##########################" << endl;
760 cout <<
"# SSS DISC1: truncations #" << endl;
761 cout <<
"##########################" << endl;
762 {
for (
unsigned int i=0; i<12; ++i) {
765 string p_name = string(
"Polytope_") + ss.str() + string(
".ptop");
770 cout <<
"############################" << endl;
771 cout <<
"# SSS DISC1: intersections #" << endl;
772 cout <<
"############################" << endl;
773 {
for (
unsigned int i=1; i<5 ; ++i) {
776 {
for (
unsigned int i=6; i<10; ++i) {
779 cout <<
"# intersections 11 & 12 #" << endl;
782 cout <<
"###################" << endl;
783 cout <<
"# SSS DISC1: sums #" << endl;
784 cout <<
"###################" << endl;
785 boost::shared_ptr<Polytope_Rn> C05(
new Polytope_Rn());
786 boost::shared_ptr<Polytope_Rn> C50(
new Polytope_Rn());
795 cout <<
"//////////////////" << endl;
796 cout <<
"// BBB_D_5.966 //" << endl;
797 cout <<
"////////////////" << endl;
798 path_test2 = string(
"test/TM/Interference_Bbb/BBB_D_5.966/");
799 arrayOfPolytopes.clear();
800 arrayOfPolytopes.resize(13);
801 {
for (
unsigned int i=1; i<=13; ++i) {
802 cout <<
"############################" << endl;
803 cout <<
"# BBB_D_5.966: truncations #" << endl;
804 cout <<
"############################" << endl;
807 std::vector< boost::shared_ptr<Polytope_Rn> > tmpArrayOfPtop(5);
808 {
for (
unsigned int j=1; j<=5; ++j) {
811 string p_name = string(
"ctl_") + ss1.str();
812 p_name += string(
"_") + ss2.str() + string(
".ptop");
817 cout <<
"##############################" << endl;
818 cout <<
"# BBB_D_5.966: intersections #" << endl;
819 cout <<
"##############################" << endl;
820 {
for (
unsigned int j=1; j<=4; ++j) {
823 arrayOfPolytopes.push_back( tmpArrayOfPtop[0] );
825 checkPtop += path_test2 + string(
"qhull_ctl_");
826 checkPtop += ss1.str() + string(
"_x.ptop");
827 boost::shared_ptr<Polytope_Rn> CP(
new Polytope_Rn());
834 cout <<
"//////////////////" << endl;
835 cout <<
"// BBB_D_5.976 //" << endl;
836 cout <<
"////////////////" << endl;
837 path_test2 = string(
"test/TM/Interference_Bbb/BBB_D_5.976/");
838 arrayOfPolytopes.clear();
839 arrayOfPolytopes.resize(13);
840 {
for (
unsigned int i=1; i<=13; ++i) {
841 cout <<
"############################" << endl;
842 cout <<
"# BBB_D_5.976: truncations #" << endl;
843 cout <<
"############################" << endl;
846 std::vector< boost::shared_ptr<Polytope_Rn> > tmpArrayOfPtop(5);
847 {
for (
unsigned int j=1; j<=5; ++j) {
850 string p_name = string(
"ctl_") + ss1.str();
851 p_name += string(
"_") + ss2.str() + string(
".ptop");
856 cout <<
"##############################" << endl;
857 cout <<
"# BBB_D_5.976: intersections #" << endl;
858 cout <<
"##############################" << endl;
859 {
for (
unsigned int j=1; j<=4; ++j) {
862 arrayOfPolytopes.push_back( tmpArrayOfPtop[0] );
865 checkPtop += path_test2 + string(
"qhull_ctl_");
866 checkPtop += ss1.str() + string(
"_x.ptop");
867 boost::shared_ptr<Polytope_Rn> CP(
new Polytope_Rn());
875 cout <<
"/////////////////////" << endl;
876 cout <<
"// DTL_BPTL/D3-R6 //" << endl;
877 cout <<
"///////////////////" << endl;
878 path_test3 = string(
"test/TM/Interference_Bbb/DTL_BPTL/D3-R6/");
879 arrayOfPolytopes.resize(4);
882 cout <<
"###############################" << endl;
883 cout <<
"# DTL_BPTL/D3-R6: truncations #" << endl;
884 cout <<
"###############################" << endl;
893 boost::shared_ptr<Polytope_Rn> BPHP_BPTL_v(
new Polytope_Rn());
894 boost::shared_ptr<Polytope_Rn> SPAR_BPHP_v(
new Polytope_Rn());
895 boost::shared_ptr<Polytope_Rn> CCCTL_CCCTHP_SPAR_v(
new Polytope_Rn());
896 boost::shared_ptr<Polytope_Rn> DTL2_CCCTL_v(
new Polytope_Rn());
905 cout <<
"#####################################" << endl;
906 cout <<
"# DTL_BPTL/D3-R6: polar truncations #" << endl;
907 cout <<
"#####################################" << endl;
912 {
for (
unsigned int i=0; i<4; ++i) {
913 boost::shared_ptr<Polytope_Rn> thisVPol(
new Polytope_Rn());
916 {
for (iteGN1.
begin(); iteGN1.
end()!=
true; iteGN1.
next()) {
917 thisVPol->addGenerator(iteGN1.
current());
920 arrayOfPolytopes[i] = thisVPol;
926 cout <<
"########################" << endl;
927 cout <<
"# DTL_BPTL/D3-R6: sums #" << endl;
928 cout <<
"########################" << endl;
929 boost::shared_ptr<Polytope_Rn> BPTL_SPAR12(
new Polytope_Rn());
930 boost::shared_ptr<Polytope_Rn> BPTL_SPAR21(
new Polytope_Rn());
931 boost::shared_ptr<Polytope_Rn> BPTL_CCCTL12(
new Polytope_Rn());
932 boost::shared_ptr<Polytope_Rn> BPTL_CCCTL21(
new Polytope_Rn());
933 boost::shared_ptr<Polytope_Rn> BPTL_DTL212(
new Polytope_Rn());
934 boost::shared_ptr<Polytope_Rn> BPTL_DTL221(
new Polytope_Rn());
941 boost::shared_ptr<Polytope_Rn> sumOfArray(
new Polytope_Rn());
944 boost::shared_ptr<Polytope_Rn> qhl_BPTL_SPAR12(
new Polytope_Rn());
945 boost::shared_ptr<Polytope_Rn> qhl_BPTL_CCCTL21(
new Polytope_Rn());
946 boost::shared_ptr<Polytope_Rn> qhl_BPTL_DTL221(
new Polytope_Rn());
966 cout <<
"//////////////////" << endl;
967 cout <<
"// SPECTOMETER //" << endl;
968 cout <<
"////////////////" << endl;
969 cout <<
"#########" << endl;
970 cout <<
"# SUM 1 #" << endl;
971 cout <<
"#########" << endl;
972 string SPEC_path_test = string(
"test/SPECTRO/");
975 boost::shared_ptr<Polytope_Rn> SPEC_sum12(
new Polytope_Rn());
976 boost::shared_ptr<Polytope_Rn> SPEC_sum21(
new Polytope_Rn());
977 boost::shared_ptr<Polytope_Rn> SPEC_polytope1(
new Polytope_Rn());
978 boost::shared_ptr<Polytope_Rn> SPEC_polytope2(
new Polytope_Rn());
979 boost::shared_ptr<Polytope_Rn> SPEC_polytope2test(
new Polytope_Rn());
989 cout <<
"//////////////////////" << endl;
990 cout <<
"// COMPUTE VOLUMES //" << endl;
991 cout <<
"////////////////////" << endl;
992 string Pvol_path_test = string(
"test/VOL/");
995 boost::shared_ptr<Polytope_Rn> Pvol1(
new Polytope_Rn());
996 boost::shared_ptr<Polytope_Rn> Pvol2(
new Polytope_Rn());
997 boost::shared_ptr<Polytope_Rn> Pvol3(
new Polytope_Rn());
998 boost::shared_ptr<Polytope_Rn> Pvol4(
new Polytope_Rn());
999 boost::shared_ptr<Polytope_Rn> Pvol5(
new Polytope_Rn());
1000 boost::shared_ptr<Polytope_Rn> Pvol6(
new Polytope_Rn());
1001 boost::shared_ptr<Polytope_Rn> Pvol7(
new Polytope_Rn());
1002 boost::shared_ptr<Polytope_Rn> Pvol8(
new Polytope_Rn());
1003 boost::shared_ptr<Polytope_Rn> Pvol9(
new Polytope_Rn());
1004 boost::shared_ptr<Polytope_Rn> Pvol10(
new Polytope_Rn());
1005 boost::shared_ptr<Polytope_Rn> Pvol11(
new Polytope_Rn());
1006 boost::shared_ptr<Polytope_Rn> Pvol_cube3d(
new Polytope_Rn());
1007 boost::shared_ptr<Polytope_Rn> Pvol_cube4d(
new Polytope_Rn());
1008 boost::shared_ptr<Polytope_Rn> Pvol_cube5d(
new Polytope_Rn());
1009 boost::shared_ptr<Polytope_Rn> Pvol_cube6d(
new Polytope_Rn());
1036 BOOST_REQUIRE(6.65110e-07 < volume1 && volume1 < 6.65112e-07);
1037 BOOST_REQUIRE(6.07855e-07 < volume2 && volume2 < 6.07857e-07);
1038 BOOST_REQUIRE(1.81130e-06 < volume3 && volume3 < 1.81132e-06);
1039 BOOST_REQUIRE(7.37121e-07 < volume4 && volume4 < 7.37123e-07);
1040 BOOST_REQUIRE(5.73780e-07 < volume5 && volume5 < 5.73782e-07);
1041 BOOST_REQUIRE(3.08791e-06 < volume6 && volume6 < 3.08793e-06);
1042 BOOST_REQUIRE(1.11362e-06 < volume7 && volume7 < 1.11364e-06);
1043 BOOST_REQUIRE(1.54424e-06 < volume8 && volume8 < 1.54426e-06);
1044 BOOST_REQUIRE(1.24113e-05 < volume9 && volume9 < 1.24116e-05);
1045 BOOST_REQUIRE(3.21623e-06 < volume10 && volume10 < 3.21625e-06);
1046 BOOST_REQUIRE(2.55674e-05 < volume11 && volume11 < 2.55676e-05);
1054 BOOST_REQUIRE(volumeC1 == 1000);
1055 BOOST_REQUIRE(volumeC2 == 10000);
1056 BOOST_REQUIRE(volumeC3 == 100000);
1057 BOOST_REQUIRE(volumeC4 == 1000000);
1059 boost::shared_ptr<Polytope_Rn> Pvol_A1(
new Polytope_Rn());
1060 boost::shared_ptr<Polytope_Rn> Pvol_A2(
new Polytope_Rn());
1061 boost::shared_ptr<Polytope_Rn> Pvol_A3(
new Polytope_Rn());
1062 boost::shared_ptr<Polytope_Rn> Pvol_A4(
new Polytope_Rn());
1073 BOOST_REQUIRE(0.124 < volumeA1 && volumeA1 < 0.126);
1074 BOOST_REQUIRE(0.0114730 < volumeA2 && volumeA2 < 0.0114733);
1075 BOOST_REQUIRE(0.015947725 < volumeA3 && volumeA3 < 0.015947727);
1076 BOOST_REQUIRE(38.8410 < volumeA4 && volumeA4 < 38.8412);
1078 boost::shared_ptr<Polytope_Rn> comp1_ptop(
new Polytope_Rn());
1079 boost::shared_ptr<Polytope_Rn> comp1_ppld(
new Polytope_Rn());
1085 BOOST_REQUIRE(0.146472616 < volume_comp1_ptop && volume_comp1_ptop < 0.146472617);
1086 BOOST_REQUIRE(0.146472611 < volume_comp1_ppld && volume_comp1_ppld < 0.146472612);
1089 cout <<
"/////////////////" << endl;
1090 cout <<
"// TEST CUBES //" << endl;
1091 cout <<
"///////////////" << endl;
1094 boost::shared_ptr<Polytope_Rn> cube_0, cube_1, cube_2;
1095 boost::shared_ptr<Polytope_Rn> res_cube_a(
new Polytope_Rn());
1096 boost::shared_ptr<Polytope_Rn> res_cube_b(
new Polytope_Rn());
1100 cube_0->checkTopologyAndGeometry();
1101 cube_1->checkTopologyAndGeometry();
1103 res_cube_a->checkTopologyAndGeometry();
1107 cout <<
"/////////////////////////////" << endl;
1108 cout <<
"// REMOVE CAP HALF-SPACES //" << endl;
1109 cout <<
"///////////////////////////" << endl;
1112 string ppiston = string(
"test/CAPS/PISTON/5D/");
1114 boost::shared_ptr<Polytope_Rn> P1_5D(
new Polytope_Rn());
1115 boost::shared_ptr<Polytope_Rn> P2_5D(
new Polytope_Rn());
1116 boost::shared_ptr<Polytope_Rn> P3_5D(
new Polytope_Rn());
1117 boost::shared_ptr<Polytope_Rn> P4_5D(
new Polytope_Rn());
1126 boost::shared_ptr<Polytope_Rn> ps_P12_5D_S1(
new Polytope_Rn());
1127 boost::shared_ptr<Polytope_Rn> ps_P12_5D_S2(
new Polytope_Rn());
1128 boost::shared_ptr<Polytope_Rn> ps_P123_5D_S1(
new Polytope_Rn());
1129 boost::shared_ptr<Polytope_Rn> ps_P123_5D_S2(
new Polytope_Rn());
1130 boost::shared_ptr<Polytope_Rn> ps_P1234_5D_S1(
new Polytope_Rn());
1131 boost::shared_ptr<Polytope_Rn> ps_P1234_5D_S2(
new Polytope_Rn());
1132 std::set< unsigned int > P1Caps, P2Caps, P3Caps, P4Caps;
1133 std::set< unsigned int > Sum12Caps, Sum123Caps, Sum1234Caps;
1134 {
for (
unsigned int i=0; i<2; ++i) {
1139 {
for (
unsigned int i=0; i<4; ++i) {
1142 cout <<
"############################" << endl;
1143 cout <<
"# pseudosum: P1 + P2 = P12 #" << endl;
1144 cout <<
"############################" << endl;
1148 cout <<
"##############################" << endl;
1149 cout <<
"# pseudosum: P12 + P3 = P123 #" << endl;
1150 cout <<
"##############################" << endl;
1154 cout <<
"################################" << endl;
1155 cout <<
"# pseudosum: P123 + P4 = P1234 #" << endl;
1156 cout <<
"################################" << endl;
1161 boost::shared_ptr<Polytope_Rn> polP12_5D(
new Polytope_Rn());
1162 boost::shared_ptr<Polytope_Rn> shgP12_5D(
new Polytope_Rn());
1163 boost::shared_ptr<Polytope_Rn> polP123_5D(
new Polytope_Rn());
1164 boost::shared_ptr<Polytope_Rn> shgP123_5D(
new Polytope_Rn());
1165 boost::shared_ptr<Polytope_Rn> polP1234_5D(
new Polytope_Rn());
1166 boost::shared_ptr<Polytope_Rn> shgP1234_5D(
new Polytope_Rn());
1167 cout <<
"############################" << endl;
1168 cout <<
"# with caps: P1 + P2 = P12 #" << endl;
1169 cout <<
"############################" << endl;
1173 cout <<
"##############################" << endl;
1174 cout <<
"# with caps: P12 + P3 = P123 #" << endl;
1175 cout <<
"##############################" << endl;
1179 cout <<
"################################" << endl;
1180 cout <<
"# with caps: P123 + P4 = P1234 #" << endl;
1181 cout <<
"################################" << endl;
1186 std::set< unsigned int > hyperplanes2project2D;
1187 hyperplanes2project2D.insert(3);
1188 hyperplanes2project2D.insert(4);
1189 boost::shared_ptr<Polytope_Rn> proj_polP1234_5D(
new Polytope_Rn());
1190 boost::shared_ptr<Polytope_Rn> proj_ps_P1234_5D_S1(
new Polytope_Rn());
1195 boost::shared_ptr<Polytope_Rn> finalP2D(
new Polytope_Rn());
1199 string path_test_caps = string(
"test/CAPS/");
1200 {
for (
int i=1; i<argc; ++i) {
1201 if (strcmp(argv[i],
"piston") == 0) {
1204 cout <<
"##########" << endl;
1205 cout <<
"# Piston #" << endl;
1206 cout <<
"##########" << endl;
1207 string path_test_caps_piston = path_test_caps+string(
"PISTON/");
1208 boost::shared_ptr<Polytope_Rn> pist1_TestCaps(
new Polytope_Rn());
1209 boost::shared_ptr<Polytope_Rn> pist2_TestCaps(
new Polytope_Rn());
1210 boost::shared_ptr<Polytope_Rn> pist_Sum_TestCaps(
new Polytope_Rn());
1211 boost::shared_ptr<Polytope_Rn> pist_Sum_TestCaps_check(
new Polytope_Rn());
1214 std::set< unsigned int > PO1Caps, PO2Caps, PSum_1Caps_;
1215 PO1Caps.insert(0); PO1Caps.insert(1); PO1Caps.insert(2); PO1Caps.insert(3);
1216 PO2Caps.insert(0); PO2Caps.insert(1); PO2Caps.insert(2); PO2Caps.insert(3);
1224 cout <<
"#########" << endl;
1225 cout <<
"# R3 Ex #" << endl;
1226 cout <<
"#########" << endl;
1227 boost::shared_ptr<Polytope_Rn> p1_TestCaps(
new Polytope_Rn());
1228 boost::shared_ptr<Polytope_Rn> p2_TestCaps(
new Polytope_Rn());
1229 boost::shared_ptr<Polytope_Rn> Sum_TestCaps(
new Polytope_Rn());
1230 boost::shared_ptr<Polytope_Rn> Sum_TestCaps_check(
new Polytope_Rn());
1233 std::set< unsigned int > O1Caps, O2Caps, Sum_1Caps_;
1234 O1Caps.insert(0); O1Caps.insert(1); O1Caps.insert(3); O1Caps.insert(4);
1239 cout <<
"###########" << endl;
1240 cout <<
"# CIRP R6 #" << endl;
1241 cout <<
"###########" << endl;
1244 boost::shared_ptr<Polytope_Rn> p1_TestCaps_b(
new Polytope_Rn());
1245 boost::shared_ptr<Polytope_Rn> p2_TestCaps_b(
new Polytope_Rn());
1246 boost::shared_ptr<Polytope_Rn> Sum_TestCaps_b(
new Polytope_Rn());
1247 boost::shared_ptr<Polytope_Rn> Sum_TestCaps_check_b(
new Polytope_Rn());
1250 std::set< unsigned int > O1Caps_b, O2Caps_b, Sum_1Caps_b;
1251 O1Caps_b.insert(0); O1Caps_b.insert(1); O1Caps_b.insert(2); O1Caps_b.insert(3); O1Caps_b.insert(4); O1Caps_b.insert(5);
1252 O2Caps_b.insert(0); O2Caps_b.insert(1); O2Caps_b.insert(2); O2Caps_b.insert(3); O2Caps_b.insert(4); O2Caps_b.insert(5);
1257 cout <<
"############" << endl;
1258 cout <<
"# SPEC CAP #" << endl;
1259 cout <<
"############" << endl;
1262 string path_test_caps2 = string(
"test/CAPS/spec_small_disc/");
1263 boost::shared_ptr<Polytope_Rn> Pc_21(
new Polytope_Rn());
1264 boost::shared_ptr<Polytope_Rn> Pc_22(
new Polytope_Rn());
1265 boost::shared_ptr<Polytope_Rn> Pc_23(
new Polytope_Rn());
1266 boost::shared_ptr<Polytope_Rn> Pc_24(
new Polytope_Rn());
1267 boost::shared_ptr<Polytope_Rn> Pc_25(
new Polytope_Rn());
1268 boost::shared_ptr<Polytope_Rn> Pc_26(
new Polytope_Rn());
1269 boost::shared_ptr<Polytope_Rn> Pg_37(
new Polytope_Rn());
1270 boost::shared_ptr<Polytope_Rn> Pg_38(
new Polytope_Rn());
1271 boost::shared_ptr<Polytope_Rn> Pg_14(
new Polytope_Rn());
1272 cout <<
"#########################" << endl;
1273 cout <<
"# SPEC CAP: truncations #" << endl;
1274 cout <<
"#########################" << endl;
1293 std::set< unsigned int > Int_1Caps, Int_2Caps, Sum_1Caps, Sum_1_s2Caps, P_11_20_FC1Caps, P_20_30_FC1Caps;
1294 std::set< unsigned int > Pc_21Caps, Pc_22Caps, Pc_23Caps, Pc_24Caps, Pc_25Caps, Pc_26Caps, Pg_37Caps;
1295 {
for (
unsigned int i=0; i<8; ++i) {
1296 Pc_21Caps.insert(i);Pc_22Caps.insert(i);
1298 {
for (
unsigned int i=0; i<6; ++i) {
1299 Pc_23Caps.insert(i);Pc_24Caps.insert(i);
1301 {
for (
unsigned int i=0; i<4; ++i) {
1302 Pg_37Caps.insert(i);
1304 Pc_25Caps.insert(0);Pc_26Caps.insert(0);Pc_25Caps.insert(1);Pc_26Caps.insert(1);Pc_25Caps.insert(6);Pc_26Caps.insert(6);Pc_25Caps.insert(7);Pc_26Caps.insert(7);
1306 cout <<
"######################" << endl;
1307 cout <<
"# Operations for FC1 #" << endl;
1308 cout <<
"######################" << endl;
1309 boost::shared_ptr<Polytope_Rn> Int_1, Int_2, P_11_20_FC1, P_20_30_FC1;
1310 boost::shared_ptr<Polytope_Rn> Sum_1(
new Polytope_Rn()); boost::shared_ptr<Polytope_Rn> Sum_1_s2(
new Polytope_Rn());
1321 cout <<
"#########################################" << endl;
1322 cout <<
"# Polytope from node 1.0 to 3.0 for FC1 #" << endl;
1323 cout <<
"#########################################" << endl;
1324 boost::shared_ptr<Polytope_Rn> P_11_30_FC1_s1(
new Polytope_Rn()); boost::shared_ptr<Polytope_Rn> P_11_30_FC1_s2(
new Polytope_Rn());
1325 std::set< unsigned int > P_11_30_FC1_s2Caps, P_11_30_FC1_s1Caps;
1326 BOOST_REQUIRE(
politopixAPI::pseudoSum(P_20_30_FC1, P_11_20_FC1, P_11_30_FC1_s2, P_20_30_FC1Caps, P_11_20_FC1Caps, P_11_30_FC1_s2Caps) ==
TEST_OK );
1327 BOOST_REQUIRE(
politopixAPI::pseudoSum(P_11_20_FC1, P_20_30_FC1, P_11_30_FC1_s1, P_11_20_FC1Caps, P_20_30_FC1Caps, P_11_30_FC1_s1Caps) ==
TEST_OK );
1330 cout <<
"#####################" << endl;
1331 cout <<
"# Final sum for FC1 #" << endl;
1332 cout <<
"#####################" << endl;
1333 boost::shared_ptr<Polytope_Rn> Pfin_FC1_s1(
new Polytope_Rn()); boost::shared_ptr<Polytope_Rn> Pfin_FC1_s2(
new Polytope_Rn());
1334 std::set< unsigned int > Pfin_FC1_s1Caps, Pfin_FC1_s2Caps;
1339 boost::shared_ptr<Polytope_Rn> final_sant(
new Polytope_Rn());
1346 cout <<
"#############################" << endl;
1347 cout <<
"# Simulation cutting system #" << endl;
1348 cout <<
"#############################" << endl;
1351 string path_test_cutting = string(
"test/AFILADO/");
1352 boost::shared_ptr<Polytope_Rn> P11(
new Polytope_Rn());
1353 boost::shared_ptr<Polytope_Rn> P33_43(
new Polytope_Rn());
1354 boost::shared_ptr<Polytope_Rn> P34_44(
new Polytope_Rn());
1355 boost::shared_ptr<Polytope_Rn> P41(
new Polytope_Rn());
1356 cout <<
"########################" << endl;
1357 cout <<
"# CUTTING: truncations #" << endl;
1358 cout <<
"########################" << endl;
1367 boost::shared_ptr<Polytope_Rn> P30_40(
new Polytope_Rn());
1368 boost::shared_ptr<Polytope_Rn> P11_41S2(
new Polytope_Rn());
1369 boost::shared_ptr<Polytope_Rn> P11_41S1(
new Polytope_Rn());
1370 boost::shared_ptr<Polytope_Rn> PfinS1(
new Polytope_Rn());
1371 boost::shared_ptr<Polytope_Rn> PfinS2(
new Polytope_Rn());
1372 boost::shared_ptr<Polytope_Rn> PfinS3(
new Polytope_Rn());
1373 std::set< unsigned int > P11Caps, P33_43Caps, P34_44Caps, P41Caps;
1374 std::set< unsigned int > P30_40Caps, P11_41Caps, PfinCaps;
1375 {
for (
unsigned int i=0; i<10; ++i) {
1376 P34_44Caps.insert(i);
1378 {
for (
unsigned int i=0; i<4; ++i) {
1381 P33_43Caps.insert(i);
1384 cout <<
"##############" << endl;
1385 cout <<
"# Operations #" << endl;
1386 cout <<
"##############" << endl;
1391 cout <<
"#############" << endl;
1392 cout <<
"# Final sum #" << endl;
1393 cout <<
"#############" << endl;
1401 cout <<
"###################" << endl;
1402 cout <<
"# DATA1: Lattices #" << endl;
1403 cout <<
"###################" << endl;
1405 path_test1 = string(
"./test/DATA1/");
1413 std::vector< std::vector< ListOfFaces > > Lattice2Compare;
1424 Lattice2Compare.clear();
1436 Lattice2Compare.clear();
1448 Lattice2Compare.clear();
1460 Lattice2Compare.clear();
1465 cout <<
"###############" << endl;
1466 cout <<
"# PROJECTIONS #" << endl;
1467 cout <<
"###############" << endl;
1471 {
for (
unsigned int i=0; i<6; ++i) {
1472 H1->setCoefficient(i,0);
1473 H2->setCoefficient(i,0);
1474 H3->setCoefficient(i,0);
1476 H1->setCoefficient(0,1);
1477 H2->setCoefficient(1,1);
1478 H3->setCoefficient(2,1);
1482 std::vector< boost::shared_ptr<HalfSpace_Rn> > arrayOfHS;
1483 arrayOfHS.push_back(H1);
1484 arrayOfHS.push_back(H2);
1485 arrayOfHS.push_back(H3);
1490 string pcaps = string(
"test/PROJ/");
1495 std::set< unsigned int > hyperplanes2project;
1496 hyperplanes2project.insert(1);hyperplanes2project.insert(2);hyperplanes2project.insert(3);
1511 hyperplanes2project.clear();
1512 hyperplanes2project.insert(1);hyperplanes2project.insert(2);hyperplanes2project.insert(3);
1527 hyperplanes2project.clear();
1528 hyperplanes2project.insert(1);hyperplanes2project.insert(2);hyperplanes2project.insert(3);
1543 hyperplanes2project.clear();
1544 hyperplanes2project.insert(1);hyperplanes2project.insert(2);hyperplanes2project.insert(3);
1559 hyperplanes2project.clear();
1560 hyperplanes2project.insert(1);hyperplanes2project.insert(2);hyperplanes2project.insert(3);
1578 hyperplanes2project.clear();
1579 hyperplanes2project.insert(1);hyperplanes2project.insert(2);hyperplanes2project.insert(3);
1591 cout <<
"#####################" << endl;
1592 cout <<
"# TRACING GENERATORS #" << endl;
1593 cout <<
"#####################" << endl;
1596 string tal_path(
"test/TALADRO/");
1602 std::vector< std::vector<int> > genitorsOfTal_CP1(Tal_CP1->numberOfGenerators());
1603 std::vector< std::vector<int> > genitorsOfTal_CP2(Tal_CP2->numberOfGenerators());
1604 std::vector< std::vector<int> > genitorsOfTal_CP3(Tal_CP3->numberOfGenerators());
1605 std::vector< std::vector<int> > genitorsOfTal_CP_1_2,genitorsOfTal_CP_1_2_3;
1607 for (
unsigned int i=0; i<genitorsOfTal_CP1.size(); ++i)
1608 genitorsOfTal_CP1[i].push_back(i);
1609 for (
unsigned int j=0; j<genitorsOfTal_CP2.size(); ++j)
1610 genitorsOfTal_CP2[j].push_back(j);
1611 for (
unsigned int j=0; j<genitorsOfTal_CP3.size(); ++j)
1612 genitorsOfTal_CP3[j].push_back(j);
1621 for (
unsigned int i=0; i<genitorsOfTal_CP_1_2.size(); ++i) {
1622 boost::shared_ptr<Generator_Rn> VX(
new Generator_Rn(thisDim));
1623 VX->makeSum(Tal_CP1->getGenerator(genitorsOfTal_CP_1_2[i][0]), Tal_CP2->getGenerator(genitorsOfTal_CP_1_2[i][1]));
1624 BOOST_REQUIRE( VX->isEqual2(Tal_SUM12->getGenerator(i), thisDim, tol_2) ==
true );
1626 for (
unsigned int i=0; i<genitorsOfTal_CP_1_2_3.size(); ++i) {
1628 VX_1_2->makeSum(Tal_CP1->getGenerator(genitorsOfTal_CP_1_2_3[i][0]), Tal_CP2->getGenerator(genitorsOfTal_CP_1_2_3[i][1]));
1629 VX->makeSum(VX_1_2, Tal_CP3->getGenerator(genitorsOfTal_CP_1_2_3[i][2]));
1630 BOOST_REQUIRE( VX->isEqual2(Tal_SUM123->getGenerator(i), thisDim, tol_2) ==
true );