Example #1
0
    def compute(self):
        switches = None
        if self.hasInputFromPort("switches"):
            switches = self.getInputFromPort("switches")
            print switches
        if self.hasInputFromPort("tgio in"):
            tgio_in = self.getInputFromPort("tgio in").data

        print "input has %d nodes!" % tgio_in.numberofpoints
        tgio_in.save_nodes("/tmp/tgIN.vt")
        tgio_in.save_poly("/tmp/tgIN.vt")
        out = tetgenio_wrapper()
        TetGen.tetrahedralize(switches, tgio_in, out.data)
        print "Done making tets"

        self.setResult("tgio out", out)
Example #2
0
    def compute(self):
        switches = None
        if self.hasInputFromPort("switches") :
            switches = self.getInputFromPort("switches")
            print switches
        if self.hasInputFromPort("tgio in") :
            tgio_in = self.getInputFromPort("tgio in").data

        print "input has %d nodes!" % tgio_in.numberofpoints
        tgio_in.save_nodes("/tmp/tgIN.vt")
        tgio_in.save_poly("/tmp/tgIN.vt")
        out  = tetgenio_wrapper()
        TetGen.tetrahedralize(switches, tgio_in, out.data)
        print "Done making tets"

        self.setResult("tgio out", out)
Example #3
0
def addSurfaceInfo(tgio, marker=0):

    #iterate over nodes and add the points.
    nodes = getTestNodes()
    sz = len(nodes)
    tgio.pointlist = TetGen.allocate_array(sz * 3)
    tgio.numberofpoints = sz
    idx = 0
    for n in nodes:
        TetGen.set_val(tgio.pointlist, idx * 3, n[0])
        TetGen.set_val(tgio.pointlist, idx * 3 + 1, n[1])
        TetGen.set_val(tgio.pointlist, idx * 3 + 2, n[2])
        idx = idx + 1

    #iterate over faces and add the facets.
    tris = getTestTris()
    fsz = len(tris)
    tgio.facetlist = TetGen.allocate_facet_array(fsz)
    tgio.numberoffacets = fsz
    idx = 0
    for t in tris:
        TetGen.add_tri(tgio.facetlist, idx, t[0], t[1], t[2])
        idx = idx + 1
def addSurfaceInfo(tgio, marker=0):

    # iterate over nodes and add the points.
    nodes = getTestNodes()
    sz = len(nodes)
    tgio.pointlist = TetGen.allocate_array(sz * 3)
    tgio.numberofpoints = sz
    idx = 0
    for n in nodes:
        TetGen.set_val(tgio.pointlist, idx * 3, n[0])
        TetGen.set_val(tgio.pointlist, idx * 3 + 1, n[1])
        TetGen.set_val(tgio.pointlist, idx * 3 + 2, n[2])
        idx = idx + 1

    # iterate over faces and add the facets.
    tris = getTestTris()
    fsz = len(tris)
    tgio.facetlist = TetGen.allocate_facet_array(fsz)
    tgio.numberoffacets = fsz
    idx = 0
    for t in tris:
        TetGen.add_tri(tgio.facetlist, idx, t[0], t[1], t[2])
        idx = idx + 1
Example #5
0
 def __init__(self):
     self.data = TetGen.tetgenio()
Example #6
0
 def __init__(self) :
     self.data = TetGen.tetgenio()