Files Classes Functions Hierarchy
00001 #include <cassert> 00002 #include <iostream> 00003 #include <sstream> 00004 using namespace std; 00005 00006 #include <polytopeD2linked.h> 00007 #include <print.h> 00008 00009 boolc polytopeD2linked::niInverseHas( uintc neib ) const 00010 { 00011 // Let the client as if there are null neighbors. 00012 //assert(neib!=0); 00013 00014 for (uint i=0; i<ni.size(); ++i) 00015 { 00016 // if (ni[i]==0) 00017 // continue; 00018 00019 if (ni[i]==neib) 00020 return true; 00021 } 00022 00023 return false; 00024 } 00025 00026 polytopeD2linked::polytopeD2linked 00027 ( 00028 uintc p0, uintc p1, 00029 uintc n0, uintc n1 00030 ) 00031 { 00032 pi.push_back(p0); 00033 pi.push_back(p1); 00034 00035 ni.push_back(n0); 00036 ni.push_back(n1); 00037 } 00038 00039 polytopeD2linked::polytopeD2linked 00040 ( 00041 uintc p0, uintc p1, uintc p2, 00042 uintc n0, uintc n1, uintc n2 00043 ) 00044 { 00045 pi.push_back(p0); 00046 pi.push_back(p1); 00047 pi.push_back(p2); 00048 00049 ni.push_back(n0); 00050 ni.push_back(n1); 00051 ni.push_back(n2); 00052 } 00053 00054 00055 polytopeD2linked::polytopeD2linked 00056 ( 00057 uintc p0, uintc p1, uintc p2, uintc p3, 00058 uintc n0, uintc n1, uintc n2, uintc n3 00059 ) 00060 { 00061 pi.push_back(p0); 00062 pi.push_back(p1); 00063 pi.push_back(p2); 00064 pi.push_back(p3); 00065 00066 ni.push_back(n0); 00067 ni.push_back(n1); 00068 ni.push_back(n2); 00069 ni.push_back(n3); 00070 } 00071 00072 polytopeD2linked::polytopeD2linked 00073 ( 00074 uintc p0, uintc p1, uintc p2, uintc p3, uintc p4, 00075 uintc n0, uintc n1, uintc n2, uintc n3, uintc n4 00076 ) 00077 { 00078 pi.push_back(p0); 00079 pi.push_back(p1); 00080 pi.push_back(p2); 00081 pi.push_back(p3); 00082 pi.push_back(p4); 00083 00084 ni.push_back(n0); 00085 ni.push_back(n1); 00086 ni.push_back(n2); 00087 ni.push_back(n3); 00088 ni.push_back(n4); 00089 } 00090 00091 polytopeD2linked::polytopeD2linked 00092 ( 00093 uintc p0, uintc p1, uintc p2, uintc p3, uintc p4, uintc p5, 00094 uintc n0, uintc n1, uintc n2, uintc n3, uintc n4, uintc n5 00095 ) 00096 { 00097 pi.push_back(p0); 00098 pi.push_back(p1); 00099 pi.push_back(p2); 00100 pi.push_back(p3); 00101 pi.push_back(p4); 00102 pi.push_back(p5); 00103 00104 ni.push_back(n0); 00105 ni.push_back(n1); 00106 ni.push_back(n2); 00107 ni.push_back(n3); 00108 ni.push_back(n4); 00109 ni.push_back(n5); 00110 } 00111 00112 polytopeD2linked::polytopeD2linked 00113 ( 00114 uintc p0, uintc p1, uintc p2, uintc p3, uintc p4, uintc p5, uintc p6, 00115 uintc n0, uintc n1, uintc n2, uintc n3, uintc n4, uintc n5, uintc n6 00116 ) 00117 { 00118 pi.push_back(p0); 00119 pi.push_back(p1); 00120 pi.push_back(p2); 00121 pi.push_back(p3); 00122 pi.push_back(p4); 00123 pi.push_back(p5); 00124 pi.push_back(p6); 00125 00126 ni.push_back(n0); 00127 ni.push_back(n1); 00128 ni.push_back(n2); 00129 ni.push_back(n3); 00130 ni.push_back(n4); 00131 ni.push_back(n5); 00132 ni.push_back(n6); 00133 } 00134 00135 polytopeD2linked::polytopeD2linked 00136 ( 00137 uintc p0, uintc p1, uintc p2, uintc p3, uintc p4, uintc p5, uintc p6, uintc p7, 00138 uintc n0, uintc n1, uintc n2, uintc n3, uintc n4, uintc n5, uintc n6, uintc n7 00139 ) 00140 { 00141 pi.push_back(p0); 00142 pi.push_back(p1); 00143 pi.push_back(p2); 00144 pi.push_back(p3); 00145 pi.push_back(p4); 00146 pi.push_back(p5); 00147 pi.push_back(p6); 00148 pi.push_back(p7); 00149 00150 ni.push_back(n0); 00151 ni.push_back(n1); 00152 ni.push_back(n2); 00153 ni.push_back(n3); 00154 ni.push_back(n4); 00155 ni.push_back(n5); 00156 ni.push_back(n6); 00157 ni.push_back(n7); 00158 } 00159 00160 polytopeD2linked::operator string() const 00161 { 00162 string s; 00163 uint sz = pi.size(); 00164 { stringstream ss; ss << sz; s+=ss.str(); s += " "; } 00165 for (uint i=0; i<sz; ++i) 00166 { 00167 { stringstream ss; ss << pi[i]; s+=ss.str(); } 00168 s += " "; 00169 } 00170 00171 s += " "; 00172 00173 for (uint i=0; i<sz; ++i) 00174 { 00175 { stringstream ss; ss << ni[i]; s+=ss.str(); } 00176 s += " "; 00177 } 00178 00179 return s; 00180 } 00181 00182 00183 void polytopeD2linked::addpoint( uintc ptindex, uintc ptglobal ) 00184 { 00185 //cout << SHOW(ptindex) << endl; 00186 //cout << SHOW(ptglobal) << endl; 00187 uintc i0 = piInverse(ptindex); 00188 //cout << SHOW(i0) << endl; 00189 uint sz = pi.size(); 00190 pi.resize(sz+1); 00191 ni.resize(sz+1); 00192 00193 uint k=sz; 00194 uintc imax = sz-i0; 00195 00196 for (uint i=0; i<imax; ++i) 00197 { 00198 pi[k] = pi[k-1]; 00199 ni[k] = ni[k-1]; 00200 --k; 00201 } 00202 00203 pi[(i0+1)%(sz+1)] = ptglobal; 00204 } 00205 00206 00207
1.5.8