 # Maniplate mesh coordinates based on marker

I would like to change the coordinate of mesh based on the marker.
Specifically, I would like to change the coordinates at the boundary of 3D mesh.

Following is the small example of what I want to do.

``````from fenics import *

mesh = UnitSquareMesh(32,32)
bdry= MeshFunction("size_t", mesh, mesh.geometry().dim() - 1, mesh.domains())
CompiledSubDomain("x < 0 + 1e-12").mark(bdry, 1)
``````

I know it is possible to change the coordinate with something like

``````x = mesh.coordinates()
x[:,1] = some manipulation
``````

However, is it possible to do the same manipulation based on the boundary marker ??

1 Like

I’m a bit rusty with old DOLFIN, but hopefully the following helps

``````from dolfin import *

mesh = UnitSquareMesh(32,32)
bdry_verts_mf = MeshFunction("bool", mesh, 0, False)
CompiledSubDomain("x < 0 + 1e-12").mark(bdry_verts_mf, True)

for v in bdry_verts_mf.where_equal(True):
mesh.coordinates()[v,0] -= 0.1

import matplotlib.pyplot as plt
plot(mesh)
plt.show()
``````

I just want to warp the vertices on the left boundary by (-0.1, 0)^\top. 2 Likes