def point_in_triangle_checker(tri): tri = [[0.0, 0.0], [1.0, 0.0], [0.5, 0.8660254]] tri = triangle_util.scale_triangle(tri, 0.12) def check(p): return triangle_util.point_in_triangle(p, tri) return check
def __init__(self,options,n_material,p_material): global mesh #very bad, but innertriangle needs it. thetriangle = np.array([[0.,0.],[1.,0.],[.5,.8660254]]) mesh = meshtest.TestMesh() for x in range(options.size): if dolfin.__version__=='0.9.7': mesh.refine() else: dolfin.mesh.refine(mesh) mc.ParticleMesh.__init__(self,mesh, options.scale,options.length,options.dt,options.gen_num) inner = triangle_util.scale_triangle(thetriangle,.52) self.populate_regions(lambda x: triangle_util.point_in_triangle(x,inner),0,0, n_material, p_material) self.boundarymesh = BoundaryMesh(mesh) self.OuterBoundary = OuterTriangle() self.InnerBoundary = InnerTriangle() mesh = self