Ejemplo n.º 1
0
def makeCorrectTree():
    T = CGL.newCGNSTree()
    b = CGL.newBase(T, 'Base', 3, 3)
    z1 = CGL.newZone(b, 'Zone1',
                     NPY.array([[5, 4, 0], [7, 6, 0], [9, 8, 0]], order='F'))
    g = CGL.newGridCoordinates(z1, 'GridCoordinates')
    d = CGL.newDataArray(g, CGK.CoordinateX_s,
                         NPY.ones((5, 7, 9), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateY_s,
                         NPY.ones((5, 7, 9), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateZ_s,
                         NPY.ones((5, 7, 9), dtype='float64', order='F'))
    s = NPY.array([[vertexsize, cellsize, 0]], dtype='int32', order='F')
    z2 = CGL.newZone(b, 'Zone2', s, CGK.Unstructured_s)
    g = CGL.newGridCoordinates(z2, 'GridCoordinates')
    d = CGL.newDataArray(g, CGK.CoordinateX_s,
                         NPY.ones((vertexsize), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateY_s,
                         NPY.ones((vertexsize), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateZ_s,
                         NPY.ones((vertexsize), dtype='float64', order='F'))
    tetras = CGL.newElements(z2, 'TETRAS', CGK.TETRA_4_s,
                             NPY.ones((cellsize * 4), dtype='int32'),
                             NPY.array([[1, cellsize]], 'i', order='F'))
    tris = CGL.newElements(
        z2, 'TRIS', CGK.TRI_3_s, NPY.ones((ntris * 3), dtype='int32'),
        NPY.array([[cellsize + 1, cellsize + ntris]], 'i', order='F'))
    z3 = CGU.copyNode(z1, 'Zone3')
    b[2].append(z3)
    z4 = CGU.copyNode(z2, 'Zone4')
    b[2].append(z4)
    z = [z1, z2, z3, z4]
    return (T, b, z)
Ejemplo n.º 2
0
def makeCorrectTree():
    T = CGL.newCGNSTree()
    b = CGL.newBase(T, 'Base', 3, 3)
    z1 = CGL.newZone(b, 'Zone1', NPY.array([[5, 4, 0], [7, 6, 0], [5, 4, 0]], order='F'))
    g = CGL.newGridCoordinates(z1, 'GridCoordinates')
    d = CGL.newDataArray(g, CGK.CoordinateX_s, NPY.ones((5, 7, 5), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateY_s, NPY.ones((5, 7, 5), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateZ_s, NPY.ones((5, 7, 5), dtype='float64', order='F'))
    s = NPY.array([[vertexsize, cellsize, 0]], dtype='int32', order='F')
    z2 = CGU.copyNode(z1, 'Zone2')
    b[2].append(z2)
    z = [z1, z2]
    return (T, b, z)
Ejemplo n.º 3
0
                    pttype=CGK.PointList_s)
g = CGL.newGridLocation(n, value=CGK.CellCenter_s)
TESTS.append((tag, T, diag))

#  -------------------------------------------------------------------------
tag = 'indexarray bad parent'
diag = False
(T, b, z, zbc) = makeCorrectTree(vertexsize, cellsize)
n = CGL.newBoundary(zbc,
                    'BC', [range(1, cellsize + 1)],
                    btype=CGK.Null_s,
                    family=None,
                    pttype=CGK.PointList_s)
g = CGL.newGridLocation(n, value=CGK.CellCenter_s)
i = n[2][0]
z[2].append(CGU.copyNode(i, 'PointList'))  # unauthorized parent node
TESTS.append((tag, T, diag))

#  -------------------------------------------------------------------------
tag = 'indexarray bad name'
diag = False
(T, b, z, zbc) = makeCorrectTree(vertexsize, cellsize)
n = CGL.newBoundary(zbc,
                    'BC', [range(1, cellsize + 1)],
                    btype=CGK.Null_s,
                    family=None,
                    pttype=CGK.PointList_s)
g = CGL.newGridLocation(n, value=CGK.CellCenter_s)
i = n[2][0]
i[0] = 'ElementList'  # unauthorized name
TESTS.append((tag, T, diag))
Ejemplo n.º 4
0
ntris = 12
tetras = CGL.newElements(z, 'TETRAS', CGK.TETRA_4_s,
                         NPY.ones((cellsize * 4), dtype='int32'),
                         NPY.array([[1, cellsize]], 'i', order='F'))
tris = CGL.newElements(
    z, 'TRIS', CGK.TRI_3_s, NPY.ones((ntris * 3), dtype='int32'),
    NPY.array([[cellsize + 1, cellsize + ntris]], 'i', order='F'))
tris[1][1] = ntris
zbc = CGL.newZoneBC(z)
n = CGL.newBoundary(zbc,
                    'BC', [range(cellsize + 1, cellsize + ntris + 1)],
                    btype=CGK.Null_s,
                    family=None,
                    pttype=CGK.PointList_s)
g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
z2 = CGU.copyNode(z, 'Zone2')
b[2].append(z2)
zgc = CGL.newZoneGridConnectivity(z)
gc = CGL.newGridConnectivity(zgc, 'join1_2', 'Zone2', ctype=CGK.Abutting1to1_s)
CGL.newIndexArray(gc,
                  CGK.PointList_s,
                  value=NPY.array([range(cellsize + 2, cellsize + ntris)],
                                  order='F'))
CGL.newIndexArray(gc,
                  CGK.PointListDonor_s,
                  value=NPY.array([range(cellsize + 2, cellsize + ntris)],
                                  order='F'))
CGL.newGridLocation(gc, value=CGK.FaceCenter_s)
zgc = CGL.newZoneGridConnectivity(z2)
gc = CGL.newGridConnectivity(zgc, 'join2_1', 'Zone', ctype=CGK.Abutting1to1_s)
CGL.newIndexArray(gc,
Ejemplo n.º 5
0
def makeStTree():
    T = CGL.newCGNSTree()
    b = CGL.newBase(T, '{Base}', 3, 3)
    z1 = CGL.newZone(b, '{Zone1}',
                     NPY.array([[5, 4, 0], [7, 6, 0], [9, 8, 0]], order='F'))
    g = CGL.newGridCoordinates(z1, 'GridCoordinates')
    d = CGL.newDataArray(g, CGK.CoordinateX_s,
                         NPY.ones((5, 7, 9), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateY_s,
                         NPY.ones((5, 7, 9), dtype='float64', order='F'))
    d = CGL.newDataArray(g, CGK.CoordinateZ_s,
                         NPY.ones((5, 7, 9), dtype='float64', order='F'))
    z2 = CGU.copyNode(z1, '{Zone2}')
    b[2].append(z2)
    zgc = CGL.newZoneGridConnectivity(z1)
    gc = CGL.newGridConnectivity1to1(zgc, 'join1_2', '{Zone2}',
                                     NPY.array([[1, 1], [1, 4], [1, 9]]),
                                     NPY.array([[5, 5], [3, 7], [1, 9]]),
                                     NPY.array([-1, +2, +3]))
    zgc = CGL.newZoneGridConnectivity(z2)
    gc = CGL.newGridConnectivity1to1(zgc, 'join2_1', '{Zone1}',
                                     NPY.array([[5, 5], [3, 7], [1, 9]]),
                                     NPY.array([[1, 1], [1, 4], [1, 9]]),
                                     NPY.array([-1, +2, +3]))
    zbc = CGL.newZoneBC(z1)
    n = CGL.newBoundary(zbc,
                        '{BC1_1}', [[5, 5], [1, 7], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC1_2}', [[1, 5], [1, 1], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC1_3}', [[1, 5], [7, 7], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC1_4}', [[1, 5], [1, 7], [1, 1]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC1_5}', [[1, 5], [1, 7], [9, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC1_6}', [[1, 1], [4, 7], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    zbc = CGL.newZoneBC(z2)
    n = CGL.newBoundary(zbc,
                        '{BC2_1}', [[1, 1], [1, 7], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC2_2}', [[1, 5], [1, 1], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC2_3}', [[1, 5], [7, 7], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC2_4}', [[1, 5], [1, 7], [1, 1]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC2_5}', [[1, 5], [1, 7], [9, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    n = CGL.newBoundary(zbc,
                        '{BC2_6}', [[5, 5], [1, 3], [1, 9]],
                        btype=CGK.Null_s,
                        family=None,
                        pttype=CGK.PointRange_s)
    g = CGL.newGridLocation(n, value=CGK.FaceCenter_s)
    z = [z1, z2]
    return (T, b, z)