code: def edge_refine_triangulation_by_triangles(self, triangles):
          
  
          ## Note there should be no duplicates in the list of triangles
          ## but because we remove duplicates from the list of all segments,
          ## there is no pressing need to check this.
  
          # identify the segments
  
          simplices = self.simplices
          segments = set()
  
          for index in np.array(triangles).reshape(-1):
              tri = simplices[index]
              segments.add( min( tuple((tri[0], tri[1])), tuple((tri[1], tri[0]))) )
              segments.add( min( tuple((tri[1], tri[2])), tuple((tri[2], tri[1]))) )
              segments.add( min( tuple((tri[0], tri[2])), tuple((tri[2], tri[0]))) )
  
          segs = np.array(list(segments))
  
          mlons, mlats = self.segment_midpoints(segs)
  
          lonv1 = np.concatenate((self.lons, mlons), axis=0)
          latv1 = np.concatenate((self.lats, mlats), axis=0)
  
          return lonv1, latv1
docs: return points defining a refined triangulation obtained by bisection of all edges
          in the triangulation that are associated with the triangles in the list
          of indices provided.
  
          Notes
          -----
           The triangles are here represented as a single index.
           The vertices of triangle i are given by self.simplices[i].