Hi,
I would like to know how to import and interpolate on my mesh a data (array) of type txt in freefem++. I haven’t seen an example like this in the documentation.
Thanks
I think you can use the triangulate
function to create a 2D mesh from a set of points. Then, you can define a P1
FE space, and assign the function values at the corresponding points to a FE variable.
Thank you very much, I will do it as you said.
Dear, I imported grid data and created a 2D Th using the method you mentioned, but all regions and label inTh are zero. How should I handle this? I want to use this Th to build a layer grid
Without more information, it is impossible to help. Maybe you could create multiple meshes and fuse them by adding them.
I also suggest you look around in the forum where you can find a lot of information about changing the labels of meshes.
dear, I am a beginner, I’m sorry about my description is not clear.
What I want to do is as follows: 1.import a 3D mesh, take out the upper surface nodes and their x-axis and y-axis coordinates: nv (x, y); 2.then use the “triangle” function to reconstruct a 2D mesh, and 3.finally use the Th mesh to construct a layer mesh. The problem I am currently facing is that the 2D mesh region and label I have reconstructed are both 0, so I am unable to build layermesh. Thank you again for your help
My code is as follows:
mesh3 Th3F = readmesh3(“test3Dint.msh”);
real xx,yy,zz;
real ZZ=0.05;//the upper surface of 3D mesh
int j=0;
real [int] xt(1188),yt(1188); //the nv number of the upper surface
for( int i=0;i<Th3F.nv;i++){
xx=Th3F(i).x;
yy=Th3F(i).y;
zz=Th3F(i).z;
if(zz==ZZ){
xt[j]=xx;
yt[j]=yy;
j=j+1;
}
}
mesh Th=triangulate(xt,yt);
int[int] regs = regions(Th);
int[int] labs = labels(Th);
cout << "Th region number: " << regs << " \nTh labels number: " << labs <<endl;
reuslt: