import MEDLoader as ml\r
-import os\r
+import os, sys\r
\r
def read_typ2(fichier, nom_med):\r
with open(fichier, "r") as fic: lines = fic.readlines()\r
\r
mm.write("{}/mesh.med".format(nom_med), 2)\r
\r
-# maillages 3D\r
-meshes = (("meshAA-random", "RandMesh", ("4", "8", "16", "32")),\r
- #("meshBB_well", "WellMesh_", ("1", "2", "3", "4", "5", "6", "7")),\r
- #("meshB_tetra", "tet.", ("00", "0", "1", "2", "3", "4", "5", "6")),\r
- ("meshC_voro", "vmesh_", ("1", "2", "3", "4", "5")),\r
- ("meshD_kershaw", "dkershaw", ("08", "16", "32", "64")),\r
- ("meshF_dbls", "dbls_", ("10", "20", "30", "40")))\r
- # ("meshH_locrafgrid", "locrafgrid_", ("1", "2", "3", "4", "5")),\r
- # ("meshI_checkerboard", "checkerboard_", ("2x2x2", "4x4x4", "8x8x8", "16x16x16", "32x32x32")))\r
-for t, m, d in meshes:\r
- for n in d:\r
- print t, n\r
- folder = "{}/jdd_{}".format(t, n)\r
- os.system("mkdir -p {}".format(folder))\r
- read_typ3("Meshes_3D/{}/{}{}.msh".format(t, m, n), folder)\r
+# maillages 3D du benchmark FVCA6\r
+# meshes = (("meshAA-random", "RandMesh", ("4", "8", "16", "32")),\r
+ # #("meshBB_well", "WellMesh_", ("1", "2", "3", "4", "5", "6", "7")),\r
+ # #("meshB_tetra", "tet.", ("00", "0", "1", "2", "3", "4", "5", "6")),\r
+ # ("meshC_voro", "vmesh_", ("1", "2", "3", "4", "5")),\r
+ # ("meshD_kershaw", "dkershaw", ("08", "16", "32", "64")),\r
+ # ("meshF_dbls", "dbls_", ("10", "20", "30", "40")))\r
+ # # ("meshH_locrafgrid", "locrafgrid_", ("1", "2", "3", "4", "5")),\r
+ # # ("meshI_checkerboard", "checkerboard_", ("2x2x2", "4x4x4", "8x8x8", "16x16x16", "32x32x32")))\r
+# for t, m, d in meshes:\r
+ # for n in d:\r
+ # print( t, n)\r
+ # folder = "{}/jdd_{}".format(t, n)\r
+ # os.system("mkdir -p {}".format(folder))\r
+ # read_typ3("Meshes_3D/{}/{}{}.msh".format(t, m, n), folder)\r
+\r
+if __name__ == "__main__":\r
+\r
+ if len(sys.argv) != 2:\r
+ print("USAGE: convert_gmsh_to_med.py file.typ")\r
+ sys.exit(-1)\r
+ \r
+ filename = sys.argv[1]\r
+ print("Converting ", filename)\r
+\r
+ l=len(filename)\r
+ name=filename[:l-5]\r
+ extension=filename[l-5:]\r
+ if extension==".typ2":\r
+ read_typ2(filename, name+".med")\r
+ elif extension==".typ3":\r
+ read_typ3(filename, name+".med")\r
+ else :\r
+ raise ValueError("File "+filename+" has unknown file extension "+extension)\r