Error operator when returning a mesh vector

Hello fellows!

I’m optimizing one of my codes in freefem by creating functions.
But i’m having some issue when I try to transfer a mesh vector from idp file to edp file.

The codes follow

"meshcreation.idp"

func mesh[int] meshcreation(){

  • […definition of parameters…]*

  • border Q01(t=0, 1){x=x1t; y=y0; label=1;}

  • border Q03(t=0, 1){x=x1-x1t; y=y1; label=3;}

  • border Q04(t=0, 1){x=x0; y=y1-y1t; label=4;}

  • border Q02(t=0, 1){x=x1; y=y1t; label=2;}

  • border C01(t=0, 2pi){x=cx+rcos(t); y=cy+rsin(t); label=5;}

  • border C02(t=0, 2*pi){x=cx+(rd)*cos(t); y=cy+(rd)sin(t); label=6;}

  • mesh Th = buildmesh (Q01(3n) + Q02(3n) + Q03(3n) + Q04(3n) + C01(3n) + C02(3n));*

  • mesh Th2 = buildmesh (C01(3n) + C02(-2n)); //to know body \ desease size*

  • mesh Th3 = buildmesh (C02(2n)); //to know desease size

  • mesh[int] Meshes(3);*

  • Meshes[0] = Th;*

  • Meshes[1] = Th2;*

  • Meshes[2] = Th3;*

  • return Meshes;*
    }

Then, I call this meshcreation function in “test.edp”

include “meshcreation.idp”

mesh[int] meshes = meshcreation();

For some reason this is not working and I can’t figure out why.

When I changed from mesh[int] to mesh and return only one mesh or changed from mesh[int] to real[int] and return a vector of real numbers, the code worked just fine.

This message of error appears " mesh[int] meshes = meshcreation(); error operator ← <2KNIPKN5Fem2D4MeshEE>, <2KNIPKN5Fem2D4MeshEE>"

Someone has any idea of how can i fix this?

Thanks in advance.

The bug is due to misning operator …

Blockquote

mesh[int] Th1(2);
mesh[int] Ths=Th1; 

Blockquote

I will try to correct rapidly

Blockquote

 func bool meshcreation(mesh[int] & Ths){
 Ths.resize(3); 

 Ths[0]=square(1,1); 
 Ths[1]=square(2,1,[x+1,y]);
 Ths[2]=square(3,1,[x+2,y]);
 return 1;
 }
 mesh[int] Ths(1);
 meshcreation(Ths) ;
 plot(Ths[0],Ths[1],Ths[2],wait=1);

Blockquote

I see…

Thank you very much!