Changeset 1324 for applications/robust/robustlib.cpp
- Timestamp:
- 04/07/11 18:33:51 (13 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/robust/robustlib.cpp
r1320 r1324 4 4 void polyhedron::triangulate(bool should_integrate) 5 5 { 6 for(set<simplex*>::iterator t_ref = triangulation.begin();t_ref!=triangulation.end();t_ref++) 7 { 8 delete (*t_ref); 9 } 6 10 triangulation.clear(); 7 11 … … 13 17 if(vertices.size()==1) 14 18 { 15 set<vertex*> vert_simplex; 16 vert_simplex.insert((vertex*)this); 17 18 triangulation.insert(pair<double,set<vertex*>>(0,vert_simplex)); 19 simplex* vert_simplex = new simplex((vertex*)this); 20 21 triangulation.insert(vert_simplex); 19 22 } 20 23 21 24 for(list<polyhedron*>::iterator child_ref = children.begin();child_ref!=children.end();child_ref++) 22 25 { 23 for(map<double,set<vertex*>>::iterator t_ref = (*child_ref)->triangulation.begin();t_ref!=(*child_ref)->triangulation.end();t_ref++) 24 { 25 set<vertex*> new_simplex; 26 new_simplex.insert((*t_ref).second.begin(),(*t_ref).second.end()); 27 28 pair<set<vertex*>::iterator,bool> ret_val = new_simplex.insert(*vertices.begin()); 26 for(set<simplex*>::iterator s_ref = (*child_ref)->triangulation.begin();s_ref!=(*child_ref)->triangulation.end();s_ref++) 27 { 28 simplex* new_simplex = new simplex((*s_ref)->vertices); 29 30 pair<set<vertex*>::iterator,bool> ret_val = new_simplex->vertices.insert(*vertices.begin()); 29 31 30 32 if(ret_val.second == true) … … 39 41 } 40 42 41 triangulation.insert(pair<double,set<vertex*>>(cur_prob,new_simplex)); 42 } 43 triangulation.insert(new_simplex); 44 } 45 else 46 { 47 delete new_simplex; 48 } 43 49 } 44 50 } … … 71 77 72 78 73 double toprow::integrate_simplex(s et<vertex*>simplex, char c)79 double toprow::integrate_simplex(simplex* simplex, char c) 74 80 { 75 81 // cout << ((toprow*)this)->condition << endl; … … 107 113 // cout << as_toprow->condition << endl; 108 114 109 int dimension = simplex .size()-1;115 int dimension = simplex->vertices.size()-1; 110 116 111 117 mat jacobian(dimension,dimension); … … 114 120 map<double,int> as; 115 121 vertex* base_vertex; 116 set<vertex*>::iterator base_ref = simplex .begin();122 set<vertex*>::iterator base_ref = simplex->vertices.begin(); 117 123 bool order_correct; 118 124 … … 132 138 133 139 int row_count = 0; 134 for(set<vertex*>::iterator vert_ref = simplex .begin(); vert_ref!=simplex.end();vert_ref++)140 for(set<vertex*>::iterator vert_ref = simplex->vertices.begin(); vert_ref!=simplex->vertices.end();vert_ref++) 135 141 { 136 142 if(vert_ref != base_ref) … … 146 152 base_ref++; 147 153 148 if(base_ref == simplex .end())154 if(base_ref == simplex->vertices.end()) 149 155 { 150 156 throw new exception("Equal local conditions are paired. If this ever occurs, the software has to be modified to include multiplied a_0!!"); … … 285 291 286 292 287 //cout << "Probability:" << int_value << endl; 288 289 return int_value; 290 291 293 // cout << "Probability:" << int_value << endl; 294 // pause(0.100); 295 296 simplex->probability = int_value; 297 298 return int_value; 292 299 293 300 }