Get Mesh from Function


251
views
2
8 months ago by
If I define a Function u on a mesh as in 
from fenics import *
mesh = UnitSquareMesh(1,1)
lagrangeElement = FiniteElement("P", mesh.ufl_cell(), 1)
V = FunctionSpace(mesh, lagrangeElement)
u = Function(V)​

How can I get a pointer to the mesh object from the function? I'm thinking of something like

extractedMesh = u.function_space.mesh
Community: FEniCS Project

1 Answer


4
8 months ago by
Nate  
extractedMesh = u.function_space().mesh()
1
Wow. That was embarassing.
Thank you, Nate.
written 8 months ago by klunkean  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »