Commit 029d3416 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

handle projection of central point in unref Fix #21

parent 5ea43e22
Pipeline #7964 passed with stages
in 2 minutes and 9 seconds
......@@ -12,8 +12,7 @@
# The only requirement is that the external boundary should be closed
# but the lines defining the boundaries can intersect each others.
# But for now, the coarsening algorithm presents several limitations:
# - The physical tags are lost (this will be fixed soon).
# But :
# - 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.
......@@ -35,6 +34,8 @@ import seamsh.geometry
import numpy as np
from osgeo import osr
latlong = osr.SpatialReference()
latlong.ImportFromProj4("+proj=latlong +ellps=WGS84 +unit=degrees")
domain_srs = osr.SpatialReference()
domain_srs.ImportFromProj4("+proj=utm +ellps=WGS84 +zone=31")
domain = seamsh.geometry.Domain(domain_srs)
......@@ -55,7 +56,7 @@ def mesh_size(x,projection) :
# 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)
coarse = seamsh.geometry.coarsen_boundaries(domain,(6.63,42.21),latlong,mesh_size,20)
# %%
# The resulting coarsened domain can be meshed normally.
......@@ -328,9 +328,7 @@ def coarsen_boundaries(domain: Domain, x0: typing.Tuple[float, float],
domain: the domain to coarsen
x0: the coordinates of one point inside the domain.
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.
x0projection: the coordinates system of x0.
mesh_size: a function returning the desired mesh element size for given
sampling: should be (at least) two times smaller than the smallest
......@@ -338,7 +336,7 @@ def coarsen_boundaries(domain: Domain, x0: typing.Tuple[float, float],
fail. This parameter will be removed (and determined automatically)
in the future.
x0 = _ensure_valid_points(np.array([x0]),x0projection,domain._projection)[0]
sampled = []
tags = []
maxtag = 1
Supports Markdown
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