There is a strange behavior on FreeFem++, I’m running my code and for a mesh with h = 0.176777, that means
int globalH = 2^coarseMesh;
mesh calP = square(globalH,globalH);
with coarseMesh = 3
it gives
-- Square mesh : nb vertices =81 , nb triangles = 128 , nb boundary edges 32
-- mesh: Nb of Triangles = 1, Nb of Vertices 3
Segmentation fault (core dumped)
but for any other value of coarseMesh it runs without problems, I tried with 0, 1, 2, 4, 5 and 6 and it’s ok, but specifically for 3 it giver segmentarion fault.
line
– Square mesh : nb vertices =81 , nb triangles = 128 , nb boundary edges 32
come from
mesh calP = square(globalH,globalH);
but the line
– mesh: Nb of Triangles = 1, Nb of Vertices 3
come from with script line ???
Why do you extract all the vertices to rebuild after the triangle K, instead of extract directly the the triangle K from the global mesh using the function trunc ?
You can do something like this:
mesh calP = square(globalH,globalH);
fespace Tri(calP, P0);
Tri ChiK;
for(int k = 0; k < NbTriangles; k++){
ChiK[][k]=1; // P0 function used to mark the element i
Th[k]=trunc(calP, ChiK>0.1, split=2^subMesh); // a mesh made of only one triangle with refinement
ChiK[][k]=0;
}