# Adding/loading new Finite element

**URL:** <https://community.freefem.org/t/adding-loading-new-finite-element/1604>\
**Category:** General Discussion\
**Created:** [March 16, 2022, 9:30pm UTC](https://community.freefem.org/t/adding-loading-new-finite-element/1604 "2022-03-16T21:30:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carina](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@Carina](https://community.freefem.org/u/Carina)\
**Post date:** [March 16, 2022, 9:30pm UTC](https://community.freefem.org/t/adding-loading-new-finite-element/1604/1 "2022-03-16T21:30:39Z")

</div>

Hi,  
I am trying to implement a new finite Element. But I actually don’t get how to load this with the dynamical link. I already read the documentation a couple of times and I am using windows. The example load.edp works. Where or what do I need to change to be able to just load my new FE?  
Thank you very much for help

---

<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:** [March 17, 2022, 10:37am UTC](https://community.freefem.org/t/adding-loading-new-finite-element/1604/2 "2022-03-17T10:37:27Z")

</div>

first test if you are able to use the dynamic loading copy plugin/seq/myfunction2.cpp in other place in

mf3.cpp

try to compile with to build the dll  
ff-c++ mf3.cpp  
copy mf3.dll in the FreeFem++ directory may be need administrator privilege  
cp examples/plugin/myfunction2.edp in mf3.edp  
change load “myfunction2” in load “mf3”  
and test the example

If it run, all you installation is OK for build you new finite element

add a the end of the source in 2D

```auto
  static TypeOfFE_TD_NNS0 Elm_TD_NNS;
  static AddNewFE FE__TD_NNS("TDNNS0", &Elm_TD_NNS);

```

or in 3d

```auto
 // add new FEs for DDM to build the partition of unity
  static TypeOfFE_P2Edge3ds0 Elm_P2Edge3ds0;
  // a static variable to add the finite element to freefem++
  static AddNewFE3 P2Edge3ds0("Edge23ds0", &Elm_P2Edge3ds0);

```

---

<div class="post-metadata">

**Author:** ![Carina](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@Carina](https://community.freefem.org/u/Carina)\
**Post date:** [March 17, 2022, 1:41pm UTC](https://community.freefem.org/t/adding-loading-new-finite-element/1604/3 "2022-03-17T13:41:39Z")

</div>

Thank you very much.

It actually does ask for the administrator privilege to copy the dll file into the FreeFem++ directory. Is there any way I can still ad my custom FE to FreeFem++?

---

<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:** [March 22, 2022, 4:01pm UTC](https://community.freefem.org/t/adding-loading-new-finite-element/1604/4 "2022-03-22T16:01:58Z")

</div>

ON way is to copy all the freefem directory in place where you have right, and change you PATH to use this freefem.

---

<div class="post-metadata">

**Author:** ![Carina](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@Carina](https://community.freefem.org/u/Carina)\
**Post date:** [April 6, 2022, 10:33am UTC](https://community.freefem.org/t/adding-loading-new-finite-element/1604/5 "2022-04-06T10:33:12Z")

</div>

Thank you so much! I really appreciate your help!

So now I got a new error while compiling from .cpp to .dll in Cygwin. It tells me:  
/cygdrive/c/Program Files (x86)/FreeFem++/include/VirtualSolverSparseSuite.hpp:10:10: fatal error: umfpack.h: No such file or directory  
10 | #include \<umfpack.h\>  
| ^ ~~~~~~~~~~  
compilation terminated.

What did I do wrong now?
