示例#1
0
    meshinfo = med.MEDmeshInfoByName(fid, meshname)
except RuntimeError as ex:
    print("ERROR : mesh info ...\n%s" % ex)
    doCleanup(fid, -1)

if (not meshinfo) or (len(meshinfo) != 10):
    print("ERROR : no mesh info created from MEDmeshInfoByName")
    doCleanup(fid, -1)
else:
    spacedim, meshdim, meshtype, description, dtunit, sortingtype, nstep, axistype, axisname, axisunit = meshinfo

#  read how many nodes in the mesh
try:
    nnodes, chgt, trsf = med.MEDmeshnEntity(fid, meshname, med.MED_NO_DT,
                                            med.MED_NO_IT, med.MED_NODE,
                                            med.MED_NO_GEOTYPE,
                                            med.MED_COORDINATE,
                                            med.MED_NO_CMODE)
except RuntimeError as ex:
    print("ERROR : number of nodes ...\n%s" % ex)
    doCleanup(fid, -1)

#  ... we know that we only have MED_TRIA3 and MED_QUAD4 in the mesh,
#  a real code would check all MED geometry cell types ...

#  read how many triangular cells in the mesh
try:
    ntria3, chgt2, trsf2 = med.MEDmeshnEntity(fid, meshname, med.MED_NO_DT,
                                              med.MED_NO_IT, med.MED_CELL,
                                              med.MED_TRIA3,
                                              med.MED_CONNECTIVITY,
示例#2
0
	try :
		meshinfo = med.MEDmeshInfo(fid, i+1)
	except RuntimeError as ex :
		print("ERROR : mesh info ...\n%s" % ex)
		doCleanup(fid, -1)

	if (not meshinfo) or (len(meshinfo) != 11) :
		print("ERROR : no mesh info created from MEDmeshInfo")
		doCleanup(fid, -1)
	else :
		meshname,spacedim,meshdim,meshtype,description,dtunit,sortingtype,nstep,axistype,axisname,axisunit=meshinfo

	#  read how many nodes in the mesh
	try :
		nnodes, chgt, trsf = med.MEDmeshnEntity(fid, meshname, med.MED_NO_DT,
							med.MED_NO_IT, med.MED_NODE, med.MED_NO_GEOTYPE,
							med.MED_COORDINATE, med.MED_NO_CMODE)
	except RuntimeError as ex :
		print("ERROR : number of nodes ...\n%s" % ex)
		doCleanup(fid, -1)

	#  read mesh nodes coordinates
	coordinates = med.MEDFLOAT([0.] * nnodes * spacedim)
	try :
		med.MEDmeshNodeCoordinateRd(fid, meshname, med.MED_NO_DT, med.MED_NO_IT,
									med.MED_FULL_INTERLACE, coordinates)
	except RuntimeError as ex :
		print("ERROR : nodes coordinates ...\n%s" % ex)
		doCleanup(fid, -1)

	#  read number of geometrical types for cells
示例#3
0
try:
    meshinfo = med.MEDmeshInfoByName(fid, meshname)
except RuntimeError as ex:
    print("ERROR : mesh info ...\n%s" % ex)
    doCleanup(fid, -1)

if (not meshinfo) or (len(meshinfo) != 10):
    print("ERROR : no mesh info created from MEDmeshInfoByName")
    doCleanup(fid, -1)
else:
    spacedim, meshdim, meshtype, description, dtunit, sortingtype, nstep, axistype, axisname, axisunit = meshinfo

#  read how many nodes in the mesh
try:
    nnodes, chgt, trsf = med.MEDmeshnEntity(fid, meshname, med.MED_NO_DT,
                                            med.MED_NO_IT, med.MED_NODE,
                                            med.MED_POINT1, med.MED_COORDINATE,
                                            med.MED_NO_CMODE)
except RuntimeError as ex:
    print("ERROR : number of nodes ...\n%s" % ex)
    doCleanup(fid, -1)

#  ... we know that we only have MED_POLYHEDRON cells in the mesh,
#  a real code would check all MED geometry cell types ...

#  We read how many polyhedrons are in the mesh (using nodal connectivity mode)
#  We get the size of the polyhedrons/face index array.
#  As an index of the face index array give the location of the first face   and so the
#  number of polyhedrons
try:
    faceindexsize, chgt, trsf = med.MEDmeshnEntity(
        fid, meshname, med.MED_NO_DT, med.MED_NO_IT, med.MED_CELL,
示例#4
0
try:
    gridtype = med.MEDmeshGridTypeRd(fid, meshname)
except RuntimeError as ex:
    print("ERROR : read grid type ...\n%s" % ex)
    doCleanup(fid, -1)

#  ... we know that the mesh is a cartesian grid,
#  a real code would check ...

#  read the axis coordinates (MED_CARTESIAN coordinates system)
#  X
axis = 1
try:
    size, chgt, trsf = med.MEDmeshnEntity(fid, meshname, med.MED_NO_DT,
                                          med.MED_NO_IT, med.MED_NODE,
                                          med.MED_NONE,
                                          med.MED_COORDINATE_AXIS1,
                                          med.MED_NO_CMODE)
except RuntimeError as ex:
    print("ERROR : number of coordinates on X axis ...\n%s" % ex)
    doCleanup(fid, -1)
ncell = size - 1
cooXaxis = med.MEDFLOAT([0.] * size)

try:
    med.MEDmeshGridIndexCoordinateRd(fid, meshname, med.MED_NO_DT,
                                     med.MED_NO_IT, axis, cooXaxis)
except RuntimeError as ex:
    print("ERROR : read axis X coordinates ...\n%s" % ex)
    doCleanup(fid, -1)
示例#5
0
        meshinfo = med.MEDmeshInfo(fid, i + 1)
    except RuntimeError as ex:
        print("ERROR : mesh info ...\n%s" % ex)
        doCleanup(fid, -1)

    if (not meshinfo) or (len(meshinfo) != 11):
        print("ERROR : no mesh info created from MEDmeshInfo")
        doCleanup(fid, -1)
    else:
        meshname, spacedim, meshdim, meshtype, description, dtunit, sortingtype, nstep, axistype, axisname, axisunit = meshinfo

    #  read how many nodes in the mesh
    try:
        nnodes, chgt, trsf = med.MEDmeshnEntity(fid, meshname, med.MED_NO_DT,
                                                med.MED_NO_IT, med.MED_NODE,
                                                med.MED_NONE,
                                                med.MED_COORDINATE,
                                                med.MED_NO_CMODE)
    except RuntimeError as ex:
        print("ERROR : number of nodes initial ...\n%s" % ex)
        doCleanup(fid, -1)

    #  read mesh nodes coordinates
    coordinates = med.MEDFLOAT([0.] * nnodes * spacedim)
    try:
        med.MEDmeshNodeCoordinateRd(fid, meshname, med.MED_NO_DT,
                                    med.MED_NO_IT, med.MED_FULL_INTERLACE,
                                    coordinates)
    except RuntimeError as ex:
        print("ERROR : nodes coordinates ...\n%s" % ex)
        doCleanup(fid, -1)
示例#6
0
    meshinfo = med.MEDmeshInfoByName(fid, meshname)
except RuntimeError as ex:
    print("ERROR : mesh info ...\n%s" % ex)
    doCleanup(fid, -1)

if (not meshinfo) or (len(meshinfo) != 10):
    print("ERROR : no mesh info created from MEDmeshInfoByName")
    doCleanup(fid, -1)
else:
    spacedim, meshdim, meshtype, description, dtunit, sortingtype, nstep, axistype, axisname, axisunit = meshinfo

#  read how many nodes in the mesh
try:
    nnodes, chgt, trsf = med.MEDmeshnEntity(fid, meshname, med.MED_NO_DT,
                                            med.MED_NO_IT, med.MED_NODE,
                                            med.MED_NO_GEOTYPE,
                                            med.MED_COORDINATE,
                                            med.MED_NO_CMODE)
except RuntimeError as ex:
    print("ERROR : number of nodes ...\n%s" % ex)
    doCleanup(fid, -1)

#  ... we know that we only have MED_TRIA3 and MED_QUAD4 in the mesh,
#  a real code would check all MED geometry cell types ...

#  read how many triangular cells in the mesh
try:
    ntria3, chgt, trsf = med.MEDmeshnEntity(fid, meshname, med.MED_NO_DT,
                                            med.MED_NO_IT, med.MED_CELL,
                                            med.MED_TRIA3,
                                            med.MED_CONNECTIVITY,
示例#7
0
        meshinfo = med.MEDmeshInfo(fid, i + 1)
    except RuntimeError as ex:
        print("ERROR : mesh info ...\n%s" % ex)
        doCleanup(fid, -1)

    if (not meshinfo) or (len(meshinfo) != 11):
        print("ERROR : no mesh info created from MEDmeshInfo")
        doCleanup(fid, -1)
    else:
        meshname, spacedim, meshdim, meshtype, description, dtunit, sortingtype, nstep, axistype, axisname, axisunit = meshinfo

    #  read how many nodes in the mesh
    try:
        nnodes, chgt, trsf = med.MEDmeshnEntity(fid, meshname, med.MED_NO_DT,
                                                med.MED_NO_IT, med.MED_NODE,
                                                med.MED_NONE,
                                                med.MED_COORDINATE,
                                                med.MED_NO_CMODE)
    except RuntimeError as ex:
        print("ERROR : number of nodes initial ...\n%s" % ex)
        doCleanup(fid, -1)

    #  read mesh nodes coordinates
    coordinates = med.MEDFLOAT([0.] * nnodes * spacedim)
    try:
        med.MEDmeshNodeCoordinateRd(fid, meshname, med.MED_NO_DT,
                                    med.MED_NO_IT, med.MED_FULL_INTERLACE,
                                    coordinates)
    except RuntimeError as ex:
        print("ERROR : nodes coordinates ...\n%s" % ex)
        doCleanup(fid, -1)