seamsh.gmsh module
- seamsh.gmsh.convert_to_gis(input_filename, projection, output_filename)
Converts a triangular gmsh mesh into shapefile or geopackage.
- Parameters:
input_filename (
str
) – any mesh file readable by gmsh (typically a .msh file)projection (
SpatialReference
) – the projection assigned to the output layer, mesh files do not store any projection so neither checks nor re-projections are performed (if none mesh projection will be used).output_filename (
str
) – shape file (.shp) or geopackage (.gpkg) file
- Return type:
None
- seamsh.gmsh.mesh(domain, filename, mesh_size, version=4.1, intermediate_file_name=None, smoothness=0.3, output_srs=None, transfinite_curves={}, quad=False)
Calls gmsh to generate a mesh from a geometry and a mesh size callback
- Parameters:
domain (
Domain
) – the input geometryfilename (
str
) – output mesh file (.msh)mesh_size (
Callable
[[ndarray
,SpatialReference
],ndarray
]) – callbable prescribing the mesh element sizeversion (
float
) – msh file version (typically 2.0 or 4.0)intermediate_file_name (
Optional
[str
]) – if not None, save intermediate meshes to those files for debugging purpose (suffixes and extensions will be appended), if == “-”, an interactive gmsh graphical window will pop up after each meshing step.smoothness – Maximum gradation of the mesh size, any positive value is valid but a value in the range [0.1,0.5] is recommended.
output_srs (
Optional
[SpatialReference
]) – coordinate system of the output file (if None, the coordinate system of the domain is used).tranfinite_curves – dict(str, int) prescribe a fixed number of mesh getElements on curves with given physical tag.
quad (
bool
) – if True, generate quadrangles instead of triangles. This a achieved by generating a quad-dominant mesh and then splitting all elements (quads and triangles) into quads. So the resulting mesh size is half the prescribed one.
- Return type:
None
- seamsh.gmsh.reproject(input_filename, input_srs, output_filename, output_srs, output_version=4.1)
Change the coordinate of an existing mesh.
- Parameters:
input_filename (
str
) – input mesh file (any format readable by gmsh).input_srs (
SpatialReference
) – coordinate system of the input mesh. If None, the model projection is used.output_filename (
str
) – output mesh file (.msh)output_srs (
SpatialReference
) – coordinate system of the output file (if None, the coordinate system of the domain is used).output_version (
float
) – msh file version (typically 2.0 or 4.0)