# Error operator when returning a mesh vector

**URL:** <https://community.freefem.org/t/error-operator-when-returning-a-mesh-vector/1389>\
**Category:** General Discussion\
**Created:** [December 14, 2021, 1:31am UTC](https://community.freefem.org/t/error-operator-when-returning-a-mesh-vector/1389 "2021-12-14T01:31:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaMattoso](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/ramattoso/32/499_2.png) [@RaMattoso](https://community.freefem.org/u/RaMattoso)\
**Post date:** [December 14, 2021, 1:31am UTC](https://community.freefem.org/t/error-operator-when-returning-a-mesh-vector/1389/1 "2021-12-14T01:31:24Z")

</div>

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=x1_t; y=y0; label=1;}_

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

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

- border Q02(t=0, 1){x=x1; y=y1_t; label=2;}_

- border C01(t=0, 2_pi){x=cx+r_cos(t); y=cy+r_sin(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(3_n) + Q02(3_n) + Q03(3_n) + Q04(3_n) + C01(3_n) + C02(3_n));\*

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

- mesh Th3 = buildmesh (C02(2_n)); //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.

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [December 14, 2021, 3:29pm UTC](https://community.freefem.org/t/error-operator-when-returning-a-mesh-vector/1389/2 "2021-12-14T15:29:54Z")

</div>

The bug is due to misning operator …

> Blockquote

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

```

> Blockquote

> [@RaMattoso](#):
>
> func mesh[int] meshcreation(){

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

---

<div class="post-metadata">

**Author:** ![RaMattoso](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/ramattoso/32/499_2.png) [@RaMattoso](https://community.freefem.org/u/RaMattoso)\
**Post date:** [December 14, 2021, 4:36pm UTC](https://community.freefem.org/t/error-operator-when-returning-a-mesh-vector/1389/3 "2021-12-14T16:36:10Z")

</div>

I see…

Thank you very much!
