Multipy mesh with coefficient

You can use the scale method to multiply all mesh vertex coordinates by a constant:

from dolfin import *
N = 4
factor = 3
mesh = UnitIntervalMesh(N)

# Scale mesh by `factor`:
mesh.scale(factor)

# Equivalent built-in function:
#mesh = IntervalMesh(N,0,factor)

# Check results:
print(FunctionSpace(mesh,"CG",1).tabulate_dof_coordinates())
1 Like