コード例 #1
0
])
ntria3 = 8
quadconnectivity = med.MEDINT(
    [3, 4, 9, 8, 4, 5, 10, 9, 15, 14, 9, 10, 13, 8, 9, 14])
nquad4 = 4

#  MED file creation
try:
    fid = med.MEDfileOpen("UsesCase_MEDmesh_1.med", med.MED_ACC_CREAT)
except RuntimeError as ex:
    print("ERROR : file creation ...\n%s" % ex)
    sys.exit(-1)

#  write a comment in the file
try:
    med.MEDfileCommentWr(fid, "A 2D unstructured mesh : 15 nodes, 12 cells")
except RuntimeError as ex:
    print("ERROR : write file description ...\n%s" % ex)
    doCleanup(fid, -1)

#  mesh creation : a 2D unstructured mesh
try:
    med.MEDmeshCr(fid, meshname, spacedim, meshdim, med.MED_UNSTRUCTURED_MESH,
                  "A 2D unstructured mesh", "", med.MED_SORT_DTIT,
                  med.MED_CARTESIAN, axisname, unitname)
except RuntimeError as ex:
    print("ERROR : mesh creation ...\n%s" % ex)
    doCleanup(fid, -1)

#  nodes coordinates in a cartesian axis in full interlace mode
#  (X1,Y1, X2,Y2, X3,Y3, ...) with no iteration and computation step
コード例 #2
0
nnodes = 10
indexsize = 3
index = med.MEDINT([1, 7, 13])
#  connectivity : 2 hexagons
connectivity = med.MEDINT([1, 4, 7, 9, 6, 3, 2, 5, 8, 10, 7, 4])

#  MED file creation
try:
    fid = med.MEDfileOpen("UsesCase_MEDmesh_13.med", med.MED_ACC_CREAT)
except RuntimeError as ex:
    print("ERROR : file creation ...\n%s" % ex)
    sys.exit(-1)

#  write a comment in the file
try:
    med.MEDfileCommentWr(fid, "A 2D unstructured mesh : 12, 12 polygons")
except RuntimeError as ex:
    print("ERROR : write file description ...\n%s" % ex)
    doCleanup(fid, -1)

#  mesh creation : a 2D unstructured mesh
try:
    med.MEDmeshCr(fid, meshname, spacedim, meshdim, med.MED_UNSTRUCTURED_MESH,
                  "A 2D unstructured mesh", "", med.MED_SORT_DTIT,
                  med.MED_CARTESIAN, axisname, unitname)
except RuntimeError as ex:
    print("ERROR : mesh creation ...\n%s" % ex)
    doCleanup(fid, -1)

#  nodes coordinates in a cartesian axis in full interlace mode
#  (X1,Y1, X2,Y2, X3,Y3, ...) with no iteration and computation step
コード例 #3
0
#  there are two polyhedrons, the first has 6 faces, the second 7 faces
#  Pn+1 == FaceIndex[n+1]== NodeIndexSize== nbr of faces + 1
faceindex = med.MEDINT([1, 7, 14])
faceindexSize = 3

#  MED file creation
try:
    fid = med.MEDfileOpen("UsesCase_MEDmesh_15.med", med.MED_ACC_CREAT)
except RuntimeError as ex:
    print("ERROR : file creation ...\n%s" % ex)
    sys.exit(-1)

#  write a comment in the file
try:
    med.MEDfileCommentWr(fid, "A 3D unstructured mesh : 2 polyhedrons")
except RuntimeError as ex:
    print("ERROR : write file description ...\n%s" % ex)
    doCleanup(fid, -1)

#  mesh creation : a 3D unstructured mesh
try:
    med.MEDmeshCr(fid, meshname, spacedim, meshdim, med.MED_UNSTRUCTURED_MESH,
                  "A 3D mesh with 2 polyhedron", "", med.MED_SORT_DTIT,
                  med.MED_CARTESIAN, axisname, unitname)
except RuntimeError as ex:
    print("ERROR : mesh creation ...\n%s" % ex)
    doCleanup(fid, -1)

#  nodes coordinates in a cartesian axis in full interlace mode
#  (X1,Y1, X2,Y2, X3,Y3, ...) with no iteration and computation step