@@ -626,7 +626,7 @@ def compute_kdtree(self) -> KDTree:
626626 def compute_collisions (self ):
627627 pass
628628
629- def compute_contacts (self , tolerance = 1e-6 , minimum_area = 1e-2 , k = 2 , bvh_or_kdtree = True ) -> None :
629+ def compute_contacts (self , tolerance = 1e-6 , minimum_area = 1e-2 , k = 2 , search_type = "bvh" ) -> None :
630630 """Compute the contacts between the block elements of this model.
631631
632632 Parameters
@@ -637,8 +637,8 @@ def compute_contacts(self, tolerance=1e-6, minimum_area=1e-2, k=2, bvh_or_kdtree
637637 The minimum contact size.
638638 k : int, optional
639639 The number of element neighbours to consider.
640- bvh_or_kdtree : bool , optional
641- Whether to use the BVH or KDTree for nearest neighbour queries .
640+ search_type : str , optional
641+ Search type, possible options: 'bvh' or 'kdtree' .
642642
643643 Returns
644644 -------
@@ -649,12 +649,14 @@ def compute_contacts(self, tolerance=1e-6, minimum_area=1e-2, k=2, bvh_or_kdtree
649649 u = element .graphnode
650650
651651 nnbrs = []
652- if bvh_or_kdtree :
652+ if search_type == "bvh" :
653653 nnbrs = self .bvh .nearest_neighbors (element )
654- else :
654+ elif search_type == "kdtree" :
655655 nnbrs_and_distances = self .element_nnbrs (element , k = k )
656656 for id , _ in nnbrs_and_distances :
657657 nnbrs .append (id )
658+ else :
659+ raise ValueError ("Unknown search type, possible options: 'bvh' or 'kdtree'" )
658660
659661 for nbr in nnbrs :
660662 v = nbr .graphnode
0 commit comments