Changeset 1356 for applications

Show
Ignore:
Timestamp:
05/04/11 18:21:26 (13 years ago)
Author:
sindj
Message:

Opravena chyba s mazanim udaju v polyhedronu pres ktery se nemerguje kvuli vyssi nasobnosti stredu. JS

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/robust/robustlib.h

    r1349 r1356  
    804804                                bool is_first = (current_parent->message_counter == 1); 
    805805 
     806                                bool out_of_the_game = true; 
     807 
    806808                                if(shouldmerge) 
    807809                                { 
     
    826828                                                if(parent_state == 1) 
    827829                                                { 
    828                                                         ((toprow*)current_parent)->condition_sum-=toremove->value; 
    829                                                         ((toprow*)current_parent)->condition_order--; 
     830                                                        ((toprow*)current_parent)->condition_sum-=toremove->value;                                                       
    830831                                                } 
    831832 
    832833                                                if(parent_state == -1) 
    833834                                                { 
    834                                                         ((toprow*)current_parent)->condition_sum+=toremove->value; 
    835                                                         ((toprow*)current_parent)->condition_order--; 
     835                                                        ((toprow*)current_parent)->condition_sum+=toremove->value;                                                       
    836836                                                } 
     837 
     838                                                ((toprow*)current_parent)->condition_order--; 
     839                                                 
    837840                                                 
    838841                                                if(current_parent->mergechild != NULL) 
    839842                                                { 
     843                                                        out_of_the_game = false; 
     844 
    840845                                                        if(current_parent->mergechild->get_multiplicity()==1) 
    841846                                                        { 
     
    849854                                                                        current_parent->mergechild->negativeparent = current_parent;                                                     
    850855                                                                } 
    851                                                         }                                                        
     856                                                        } 
     857                                                        else 
     858                                                        { 
     859                                                                out_of_the_game = true; 
     860                                                        } 
    852861                                                }                                                
    853                                                 else 
     862                                                 
     863                                                if(out_of_the_game) 
    854864                                                { 
    855865                                                        //current_parent->set_state(0,MERGE);    
     
    985995                                                        } 
    986996 
    987                                                         if(current_parent->mergechild == NULL) 
     997                                                        if(out_of_the_game) 
    988998                                                        { 
    989999                                                                current_parent->positivechildren.clear(); 
     
    10761086                                // cout << "Stepped." << endl; 
    10771087 
     1088                                if(marker==101) 
     1089                                { 
     1090                                        if(!(*horiz_ref).negativechildren.empty()||!(*horiz_ref).positivechildren.empty()||!(*horiz_ref).neutralchildren.empty()||!(*horiz_ref).kids_rel_addresses.empty()||!(*horiz_ref).mergechild==NULL||!(*horiz_ref).negativeneutralvertices.empty()) 
     1091                                        { 
     1092                                                cout << "Cleaning error!" << endl; 
     1093                                        } 
     1094                                 
     1095                                } 
     1096 
    10781097                                for(set<simplex*>::iterator sim_ref = (*horiz_ref).triangulation.begin();sim_ref!=(*horiz_ref).triangulation.end();sim_ref++) 
    10791098                                { 
     
    12851304                                        local_condition = appended_coords*toadd; 
    12861305 
    1287                                         cout << "Vertex multiplicity: "<< current_vertex->get_multiplicity() << endl; 
     1306                                        // cout << "Vertex multiplicity: "<< current_vertex->get_multiplicity() << endl; 
    12881307 
    12891308                                        current_vertex->set_state(local_condition,SPLIT); 
     
    13391358                } 
    13401359 
    1341                 //step_me(1); 
     1360                // step_me(1); 
    13421361                 
    13431362                if(should_remove) 
     
    13761395                                                { 
    13771396                                                        (*merge_ref)->lower_multiplicity(); 
     1397                                                }        
     1398 
     1399                                                if((*merge_ref)->get_state(SPLIT)!=0||(*merge_ref)->totally_neutral) 
     1400                                                { 
     1401                                                        (*merge_ref)->positivechildren.clear(); 
     1402                                                        (*merge_ref)->negativechildren.clear(); 
     1403                                                        (*merge_ref)->neutralchildren.clear();                                           
     1404                                                        (*merge_ref)->totallyneutralgrandchildren.clear();                                               
     1405                                                        (*merge_ref)->positiveneutralvertices.clear(); 
     1406                                                        (*merge_ref)->negativeneutralvertices.clear(); 
     1407                                                        (*merge_ref)->totally_neutral = NULL; 
     1408                                                        (*merge_ref)->kids_rel_addresses.clear(); 
    13781409                                                } 
    13791410                                        } 
     
    13841415                                                toprow* current_positive = (toprow*)(*merge_ref)->positiveparent; 
    13851416                                                toprow* current_negative = (toprow*)(*merge_ref)->negativeparent; 
     1417 
     1418                                                if(current_positive->totally_neutral!=current_negative->totally_neutral) 
     1419                                                { 
     1420                                                        throw new exception("Both polyhedrons must be totally neutral if they should be merged!"); 
     1421                                                } 
    13861422 
    13871423                                                //current_positive->condition_sum -= toremove; 
     
    14391475                                                        current_positive->set_state(0,SPLIT); 
    14401476                                                        for_splitting[k].push_back(current_positive); 
     1477 
    14411478                                                        will_be_split = true; 
    14421479                                                } 
     
    14771514                                                } 
    14781515                                                else 
    1479                                                 { 
    1480                                                         if(!current_positive->totally_neutral) 
    1481                                                         { 
    1482                                                                 current_positive->positivechildren.clear(); 
    1483                                                                 current_positive->negativechildren.clear(); 
    1484                                                                 current_positive->neutralchildren.clear(); 
    1485                                                                 // current_positive->totallyneutralchildren.clear(); 
    1486                                                                 current_positive->totallyneutralgrandchildren.clear();                                                           
    1487                                                                 current_positive->positiveneutralvertices.clear(); 
    1488                                                                 current_positive->negativeneutralvertices.clear(); 
    1489                                                                 current_positive->totally_neutral = NULL; 
    1490                                                                 current_positive->kids_rel_addresses.clear();                                                            
    1491                                                         } 
    1492                                                  
    1493                                                 } 
    1494  
    1495                                                                                                  
     1516                                                {                                                        
     1517                                                        current_positive->positivechildren.clear(); 
     1518                                                        current_positive->negativechildren.clear(); 
     1519                                                        current_positive->neutralchildren.clear(); 
     1520                                                        // current_positive->totallyneutralchildren.clear(); 
     1521                                                        current_positive->totallyneutralgrandchildren.clear();                                                           
     1522                                                        current_positive->positiveneutralvertices.clear(); 
     1523                                                        current_positive->negativeneutralvertices.clear(); 
     1524                                                        current_positive->totally_neutral = NULL; 
     1525                                                        current_positive->kids_rel_addresses.clear();                                            
     1526                                                }                                                                                                
    14961527                                                 
    14971528                                                current_positive->vertices.insert(current_negative->vertices.begin(),current_negative->vertices.end()); 
     
    15041535                                                                current_positive->vertices.erase(*vert_ref); 
    15051536                                                                 
    1506                                                                 if((current_positive->get_state(SPLIT)==0&&!current_positive->totally_neutral)||(current_negative->get_state(SPLIT)==0&&!current_negative->totally_neutral)) 
     1537                                                                if(will_be_split) 
    15071538                                                                { 
    15081539                                                                        current_positive->negativeneutralvertices.erase(*vert_ref); 
     
    15171548                                                } 
    15181549 
    1519                                                 if(current_positive->totally_neutral) 
    1520                                                 { 
    1521                                                         if(!current_negative->totally_neutral) 
    1522                                                         { 
    1523                                                                 for(set<polyhedron*>::iterator grand_ref = current_positive->grandparents.begin();grand_ref!=current_positive->grandparents.end();grand_ref++) 
    1524                                                                 { 
    1525                                                                         (*grand_ref)->totallyneutralgrandchildren.erase(current_positive); 
    1526                                                                 }                                                                
    1527                                                         } 
    1528                                                         else 
    1529                                                         { 
    1530                                                                 for(set<polyhedron*>::iterator grand_ref = current_negative->grandparents.begin();grand_ref!=current_negative->grandparents.end();grand_ref++) 
    1531                                                                 { 
    1532                                                                         (*grand_ref)->totallyneutralgrandchildren.erase(current_negative); 
    1533                                                                         (*grand_ref)->totallyneutralgrandchildren.insert(current_positive); 
    1534                                                                 }                                                                
    1535                                                         } 
    1536                                                 } 
    1537                                                 else 
    1538                                                 { 
    1539                                                         if(current_negative->totally_neutral) 
    1540                                                         { 
    1541                                                                 for(set<polyhedron*>::iterator grand_ref = current_negative->grandparents.begin();grand_ref!=current_negative->grandparents.end();grand_ref++) 
    1542                                                                 { 
    1543                                                                         (*grand_ref)->totallyneutralgrandchildren.erase(current_negative);                                                                       
    1544                                                                 } 
    1545                                                         }                                                        
    1546                                                 } 
    1547  
    1548                                                 current_positive->grandparents.clear(); 
    1549  
    15501550                                                 
    15511551                                                 
    1552                                                 current_positive->totally_neutral = (current_positive->totally_neutral && current_negative->totally_neutral); 
    1553  
     1552                                                if(current_positive->totally_neutral) 
     1553                                                { 
     1554                                                        for(set<polyhedron*>::iterator grand_ref = current_negative->grandparents.begin();grand_ref!=current_negative->grandparents.end();grand_ref++) 
     1555                                                        { 
     1556                                                                (*grand_ref)->totallyneutralgrandchildren.erase(current_negative); 
     1557                                                                (*grand_ref)->totallyneutralgrandchildren.insert(current_positive); 
     1558                                                        }                                                        
     1559                                                }                                        
     1560 
     1561                                                current_positive->grandparents.clear(); 
     1562                                 
    15541563                                                normalization_factor += current_positive->triangulate(k==for_splitting.size()-1 && !will_be_split); 
    15551564                                                 
     
    16271636                 
    16281637 
    1629                 cout << endl; 
    1630  
    1631                 if(this->statistic.row_size(2)==62) 
    1632                 { 
    1633                         this->step_me(2); 
    1634                 } 
     1638                cout << endl;            
    16351639 
    16361640                if(should_add) 
    16371641                { 
     1642                        cout << "Splitting." << endl; 
     1643 
    16381644                        int k = 1; 
     1645                        int counter = 0; 
    16391646 
    16401647                        vector<list<polyhedron*>>::iterator beginning_ref = ++for_splitting.begin(); 
     
    16451652                                for(list<polyhedron*>::reverse_iterator split_ref = vert_ref->rbegin();split_ref != vert_ref->rend();split_ref++) 
    16461653                                { 
     1654                                        counter++; 
     1655                                         
    16471656                                        polyhedron* new_totally_neutral_child; 
    16481657 
     
    17751784                                        normalization_factor += negative_poly->triangulate(k==for_splitting.size()-1); 
    17761785                                         
    1777                                         statistic.append_polyhedron(k-1, new_totally_neutral_child);                                     
     1786                                        statistic.append_polyhedron(k-1, new_totally_neutral_child);     
     1787 
     1788                                         
    17781789                                         
    17791790                                        statistic.insert_polyhedron(k, positive_poly, current_polyhedron); 
     
    18121823                */ 
    18131824 
    1814                 // step_me(0); 
     1825                step_me(101); 
    18151826 
    18161827        }