# How to create mesh from levet set function

**URL:** <https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680>\
**Category:** General Discussion\
**Created:** [September 3, 2023, 7:18pm UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680 "2023-09-03T19:18:34Z")\
**Posts on this page:** 14\
**Page:** 3

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 8, 2023, 11:50am UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/43 "2023-09-08T11:50:21Z")

</div>

There is no error in the attached file.

---

<div class="post-metadata">

**Author:** ![gurkanceren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/gurkanceren/32/1893_2.png) [@gurkanceren](https://community.freefem.org/u/gurkanceren)\
**Post date:** [September 8, 2023, 12:05pm UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/44 "2023-09-08T12:05:21Z")

</div>

sorry, here it is…  
[config (3).log](https://community.freefem.org/uploads/short-url/tBFpLJKicH7WXO4oJjCt5BxTtWP.log) (431 Bytes)

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 8, 2023, 12:29pm UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/45 "2023-09-08T12:29:58Z")

</div>

No error as well… please look at what you are sending before sending it.

---

<div class="post-metadata">

**Author:** ![gurkanceren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/gurkanceren/32/1893_2.png) [@gurkanceren](https://community.freefem.org/u/gurkanceren)\
**Post date:** [September 8, 2023, 12:53pm UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/46 "2023-09-08T12:53:37Z")

</div>

@prj I am not sure why what i see on my screen does not show up on config.log but I copied and pasted what i see here when i do make petsc-slepc

* * *

```
       UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details):

```

* * *

Error running make on TetGen: Could not execute “['cd  
/home/ceren/FreeFem-sources/3rdparty/ff-petsc/petsc-3.19.5/fr/externalpackages/tetgen1.6.0  
&& make CXX=”/usr/bin/mpic++" CXXFLAGS=“-Wno-lto-type-mismatch -Wno-psabi -O3  
-mtune=native -std=gnu++20 -fPIC -I. -fPIC -DTETLIBRARY” PREDCXXFLAGS=“-O0 -fPIC” tetlib  
&& cp _.a /home/fem/ff-petsc/r/lib && rm .a .o’]":  
make[1]: Entering directory  
‘/home/ceren/FreeFem-sources/3rdparty/ff-petsc/petsc-3.19.5/fr/externalpackages/tetgen1.6.0’  
/usr/bin/mpic++ -O0 -fPIC -c predicates.cxx  
/usr/bin/mpic++ -Wno-lto-type-mismatch -Wno-psabi -O3 -mtune=native -std=gnu++20 -fPIC  
-I. -fPIC -DTETLIBRARY -DTETLIBRARY -c tetgen.cxx  
ar r libtet.a tetgen.o predicates.o  
make[1]: Leaving directory  
'/home/ceren/FreeFem-sources/3rdparty/ff-petsc/petsc-3.19.5/fr/externalpackages/tetgen1.6.0’tetgen.cxx:  
In member function ‘bool tetgenio::load\_elem(char)’:  
tetgen.cxx:827:8: warning: ignoring return value of ‘char fgets(char_, int, FILE\*)’  
declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
827 | fgets(line, 1023, infile);  
| ~~~^~~~~~~~~~~~~~~~~~  
tetgen.cxx:840:10: warning: ignoring return value of ‘char\* fgets(char\*, int, FILE\*)’  
declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
840 | fgets(line, 1023, infile);  
| ~~~^~~~~~~~~~~~~~~~~~  
tetgen.cxx: In member function ‘bool tetgenio::load\_vtk(char\*)’:  
tetgen.cxx:2244:18: warning: ignoring return value of ‘size\_t fread(void\*, size\_t,  
size\_t, FILE\*)’ declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
2244 | fread((char\*)(&(coord[0])), sizeof(double), 1, fp);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
tetgen.cxx:2245:18: warning: ignoring return value of ‘size\_t fread(void\*, size\_t,  
size\_t, FILE\*)’ declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
2245 | fread((char\*)(&(coord[1])), sizeof(double), 1, fp);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
tetgen.cxx:2246:18: warning: ignoring return value of ‘size\_t fread(void\*, size\_t,  
size\_t, FILE\*)’ declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
2246 | fread((char\*)(&(coord[2])), sizeof(double), 1, fp);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
tetgen.cxx:2253:18: warning: ignoring return value of ‘size\_t fread(void\*, size\_t,  
size\_t, FILE\*)’ declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
2253 | fread((char\*)(&\_x), sizeof(float), 1, fp);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
tetgen.cxx:2254:18: warning: ignoring return value of ‘size\_t fread(void\*, size\_t,  
size\_t, FILE\*)’ declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
2254 | fread((char\*)(&\_y), sizeof(float), 1, fp);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
tetgen.cxx:2255:18: warning: ignoring return value of ‘size\_t fread(void\*, size\_t,  
size\_t, FILE\*)’ declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
2255 | fread((char\*)(&\_z), sizeof(float), 1, fp);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
tetgen.cxx:2304:16: warning: ignoring return value of ‘size\_t fread(void\*, size\_t,  
size\_t, FILE\*)’ declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
2304 | fread((char\*)(&nn), sizeof(int), 1, fp);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
tetgen.cxx:2316:18: warning: ignoring return value of ‘size\_t fread(void\*, size\_t,  
size\_t, FILE\*)’ declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
2316 | fread((char\*)(&id1), sizeof(int), 1, fp);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
tetgen.cxx:2317:18: warning: ignoring return value of ‘size\_t fread(void\*, size\_t,  
size\_t, FILE\*)’ declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
2317 | fread((char\*)(&id2), sizeof(int), 1, fp);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
tetgen.cxx:2318:18: warning: ignoring return value of ‘size\_t fread(void\*, size\_t,  
size\_t, FILE\*)’ declared with attribute ‘warn\_unused\_result’ [-Wunused-result]  
2318 | fread((char\*)(&id3), sizeof(int), 1, fp);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
ar: creating libtet.a  
cp: cannot create regular file ‘/home/fem/ff-petsc/r/lib/libtet.a’: Permission denied

* * *

make: \*\*\* [Makefile:215: petsc-3.19.5/tag-conf-real] Error 1

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 8, 2023, 12:59pm UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/47 "2023-09-08T12:59:57Z")

</div>

Does the directory `/home/fem` exists? Could you copy its content here? Do you have enough free space in your VM?

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [September 8, 2023, 1:30pm UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/48 "2023-09-08T13:30:46Z")

</div>

try something like this maybe,

```auto
ls -al `find /home -maxdepth 1`

```

---

<div class="post-metadata">

**Author:** ![gurkanceren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/gurkanceren/32/1893_2.png) [@gurkanceren](https://community.freefem.org/u/gurkanceren)\
**Post date:** [September 8, 2023, 1:36pm UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/49 "2023-09-08T13:36:31Z")

</div>

@prj it does exist, I have created it on my vm to be able to use it in --prefix command, rather than saying --prefix=${pwd}. It is empty though, nothing to copy here. I have enough space on my vm this was my two-days ago problem, I increaed the disc space.

Thank you,

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 8, 2023, 1:41pm UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/50 "2023-09-08T13:41:19Z")

</div>

If it’s empty, then it means you don’t have the proper credentials. You should stick to a path in which you have the proper read/write access, e.g., a sub-directory not in your `${HOME}`.

---

<div class="post-metadata">

**Author:** ![gurkanceren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/gurkanceren/32/1893_2.png) [@gurkanceren](https://community.freefem.org/u/gurkanceren)\
**Post date:** [September 9, 2023, 6:42am UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/51 "2023-09-09T06:42:06Z")

</div>

Hello again. I know the discussion is getting longer but I really want to get the mesh defined at the very begining of this question. @prj I have followed all instructions, created a folder with correct credentials not in my home directory (now it is not empty, it has a folder named ff-petsc and under that tw sub folders named c and r ). Following exactly the steps:

> git clone [GitHub - FreeFem/FreeFem-sources: FreeFEM source code](https://github.com/FreeFem/FreeFem-sources)  
> cd FreeFem-sources  
> git checkout develop  
> autoreconf -i  
> ./configure --enable-download --without-hdf5  
> –prefix=…  
> cd 3rdparty/ff-petsc  
> make petsc-slepc  
> cd -  
> ./reconfigure  
> make

I seem to go through the compilation. However when I simply want to run an example .edp file under FreeFem-sources/examples/tutorial and write FreeFem++ Laplace.edp I see the error message saying

Command ‘FreeFem++’ not found, but can be installed with:  
sudo apt install freefem++

same error when I use  
◦ FreeFem+±mpi  
◦ ffglut  
◦ ffmedit  
◦ ff-c++

how should I run the examples? any comments on that? or where to look for an error ?

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 9, 2023, 6:45am UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/52 "2023-09-09T06:45:32Z")

</div>

Is the folder `FreeFem-sources/src/nw` in your `${PATH}`?

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [September 9, 2023, 8:11am UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/53 "2023-09-09T08:11:12Z")

</div>

is there a “make install” or “make check” step?  
IIRC it did some tests and some point and should have displayed pass/fail  
although I may have it mixed up with other software 🙂

I guess to just make the flower mesh you could create each segment of the  
boundary individually right?

---

<div class="post-metadata">

**Author:** ![gurkanceren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/gurkanceren/32/1893_2.png) [@gurkanceren](https://community.freefem.org/u/gurkanceren)\
**Post date:** [September 9, 2023, 10:04am UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/54 "2023-09-09T10:04:08Z")

</div>

@prj when I write echo $PATH inside folder FreeFem-sources/examples/tutorial I see  
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

when I do echo $PATH inside folder FreeFem-sources I see the same thing. I guess FreeFem-sources/src/nw is not in my path. Should I add it, if yes, how?

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [September 9, 2023, 12:01pm UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/55 "2023-09-09T12:01:37Z")

</div>

Yes, you should add it. You can look at the end of the tutorial, last slide of `Optimal Compilation Process`, or do a quick Google search.

---

<div class="post-metadata">

**Author:** ![gurkanceren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/gurkanceren/32/1893_2.png) [@gurkanceren](https://community.freefem.org/u/gurkanceren)\
**Post date:** [September 9, 2023, 7:36pm UTC](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680/56 "2023-09-09T19:36:37Z")

</div>

Thanks for all the comments and help @prj @marchywka, after adding the path I can run the examples correctly. Now I have other problems as rotating the level set defined geometry and disturbing the mesh , but I might create a new discussion on that.

[Previous page](https://community.freefem.org/t/how-to-create-mesh-from-levet-set-function/2680.md?page=2)
