I am working on a viscoelasticity problem currently so the mesh is deformed due to the mechanics. Thus, some points might not be in the deformed mesh anymore. Is there any function can be used to check if the point is still in the deformed mesh or not?
You want to look at the FEniCS BoundingBoxTree class. It contains many functions that can be used for verifying whether a point is contained within a cell, mesh, etc.
Thanks for the reply and I did check the BoundingBoxTree class. It seems mesh.bounding_box_tree().compute_collision(Point) or mesh.bounding_box_tree().compute_first_collision(Point) are what I look for. However, the second one gave me only one result and the first one gave me several. One point, which is not nodal point or on the line segment should be only in one cell, right? What are the other results from mesh.bounding_box_tree().compute_collision(Point)?
Compute_collision will compute the collision of all the entities with a Point while compute_first_collision will always return its first entry. Especially if a point is on an element edge this can be tricky. You may also want to compare with the Cell.contains(Point) tool to verify your understanding is correct. Check out the following code: