# How to assign locally value functions to elements in a P0 space

**URL:** <https://community.freefem.org/t/how-to-assign-locally-value-functions-to-elements-in-a-p0-space/204>\
**Category:** General Discussion\
**Created:** [December 23, 2019, 1:00pm UTC](https://community.freefem.org/t/how-to-assign-locally-value-functions-to-elements-in-a-p0-space/204 "2019-12-23T13:00:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jacoban90](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Jacoban90](https://community.freefem.org/u/Jacoban90)\
**Post date:** [December 23, 2019, 1:00pm UTC](https://community.freefem.org/t/how-to-assign-locally-value-functions-to-elements-in-a-p0-space/204/1 "2019-12-23T13:00:24Z")

</div>

Hi FreeFem community.

Im trying to define a criteria to remove boundary elements of a 3d mesh by obtaining the number of faces in contact to an adjacent mesh. As the trunc operator needs to define previously a function to establish the criteria to know which elements have to be removed. In my case this function is necessarily to be a logical function which has to be 1 in those elements which satisfy the aformentined condition, and 0 otherwise. It has to be defined in a P0 finite element space to be locally in the center of the element. Is there a command in freefem to assign the values of the function locally without solving a PDE equation?

Thank you very much in advance  
Best Regards  
Jacob

---

<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 23, 2019, 1:37pm UTC](https://community.freefem.org/t/how-to-assign-locally-value-functions-to-elements-in-a-p0-space/204/2 "2019-12-23T13:37:31Z")

</div>

if you now the number of the element  
fespace Ph(Th,P0);  
Ph u; // finite element P0

int kr = Th(0.55, 0.6).nuTriangle;

u[][k]=1 ; // for example

---

<div class="post-metadata">

**Author:** ![Jacoban90](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Jacoban90](https://community.freefem.org/u/Jacoban90)\
**Post date:** [December 23, 2019, 8:13pm UTC](https://community.freefem.org/t/how-to-assign-locally-value-functions-to-elements-in-a-p0-space/204/3 "2019-12-23T20:13:01Z")

</div>

Thank you very much for your answer. I tried these commands in my code and it worked properly.

Best Regards  
Jacob
