# Data from \[P2,P2\]

**URL:** https://community.freefem.org/t/data-from-p2-p2/2016
**Category:** General Discussion
**Created:** [September 19, 2022, 8:49pm UTC](https://community.freefem.org/t/data-from-p2-p2/2016 "2022-09-19T20:49:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Stefanosv](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@Stefanosv](https://community.freefem.org/u/Stefanosv)
#### Post date: [September 19, 2022, 8:49pm UTC](https://community.freefem.org/t/data-from-p2-p2/2016/1 "2022-09-19T20:49:31Z")

</div>

Hello,  
I think I have something misunderstood about [P2,P2] fespaces  
I have the following fespace that I use on an elasticity problem  
`fespace Vh(th, [P2,P2]); Vh [ux, uy], [w, s]; `  
To extract the displacement on the x axis I used  
`for(int i=0; i < ux.n; i++){ ux1(i)=ux[](i); } `  
By doing the same on to get the displacement on the y axis (uy) I get the same values as ux which definently doesnt make sense since I’ve only applied vertical force.  
Do I understand something wrong about [P2,P2] spaces?

---

<div class="post-metadata">

### Author: ![julienG](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/julieng/32/222_2.png) [@julienG](https://community.freefem.org/u/julienG)
#### Post date: [September 20, 2022, 8:27am UTC](https://community.freefem.org/t/data-from-p2-p2/2016/2 "2022-09-20T08:27:15Z")

</div>

For a vector fespace `[ux, uy]`, the array `ux[]` is the array of all the degrees of freedom of the finite-element space `[P2,P2]`. The same is also true for ` uy[]`. So both `ux[](i)` and `uy[](i)` return the same `i`-th degree of freedom of the full fe-space…

---

<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: [September 20, 2022, 3:20pm UTC](https://community.freefem.org/t/data-from-p2-p2/2016/3 "2022-09-20T15:20:47Z")

</div>

To day to get only the ux replacement

```auto
     fespace Wh(th,P2); //scalar FE.
     Wh wx,wy; // x,y déplacement
    // simple way
   wx=ux;
  wy=uy:

for(int i=0; i < wx.n; i++){ wx[][i]=ux[](2*i); } 
for(int i=0; i < wy.n; i++){ wy[][i]=ux[](2*i+1); } 

```
