File wellmet/dicebox/circumtri.py changed (mode: 100644) (index e113932..4e31c74) |
... |
... |
TriEstimation = namedtuple('TriEstimation', ( |
29 |
29 |
'success_points', |
'success_points', |
30 |
30 |
'failure_points', |
'failure_points', |
31 |
31 |
*sx.CubatureEstimation._fields[2:], |
*sx.CubatureEstimation._fields[2:], |
|
32 |
|
'r_safe', |
|
33 |
|
'R_safe', |
|
34 |
|
'r_mixed', |
|
35 |
|
'R_mixed', |
|
36 |
|
'r_failure', |
|
37 |
|
'R_failure', |
32 |
38 |
'p_sum', |
'p_sum', |
33 |
39 |
'max_potential' |
'max_potential' |
34 |
40 |
)) |
)) |
|
... |
... |
class FullCircumTri(_Exploration): |
450 |
456 |
bx.global_potential_index.pop(-1) |
bx.global_potential_index.pop(-1) |
451 |
457 |
bx.global_potential_index[-1] = max_node_potential |
bx.global_potential_index[-1] = max_node_potential |
452 |
458 |
|
|
|
459 |
|
|
|
460 |
|
def get_tri_radia(bx): |
|
461 |
|
lengths = np.sum(np.square(bx.G), axis=1) |
|
462 |
|
lengths = np.sqrt(lengths, out=lengths) #lengths of each radius-vector |
|
463 |
|
|
|
464 |
|
if 'Tri' in dir(bx): |
|
465 |
|
simplices = bx.Tri.tri.simplices |
|
466 |
|
radia = lengths[simplices] |
|
467 |
|
r = np.min(radia, axis=1) |
|
468 |
|
R = np.max(radia, axis=1) |
|
469 |
|
|
|
470 |
|
in_failure = bx.failsi[simplices] |
|
471 |
|
|
|
472 |
|
has_failure = in_failure.any(axis=1) |
|
473 |
|
all_failure = in_failure.all(axis=1) |
|
474 |
|
|
|
475 |
|
if np.any(~has_failure): |
|
476 |
|
r_safe = np.min(r[~has_failure]) |
|
477 |
|
R_safe = np.max(R[~has_failure]) |
|
478 |
|
else: |
|
479 |
|
r_safe, R_safe = -1, -1 |
|
480 |
|
|
|
481 |
|
|
|
482 |
|
if np.any(all_failure): |
|
483 |
|
r_failure = np.min(r[all_failure]) |
|
484 |
|
R_failure = np.max(R[all_failure]) |
|
485 |
|
else: |
|
486 |
|
r_failure, R_failure = -1, -1 |
|
487 |
|
|
|
488 |
|
mixed_mask = np.logical_xor(has_failure, all_failure) |
|
489 |
|
if np.any(mixed_mask): |
|
490 |
|
r_mixed = np.min(r[mixed_mask]) |
|
491 |
|
R_mixed = np.max(R[mixed_mask]) |
|
492 |
|
else: |
|
493 |
|
r_mixed, R_mixed = -1, -1 |
|
494 |
|
|
|
495 |
|
return r_safe, R_safe, r_mixed, R_mixed, r_failure, R_failure |
|
496 |
|
|
|
497 |
|
else: |
|
498 |
|
radia = [-1] * 6 |
|
499 |
|
r = np.min(lengths) |
|
500 |
|
R = np.max(lengths) |
|
501 |
|
|
|
502 |
|
if np.all(bx.failsi): |
|
503 |
|
return -1, -1, -1, -1, r, R |
|
504 |
|
elif np.any(bx.failsi): |
|
505 |
|
return -1, -1, r, R, -1, -1 |
|
506 |
|
else: |
|
507 |
|
return r, R, -1, -1, -1, -1 |
|
508 |
|
|
|
509 |
|
|
453 |
510 |
|
|
454 |
511 |
|
|
455 |
512 |
def estimate_outside(bx): |
def estimate_outside(bx): |
|
... |
... |
class FullCircumTri(_Exploration): |
510 |
567 |
success_points, |
success_points, |
511 |
568 |
failure_points, |
failure_points, |
512 |
569 |
*tri_estimation[2:], |
*tri_estimation[2:], |
|
570 |
|
|
|
571 |
|
*bx.get_tri_radia(), |
513 |
572 |
p_sum, |
p_sum, |
514 |
573 |
max_potential |
max_potential |
515 |
574 |
) |
) |
|
... |
... |
class FullCircumTri(_Exploration): |
551 |
610 |
0, #len(sx.mixed_simplices), |
0, #len(sx.mixed_simplices), |
552 |
611 |
0, #len(sx.tri.coplanar), |
0, #len(sx.tri.coplanar), |
553 |
612 |
|
|
|
613 |
|
*bx.get_tri_radia(), |
554 |
614 |
1, |
1, |
555 |
615 |
max_potential |
max_potential |
556 |
616 |
) |
) |
|
... |
... |
class FastCircumTri(FullCircumTri): |
586 |
646 |
failure_points, |
failure_points, |
587 |
647 |
success, |
success, |
588 |
648 |
*tri_estimation[3:], |
*tri_estimation[3:], |
|
649 |
|
|
|
650 |
|
*bx.get_tri_radia(), |
589 |
651 |
1, |
1, |
590 |
652 |
max_potential |
max_potential |
591 |
653 |
) |
) |
|
... |
... |
class FastCircumTri(FullCircumTri): |
626 |
688 |
0, #len(sx.mixed_simplices), |
0, #len(sx.mixed_simplices), |
627 |
689 |
0, #len(sx.tri.coplanar), |
0, #len(sx.tri.coplanar), |
628 |
690 |
|
|
|
691 |
|
*bx.get_tri_radia(), |
629 |
692 |
1, |
1, |
630 |
693 |
max_potential |
max_potential |
631 |
694 |
) |
) |