769 | | //current_parent->set_state(0,MERGE); |
| 769 | //current_parent->set_state(0,MERGE); |
| 770 | |
| 771 | if(level == number_of_parameters - 1) |
| 772 | { |
| 773 | toprow* cur_par_toprow = ((toprow*)current_parent); |
| 774 | cur_par_toprow->probability = 0.0; |
| 775 | |
| 776 | for(list<set<vertex*>>::iterator t_ref = current_parent->triangulation.begin();t_ref!=current_parent->triangulation.end();t_ref++) |
| 777 | { |
| 778 | cur_par_toprow->probability += cur_par_toprow->integrate_simplex(*t_ref,'C'); |
| 779 | } |
| 780 | } |
881 | | current_parent->positivechildren.clear(); |
882 | | current_parent->negativechildren.clear(); |
883 | | current_parent->neutralchildren.clear(); |
884 | | current_parent->totallyneutralchildren.clear(); |
885 | | current_parent->totallyneutralgrandchildren.clear(); |
886 | | // current_parent->grandparents.clear(); |
887 | | current_parent->positiveneutralvertices.clear(); |
888 | | current_parent->negativeneutralvertices.clear(); |
889 | | current_parent->totally_neutral = NULL; |
890 | | current_parent->kids_rel_addresses.clear(); |
891 | | current_parent->message_counter = 0; |
| 880 | if(current_parent->mergechild == NULL) |
| 881 | { |
| 882 | current_parent->positivechildren.clear(); |
| 883 | current_parent->negativechildren.clear(); |
| 884 | current_parent->neutralchildren.clear(); |
| 885 | current_parent->totallyneutralchildren.clear(); |
| 886 | current_parent->totallyneutralgrandchildren.clear(); |
| 887 | // current_parent->grandparents.clear(); |
| 888 | current_parent->positiveneutralvertices.clear(); |
| 889 | current_parent->negativeneutralvertices.clear(); |
| 890 | current_parent->totally_neutral = NULL; |
| 891 | current_parent->kids_rel_addresses.clear(); |
| 892 | } |
1215 | | current_positive->negativechildren.insert(current_positive->negativechildren.end(),current_negative->negativechildren.begin(),current_negative->negativechildren.end()); |
| 1219 | if((current_positive->get_state(SPLIT)==0&&!current_positive->totally_neutral)||(current_negative->get_state(SPLIT)==0&&!current_negative->totally_neutral)) |
| 1220 | { |
| 1221 | current_positive->negativechildren.insert(current_positive->negativechildren.end(),current_negative->negativechildren.begin(),current_negative->negativechildren.end()); |
| 1222 | |
| 1223 | current_positive->positivechildren.insert(current_positive->positivechildren.end(),current_negative->positivechildren.begin(),current_negative->positivechildren.end()); |
| 1224 | |
| 1225 | current_positive->neutralchildren.insert(current_positive->neutralchildren.end(),current_negative->neutralchildren.begin(),current_negative->neutralchildren.end()); |
1217 | | current_positive->positivechildren.insert(current_positive->positivechildren.end(),current_negative->positivechildren.begin(),current_negative->positivechildren.end()); |
1218 | | |
1219 | | current_positive->neutralchildren.insert(current_positive->neutralchildren.end(),current_negative->positivechildren.begin(),current_negative->positivechildren.end()); |
1220 | | |
1221 | | switch((*merge_ref)->get_state(SPLIT)) |
1222 | | { |
1223 | | case -1: |
1224 | | current_positive->negativechildren.remove(*merge_ref); |
1225 | | break; |
1226 | | case 0: |
1227 | | current_positive->neutralchildren.remove(*merge_ref); |
1228 | | break; |
1229 | | case 1: |
1230 | | current_positive->positivechildren.remove(*merge_ref); |
1231 | | break; |
| 1227 | switch((*merge_ref)->get_state(SPLIT)) |
| 1228 | { |
| 1229 | case -1: |
| 1230 | current_positive->negativechildren.remove(*merge_ref); |
| 1231 | break; |
| 1232 | case 0: |
| 1233 | current_positive->neutralchildren.remove(*merge_ref); |
| 1234 | break; |
| 1235 | case 1: |
| 1236 | current_positive->positivechildren.remove(*merge_ref); |
| 1237 | break; |
| 1238 | } |
| 1239 | |
| 1240 | current_positive->totallyneutralchildren.insert(current_negative->totallyneutralchildren.begin(),current_negative->totallyneutralchildren.end()); |
| 1241 | |
| 1242 | current_positive->totallyneutralchildren.erase(*merge_ref); |
| 1243 | |
| 1244 | current_positive->totallyneutralgrandchildren.insert(current_negative->totallyneutralgrandchildren.begin(),current_negative->totallyneutralgrandchildren.end()); |
| 1245 | |
| 1246 | current_positive->negativeneutralvertices.insert(current_negative->negativeneutralvertices.begin(),current_negative->negativeneutralvertices.end()); |
| 1247 | current_positive->positiveneutralvertices.insert(current_negative->positiveneutralvertices.begin(),current_negative->positiveneutralvertices.end()); |
| 1248 | } |
| 1249 | else |
| 1250 | { |
| 1251 | if(!current_positive->totally_neutral) |
| 1252 | { |
| 1253 | current_positive->positivechildren.clear(); |
| 1254 | current_positive->negativechildren.clear(); |
| 1255 | current_positive->neutralchildren.clear(); |
| 1256 | current_positive->totallyneutralchildren.clear(); |
| 1257 | current_positive->totallyneutralgrandchildren.clear(); |
| 1258 | current_positive->positiveneutralvertices.clear(); |
| 1259 | current_positive->negativeneutralvertices.clear(); |
| 1260 | current_positive->totally_neutral = NULL; |
| 1261 | current_positive->kids_rel_addresses.clear(); |
| 1262 | } |
| 1263 | |