proj home

Files   Classes   Functions   Hierarchy  

simplexD1listlinkedtest.cpp

Go to the documentation of this file.
00001 #include <cassert>
00002 #include <iostream>
00003 #include <vector>
00004 using namespace std;
00005 
00006 #include <simplexD1linked.h>
00007 #include <simplexD1listlinked.h>
00008 #include <simplexD1listlinkedtest.h>
00009 #include <typedefs.h>
00010 
00011 
00012 string simplexD1listlinkedtest::doc[] =
00013 { 
00014   "",
00015   "Reading a simplexD1list from a vector.",
00016   "Test simplexD1listlinked::serializeInverse",
00017   "Given a list of lines/segments link them up."
00018 };
00019 
00020 
00021 void simplexD1listlinkedtest::test01()
00022 {
00023   cout << doc[1] << endl;
00024 
00025   typedef vector< simplexD1linked<uint> > vec;
00026   vec v2(8);
00027   simplexD1listlinked< vec &, uint > s1(v2,8);   
00028  
00029   uint v[] = 
00030   { 
00031     0, 0, 
00032     2, 6,
00033     7, 5,
00034     4, 1,
00035     5, 4,
00036     6, 1,
00037     3, 7,
00038     2, 3
00039   }; 
00040   s1.readindexed(v);
00041 
00042   string str = (string)s1;
00043   cout << str << endl << endl;
00044 }
00045 
00046 
00047 void simplexD1listlinkedtest::test02()
00048 {
00049   cout << doc[2] << endl;
00050  
00051   typedef vector< simplexD1linked<uint> > vec;
00052   vec v2(8);
00053   simplexD1listlinked< vec &, uint > s1(v2,8);   
00054  
00055   uint v[] = 
00056   { 
00057     0, 0, 
00058     2, 6,
00059     7, 5,
00060     4, 1,
00061     5, 4,
00062     6, 1,
00063     3, 7,
00064     2, 3
00065   }; 
00066   s1.readindexed(v);
00067 
00068   string str = (string)s1;
00069   cout << "Writing the target string" << endl;
00070   cout << "********" << endl; 
00071   cout << str << endl;
00072   cout << "********" << endl; 
00073   cout << "Attempting to read the target string" << endl;
00074 
00075   vec v3(8);
00076   simplexD1listlinked< vec &, uint > s2(v3,8);
00077   s2.serializeInverse(str);
00078   cout << "Writing what was read in" << endl;
00079   cout << "********" << endl; 
00080   cout << (string)s2 << endl;
00081   cout << "********" << endl; 
00082 }
00083 
00084 
00085 void simplexD1listlinkedtest::test03()
00086 {
00087   cout << doc[3] << endl;
00088 
00089   typedef vector< simplexD1linked<uint> > vec;
00090   vec v2(8);
00091   simplexD1listlinked< vec &, uint > s1(v2,8);   
00092  
00093   uint v[] = 
00094   { 
00095     0, 0, 
00096     2, 6,
00097     7, 5,
00098     4, 1,
00099     5, 4,
00100     6, 1,
00101     3, 7,
00102     2, 3
00103   }; 
00104   s1.readindexed(v);
00105 
00106   cout << "Line segements" << endl;
00107   cout << (string)s1 << endl << endl;
00108 
00109   s1.makelinks(7);
00110 
00111   cout << "Printing result" << endl;
00112   cout << (string)s1 << endl;
00113   cout << "Consistant winding" << endl;
00114   s1.consistantwinding();
00115   cout << (string)s1 << endl;
00116 }
00117 
00118 
00119 

Generated on Fri Mar 4 00:49:31 2011 for Chelton Evans Source by  doxygen 1.5.8