Exemple #1
0
def main():
    m = TetgenReader()
    base = 'tetgen_test_flipped.1'
    m.read_tetgen(base + '.node', base + '.smesh', base + '.ele', dimension_flag=3)
    m.write_nastran(base + '.bdf')

    m2 = TetgenReader()
    base = 'tetgen_test_flipped.1'
    m2.read_tetgen(base + '.node', base + '.smesh', base + '.ele', dimension_flag=2)
    ntris, four = m2.tris.shape
    #boundary_nodes = unique(m2.tris)
    #nboundary_nodes, = boundary_nodes.shape
    nboundary_nodes, three = m2.nodes.shape
    assert isinstance(nboundary_nodes, int), nboundary_nodes

    ntets, four = m.tets.shape
    nnodes, three = m.nodes.shape
    m.header = {
        'inew': -1,
        'nElements' : ntets,
        'nPoints'   : nnodes,
        'nBoundPts' : nboundary_nodes,
        'nViscPts'  : nnodes,
        'nViscElem' : ntets,
        'tc'        : 0.0, # d
    }
    write_usm3d_volume(m, base)
Exemple #2
0
def main():
    m = TetgenReader()
    base = 'tetgen_test_flipped.1'
    m.read_tetgen(base + '.node',
                  base + '.smesh',
                  base + '.ele',
                  dimension_flag=3)
    m.write_nastran(base + '.bdf')

    m2 = TetgenReader()
    base = 'tetgen_test_flipped.1'
    m2.read_tetgen(base + '.node',
                   base + '.smesh',
                   base + '.ele',
                   dimension_flag=2)
    ntris, four = m2.tris.shape
    #boundary_nodes = unique(m2.tris)
    #nboundary_nodes, = boundary_nodes.shape
    nboundary_nodes, three = m2.nodes.shape
    assert isinstance(nboundary_nodes, int), nboundary_nodes

    ntets, four = m.tets.shape
    nnodes, three = m.nodes.shape
    m.header = {
        'inew': -1,
        'nElements': ntets,
        'nPoints': nnodes,
        'nBoundPts': nboundary_nodes,
        'nViscPts': nnodes,
        'nViscElem': ntets,
        'tc': 0.0,  # d
    }
    write_usm3d_volume(m, base)
def tetgen_to_usm3d(base):
    m = Tetgen()
    m.read_tetgen(base + '.node',
                  base + '.smesh',
                  base + '.ele',
                  dimension_flag=3)
    m.write_nastran(base + '.bdf')

    m2 = Tetgen()
    m2.read_tetgen(base + '.node',
                   base + '.smesh',
                   base + '.ele',
                   dimension_flag=2)
    ntris = m2.tris.shape[0]

    nboundary_nodes = m2.nodes.shape[0]
    if not isinstance(nboundary_nodes, int):
        msg = 'nboundary_nodes=%r; type=%s must be an integer' % (
            nboundary_nodes, type(nboundary_nodes))
        raise TypeError(msg)

    ntets = m.tets.shape[0]
    nnodes = m.nodes.shape[0]
    #assert isinstance(nnodes, int), type(nnodes)
    m.header = {
        'inew': -1,
        'nElements': ntets,
        'nPoints': nnodes,
        'nBoundPts': nboundary_nodes,
        'nViscPts': nnodes,
        'nViscElem': ntets,
        'tc': 0.0,  # d
    }
    write_usm3d_volume(m, base)