Commit ea644fbd authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

fix typos in doc

parent ac1a6528
Pipeline #7915 passed with stages
in 3 minutes and 33 seconds
......@@ -4,9 +4,9 @@ Main Features :
- Import ESRI shapefiles to define tagged domain boundaries, interior lines and interior points.
- Define arbitrary mesh elements size fields based on distances from lines or raster files.
- Create a low-resolution valid topology from high-resolution non conformal (i.e. intersecting) data.
- Create a low-resolution valid topology from high-resolution non-conformal (i.e. intersecting) data.
Seamesh is distributed under the GPL_. See the gitlab page of the project for the `source code`_ and `bug reports`_. The documentation_ contains examples, Python API references and installation instructions.
Seamesh is distributed under the GPL_. See the project gitlab page for the `source code`_ and `bug reports`_. The documentation_ contains examples, Python API reference and installation instructions.
Binary packages for 64 bits linux, windows and OSX are available on pypi_.
.. _gmsh : https://www.gmsh.info
......
......@@ -10,14 +10,14 @@ Seamsh depends on the following python3 packages:
Depending on your platform, gdal and scipy can probably be installed directly from your package manager, otherwise pip can be used (follow the links above for installation instructions).
To install gmsh-dev, follow the instuctions on the gmsh-dev_ pypi page. Do not forget, to uninstall other previous gmsh installations. Check that gmsh-dev is correctly installed with the following command.
To install gmsh-dev, follow the instuctions on the gmsh-dev_ pypi page. Do not forget, to uninstall possible previous gmsh installations. Check that gmsh-dev is correctly installed with the following command.
.. code-block:: bash
python3 -c "import gmsh;gmsh.initialize();print(gmsh.option.getString('General.Version'))"
The output should be a version number >= 3.6.1.
On some platforms, it is necessary to set the python path manually after installation e.g. :
On some platforms, setting the python path manually after installation is necessary, e.g. :
.. code-block:: bash
......
......@@ -4,6 +4,6 @@ API Reference
.. toctree::
:maxdepth: 4
seamsh.geometry
seamsh.field
seamsh.gmsh
seamsh.geometry
......@@ -20,9 +20,10 @@ domain = seamsh.geometry.Domain(domain_srs)
# %%
# Boundary curves are created from a list of control points, an osr projection,
# a physical tag and a curve type. If the projection does not match the domain's
# projection, the points are re-projected conversion is done.
# projection, the points are re-projected.
#
# A STRICTPOLYLINE curve linearly interpolates control points and forces a mesh
# on each control point.
# point on each control point.
domain.add_boundary_curve([[0,0],[-0.2,0.25],[-0.2,0.75],[0,1]],
"wall0",domain_srs,curve_type=CurveType.STRICTPOLYLINE)
......@@ -42,13 +43,13 @@ domain.add_boundary_curve([[0,0],[0.25,-0.2],[0.75,-0.2],[1,0]],
# %%
# A BSPLINE is smoother than a SPLINE but the control points are not on the
# curves.
# curve.
domain.add_boundary_curve([[1,1],[1.2,0.75],[1.2,0.25],[1,0]],
"wall3",domain_srs,curve_type=CurveType.BSPLINE)
# %%
# If the last point is the same as the first point, a periodic curve is
# If the last point is the same as the first one, a periodic curve is
# created.
domain.add_boundary_curve([[0.4,0.6],[0.6,0.6],[0.6,0.4],[0.4,0.4],[0.4,0.6]],
......@@ -57,7 +58,7 @@ domain.add_boundary_curve([[0.4,0.6],[0.6,0.6],[0.6,0.4],[0.4,0.4],[0.4,0.6]],
# %%
# Interior curves are meshed on both sides, they do not define the domain
# boundaries but forces edge alignment and mesh points. When an interior curve
# can touch a boundary or another interior curve, a control point should be
# touch a boundary or another interior curve, a control point should be
# present in both curves at the intersection.
domain.add_interior_curve([[-0.2,0.75],[0.1,0.6],[0.2,0.4],[0.1,0.4]],
......
# %%
# GIS Data
# ========
# This example illustrates how to insert different types of curves
# This example illustrates how the lirbary interacts with various GIS file formats.
# directly from numpy arrays and osr spatial references.
#
# For the sake of this example we, start by downloading some data.
# For the sake of this example, we start by downloading some data.
import os
import urllib.request
......@@ -33,7 +33,7 @@ domain_srs.ImportFromProj4("+proj=utm +ellps=WGS84 +zone=31")
domain = seamsh.geometry.Domain(domain_srs)
# %%
# We load all curves from a given ESTRI shapefile as POLYLINEs.
# We load all curves from a given ESTRI shapefile as polylines.
# In the shapefile, a field named "physical" defines the physical tag of each
# curve. If a re-projection is required, it will be done automatically.
......@@ -48,21 +48,21 @@ domain.add_interior_curves_shp("data/interior.shp",None,CurveType.STRICTPOLYLINE
# %%
# Seamsh provides helper classes to compute the element size field.
#
# field.Raster allows to load geotiff files (or any raster file supported by gdal)
# field.Raster allows to load geotiff files (or any raster file supported by gdal).
bath_field = seamsh.field.Raster("data/medit.tiff")
# %%
# field.Distance can be used to compute the distance from given (tagged) boundaries,
# a first field returns the distance from boundaries with physical tag "coast", or
# field.Distance can be used to compute the distance from given (tagged) boundaries.
# A first field returns the distance from boundaries with physical tag "coast", or
# "island". The curves are sampled at regular intervals and the computed distance is
# actually the distance from the closest sampling point. The second argument compute
# actually the distance from the closest sampling point. The second argument sets
# the length of the interval between the sampling points.
dist_coast_field = seamsh.field.Distance(domain,100,["coast","island"])
# %%
# A second distance fields return the distance from the island tagged "porquerolles",
# A second distance field returns the distance from the island tagged "porquerolles",
# in the shp file.
dist_porquerolles_field = seamsh.field.Distance(domain,20,["porquerolles"])
......@@ -78,7 +78,7 @@ def mesh_size(x,projection) :
return s_dist
# %%
# another option would be to take a mesh size proportional to the square root
# Another option would be to take a mesh size proportional to the square root
# of the (clipped) bathymetry :
# def mesh_size(x,projection) :
......@@ -95,7 +95,7 @@ def mesh_size(x,projection) :
seamsh.gmsh.mesh(domain,"gis_mesh.msh",mesh_size,intermediate_file_name="debug")
# %%
# the gmsh.convert_to_gis function can be used to convert a gmsh .msh file
# in a shape file or a geo package file.
# The gmsh.convert_to_gis function can be used to convert a gmsh .msh file
# into a shape file or into a geo package file.
seamsh.gmsh.convert_to_gis("gis_mesh.msh",domain_srs,"gis_mesh.gpkg")
......@@ -14,7 +14,7 @@
#
# But for now, the coarsening algorithm presents several limitations:
# - The physical tags are lost (this will be fixed soon).
# - Interior curves hare not handled, they can be present as long as they
# - Interior curves are not handled, they can be present as long as they
# do not intersect the domain boundaries (external and islands) but they
# won't be coarsened.
#
......@@ -51,14 +51,14 @@ def mesh_size(x,projection) :
# %%
# The geometry.coarsen_boundaries function requires in input the coordinates of one (any)
# point which inside the domain. The last parameters should be at least two times smaller
# point which is inside the domain. The last parameters should be at least two times smaller
# than the smallest value returned by the mesh_size callback, otherwise the resulting
# geometry will be invalid.
coarse = seamsh.geometry.coarsen_boundaries(domain,(8e5,4.68e6),domain_srs,mesh_size,20)
# %%
# The resulting coarsend domain can be meshed normally.
# The resulting coarsened domain can be meshed normally.
seamsh.gmsh.mesh(coarse,"coarse_boundary_mesh.msh",mesh_size)
......@@ -49,7 +49,7 @@ seamsh.gmsh.gmsh.option.setNumber("Mesh.RecombinationAlgorithm",1);
seamsh.gmsh.gmsh.option.setNumber("Mesh.Algorithm",8);
# %%
# Then the mesh is generated.
# Eventually the mesh is generated.
seamsh.gmsh.mesh(coarse,"quad_mesh.msh",mesh_size)
......@@ -62,7 +62,7 @@ class Distance:
def __call__(self, x: np.ndarray, projection: osr.SpatialReference
) -> np.ndarray:
"""Compute the distance between each point of x and the curves.
"""Computes the distance between each point of x and the curves.
Args:
x: the points [n,2]
......@@ -96,7 +96,7 @@ class Raster:
def __call__(self, x: np.ndarray, projection: osr.SpatialReference
) -> np.ndarray:
"""Evaluate the field value on each point of x.
"""Evaluates the field value on each point of x.
Keyword arguments:
x: the points [n,2]
......
......@@ -258,7 +258,7 @@ class Domain:
def add_interior_curve(self, points: np.ndarray, physical_tag: str,
projection: str,
curve_type: CurveType = CurveType.POLYLINE) -> None:
""" Add a tagged curve inside the domain. The curve
""" Adds a tagged curve inside the domain. The curve
is not part of the domain boundary and will be meshed on both sides.
Args:
......@@ -273,11 +273,11 @@ class Domain:
def add_interior_points_shp(self, filename: str,
physical_name_field: str = None) -> None:
"""Add all points of a shape file as forced mesh points.
""" Adds all points of a shape file as forced mesh points.
Args:
filename: path to a shapefile.
physical_name_field: name of and attribute string field with the
physical_name_field: name of an attribute string field with the
curves physical tags
"""
self._add_shapefile(filename, physical_name_field, None, True, None)
......@@ -286,7 +286,7 @@ class Domain:
physical_name_field: str = None,
curve_type: CurveType = CurveType.POLYLINE
) -> None:
"""Add all lines, polylines and polygons of a shape file as forced
"""Adds all lines, polylines and polygons of a shape file as forced
interior mesh lines
Args:
......@@ -302,13 +302,13 @@ class Domain:
physical_name_field: str = None,
curve_type: CurveType = CurveType.POLYLINE
) -> None:
""" Add all lines, polylines and polygons of a shapefile as domain
""" Adds all lines, polylines and polygons of a shapefile as domain
boundaries
Args:
filename: path to a shapefile.
physical_name_field: name of and attribute string field with the
curves physical tags
physical_name_field: name of an attribute string field containing
the curves physical tags
curve_type: curves interpolation
"""
self._add_shapefile(filename, physical_name_field, False, False,
......@@ -322,16 +322,16 @@ def coarsen_boundaries(domain: Domain, x0: typing.Tuple[float, float],
x0projection: osr.SpatialReference,
mesh_size: MeshSizeCallback,
sampling: float) -> Domain:
""" Create a new Domain with the same projection and coarsend coarsend
""" Creates a new Domain with the same projection and coarsened
boundaries.
For the moment, the physical tags are not transfered to the new Domain,
For the moment, the physical tags are not transferred to the new Domain,
this will be implemented in the future.
Args:
domain: the domain to coarsen
x0: the coordinates of one point inside the domain.
x0projection: the coordinates system of x0, for now, this parameter
x0projection: the coordinates system of x0. For now, this parameter
is ignored and the x0 should be in the same coordinate system
as the domain.
mesh_size: a function returning the desired mesh element size for given
......
......@@ -72,7 +72,7 @@ def _curve_sample(curve, lc):
def mesh(domain: Domain, filename: str, mesh_size: MeshSizeCallback,
version: float = 4.0, intermediate_file_name: str = None) -> None:
""" Use gmsh to generate a mesh from a geometry and a mesh size callback
""" Calls gmsh to generate a mesh from a geometry and a mesh size callback
Args:
domain: the input geometry
......@@ -195,14 +195,14 @@ def mesh(domain: Domain, filename: str, mesh_size: MeshSizeCallback,
def convert_to_gis(input_filename: str, projection: osr.SpatialReference,
output_filename: str) ->None:
""" Convert a triangular gmsh mesh into shapefile or geopackage.
""" Converts a triangular gmsh mesh into shapefile or geopackage.
Args:
input_filename : any mesh file readable by gmsh (typically
a .msh file)
projection: the projection assigned to the output layer, mesh
files do not store any projection so neither checks nor
re-projection are performed.
re-projections are performed.
output_filename : shape file (.shp) or geopackage (.gpkg) file
"""
gmsh.model.add(str(uuid.uuid4()))
......
......@@ -48,7 +48,7 @@ setuptools.setup(
package_data={"seamsh":["*.so","*.dll","*.dll.a","*.dylib","COPYING.txt","AUTHORS.txt","LICENSE.txt"]},
classifiers=[
"Environment :: Console",
"Development Status :: 3 - Alpha",
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment