// Discussion: // // This example reads pre-existing mesh files. // // Location: // // http://people.sc.fsu.edu/~jburkardt/freefem_src/read_mesh/read_mesh.edp // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 18 February 2015 // // Author: // // John Burkardt // // Reference: // // Frederic Hecht, // Freefem++, // Third Edition, version 3.22 // cout << "\n"; cout << "read_mesh:\n"; cout << " FreeFem++ version.\n"; cout << " Read meshes defined by BAMG, GMSH, MEDIT, MESH2D, SAVEMESH.\n"; // // Read a mesh that was created by FreeFem++'s SAVEMESH. // cout << "\n"; cout << " Read savemesh.msh, created by FreeFem++ savemesh() command.\n"; mesh Th1 = readmesh ( "savemesh.msh" ); plot ( Th1, wait = true, ps = "savemesh.ps" ); // // Read a mesh that was created by BAMG and saved in MSH format. // The BAMG mesh includes two parts, bamg_g.msh and bamg_o.msh. // cout << " Read bamg_o.msh + bamg_g.msh, created by the bamg program.\n"; mesh Th2 = readmesh ( "bamg_o.msh" ); plot ( Th2, wait = true, ps = "bamg.ps" ); // // Read a mesh that was created by MEDIT and saved in MESH format. // cout << " Read medit.mesh, created by the medit program.\n"; mesh Th3 = readmesh ( "medit.mesh" ); plot ( Th3, wait = true, ps = "medit.ps" ); // // Read a mesh that was created by GMSH and saved in MESH format. // // This has been surprisingly miserably difficult. // For one thing, GMSH seems to assume you want a 3D mesh. // If you save your data as an INRIA MESH file, it will internally // list dimension 3, and have a bogus 0 Z coordinate, AND all the // triangles may have negative area, requiring a reordering of the // indices. NOT CONVENIENT is hardly the description. // cout << " Read gmsh.mesh, created by the gmsh program.\n"; mesh Th4 = readmesh ( "gmsh.mesh" ); plot ( Th4, wait = true, ps = "gmsh.ps" ); // // Read a mesh that was created by MESH2D, // converted by MESH2D_TO_MEDIT and saved in MESH format. // cout << " Read mesh2d.mesh, created by mesh2d\n"; cout << " and converted by mesh2d_to_medit.\n"; mesh Th5 = readmesh ( "mesh2d.mesh" ); plot ( Th5, wait = true, ps = "mesh2d.ps" ); // // Terminate. // cout << "\n"; cout << "read_mesh:\n"; cout << " FreeFem++ version.\n"; exit ( 0 );