← Back to team overview

dolfin team mailing list archive

Re: TriTetMesh 0.1

 

On Thursday 13 March 2008 21:26:38 Anders Logg wrote:
> On Thu, Feb 28, 2008 at 03:08:25PM +0100, Johan Hake wrote:
> > Dear all!
> >
> > I hearby present version 0.1 of TriTetMesh. It is a c++/python wrapper of
> > the high quality mesh generators: Tetgen and Triangle.
> >
> > The output format is dolfin mesh, and dolfin meshfunctions for markers.
> > It is also possible to output the native Tetgen and Triangle formats.
> >
> > For now the code resides in a tarball:
> >
> > <http://folk.uio.no/hake/tritetmesh/tritetmesh.tar.gz>
> >
> > I have not checked if it builds on mac, but it should build on
> > Linux/Ubuntu. You will then need swig, python, python-dev, python-numpy,
> > python-numpy-dev and scons. (I think this is all...)
> >
> > The documentation is sparse but have a look at the provided demos. It can
> > be usefull to look at the docstrings for the python functions too. As
> > TriTetMesh is a more or less complete wrapper of Triangle and Tetgen it
> > is instructive to have a look at their webpages for clues.
> >
> > Tetgen <http://tetgen.berlios.de>
> > Triangle <http://www.cs.cmu.edu/~quake/triangle.html>
> >
> > Please have a try!
> >
> > Send me an email if you encounter problems. Such discussions should
> > probably stay of this list ;)
> >
> > Cheers
> >
> > Johan
>
> Looks very nice!
>
> I've also looked a bit a Netgen as an alternative to Tetgen and it
> seems to have a simple interface that might be simpler to wrap than
> Tetgen. Netgen can also save directly to DOLFIN XML (patch from
> Kent-Andre that is in Netgen CVS).

I have had a brief look at. It looks like it is much more complex than tetgen 
and triangle. Triangle is two files, and tetgen three and the interface is 
well documented. 

Netgen is at least... well, many files. I think it will take some digging to 
get hte hang of the programing interface to the library.

As I understand it, netgen can only save dolfin mesh, not MeshFunction with 
markers, right?

> Netgen uses input files like these:
>
> # a cube
> solid cube = plane (0, 0, 0; 0, 0, -1)
>          and plane (0, 0, 0; 0, -1, 0)
>          and plane (0, 0, 0; -1, 0, 0)
>          and plane (1, 1, 1; 0, 0, 1)
>          and plane (1, 1, 1; 0, 1, 0)
>          and plane (1, 1, 1; 1, 0, 0);
>
> # two shperes
> solid sph1 = sphere (0.5, 0.5, 0.5; 0.58);
> solid sph2 = sphere (0.5, 0.5, 0.5; 0.75);
>
> # cut cube with inner and outer sphere
> solid main = cube and sph2 and not sph1;
>
> This would be *very* easy to wrap in DOLFIN so one could do things
> like
>
>   s1 = Sphere(...)
>   s2 = Sphere(...)
>   c  = Cube(...)
>
>   mesh = Mesh(c + s2 - s1)

It looks very nice. It could be cool to get it integrated in to a python 
environment. But it wont be done over night...

> Perhaps this could be done also with Tetgen/Triangle?

Not straight of. Tetgen uses what they call piecwise linear complexes (PLC), 
to define some surface geometry. A PLC can be any polygon in a plane, so this 
rules out a strict circular geometry. But it quite easy to defin circular 
geometries that is defined by these PLCs in python.

The Eularian operations, i.e., union, intersection and complement need it's 
own geometrical logic, which is not supported in tetgen or triangle. One 
could hypotesize that this could be added as a layer on top of triangle or 
tetgen.

Johan


Follow ups

References