Split a mesh by adding a node at the barycenter of elements

Hello all,

Given a 2D mesh Th .msh, what is the more efficient way to split the mesh by adding one node at the barycenter and then link the vertices of the triangles to the new nodes ?

Thank you in advance,

Best regards,

Loïc,

If someone knows how to do this in FF curious if you could also comment
the issues with doing it outside of FF. That is, I am looking at code to
take the FF mesh file and do some manipulations. If I understand this,
it should just be a batter of iterating through the triangls and finding
the varycenter, adding a new vertex, and then adding two new triangles
while just modfying the originial one with possible issues at
region boundaries.

I guess I wanted to do a manual mesh refinement adding points
along a set of isolines in a predictable way. Additionally, I would probably
have to interpolate dof values by fit to an analytical solution.
Basically I have a huge length scale problem but hope to skimp on
nodes in the fast changing boundaries.

Hello,

Yes it is, I want to iterate other triangles, find the barycenter and split the triangle in three smaller triangles. I think there will not be issues a region boundaries, as the mesh remains conform.

Loïc,

You can perform Powell–Sabin mesh refinement using the splitmesh* plugins.

Thanks !
It works with splitmesh3

For the readers :

load "splitmesh3"
mesh Th = square(10,10); 
Th = splitmesh3(Th); 

Best regards,

Loïc