Hello everyone.
I used the image-based mesh generation code (Lemanlake example in the Freefem documentation, p. 194) to generate a breast mesh using P1 finite elements. I want the same thing with P2 finite elements. However, FreeFem has stopped working if I replace P1 with P2. Please help me fix what’s wrong with P2.
Thank you very much for your help.
BreastMesh-P2.zip (87.9 KB)
string legende;
int m=10;
load “ppm2rnm”
load “isoline”
real L=3;
string sein = “breast05.pgm”;
real AreaLac = 500.03;
real hsize =0.2;
real[int, int] Curves(3, 2);
int[int] be(1);
int nc;
{
real[int, int] ff1(sein);
int nx = ff1.n, ny = ff1.m;
mesh Th = square(nx-1, ny-1, [(nx-1)(x)/(20L), (ny-1)(1-y)/(20L)]);
fespace Vh(Th, P2); ////////////////////////////////////////// (I changed P1 to P2)/////////////////////////////
Vh f1;
f1 = ff1;
nc = isoline(Th, f1, iso=0.25, close=1, Curves, beginend=be, smoothing=.1, ratio=0.25);
}
int ic0 = be(0), ic1 = be(1)-1;
int NC = Curves(2, ic1)/hsize;
border G(t=0, 1){P=Curve(Curves, ic0, ic1, t);}
mesh Th=buildmesh(G(NC));
plot(Th);
The mesh with P1 is below. What if I want the same mesh with P2 finite elements ?