Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent default options for tetrahedralize? #24

Open
sampotter opened this issue Mar 20, 2021 · 4 comments
Open

Inconsistent default options for tetrahedralize? #24

sampotter opened this issue Mar 20, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@sampotter
Copy link

sampotter commented Mar 20, 2021

Doing a very basic test with tetgen, getting some funky behavior.

I have the following command-line invocation of tetgen: tetgen -q -k -C -B -N -E -F -a0.01 L.off.

Trying to straightforwardly translate this a call to tetrahedralize, I get:

import pyvista as pv

from tetgen import TetGen

grid = pv.read('box.off')
points = grid.points
faces = grid.cells_dict[5]

tet = TetGen(points, faces)
tet.tetrahedralize(docheck=True, nobound=True, maxvolume=0.01)

Passing the -q flag by setting quality=True appears to be redundant, and the -N, -E, and -F flags don't have equivalents for this wrapper library (makes sense). Likewise, -k flag doesn't make much sense. So far so good.

Now, the problem is that if I vary maxvolume, nothing happens:

In [32]: tet.tetrahedralize(docheck=True, nobound=True, maxvolume=0.01); tet.grid
(... many lines of output omitted...)
Out[32]:
UnstructuredGrid (0x11bfa77c0)
  N Cells:	18
  N Points:	53
  X Bounds:	0.000e+00, 2.000e+00
  Y Bounds:	0.000e+00, 2.000e+00
  Z Bounds:	0.000e+00, 1.000e+00
  N Arrays:	0

In [33]: tet.tetrahedralize(docheck=True, nobound=True, maxvolume=0.001); tet.grid
(... many lines of output omitted...)
Out[33]:
UnstructuredGrid (0x11bfa5ad0)
  N Cells:	18
  N Points:	53
  X Bounds:	0.000e+00, 2.000e+00
  Y Bounds:	0.000e+00, 2.000e+00
  Z Bounds:	0.000e+00, 1.000e+00
  N Arrays:	0

In [34]: tet.tetrahedralize(docheck=True, nobound=True, maxvolume=0.0001); tet.grid
(... many lines of output omitted...)
Out[34]:
UnstructuredGrid (0x11bfab8a0)
  N Cells:	18
  N Points:	53
  X Bounds:	0.000e+00, 2.000e+00
  Y Bounds:	0.000e+00, 2.000e+00
  Z Bounds:	0.000e+00, 1.000e+00
  N Arrays:	0

I'll attach the original OFF file, but this is definitely the wrong behavior. There should be many more tetrahedra as I decrease maxvolume. The mesh is just a simple L-shaped room = ([0, 2] x [0, 2] x [0, 1]) \ ([1, 2] x [1, 2] x [0, 1]) (IIRC... maybe slightly different dimensions, but this is the gist.)

L.off.zip

@MichaelHillier
Copy link

I had the same experience as you. In the end I had to go through a trial and error process varying the flags/variables to the tetrahedralize command.

A working example of varying the maxvolume I have is:

nodes, tetras = tgen.tetrahedralize(minratio=1.414, mindihedral=16, fixedvolume=1, maxvolume=maxvol, regionattrib=1, nobisect=False, steinerleft=-1, order=1, metric=1, meditview=1, nonodewritten=0, verbose=2)

There are a lot of issues with the flags: some are redundant and some don't work at all. Hope this helps.

@sampotter
Copy link
Author

Do you have the same problem if you use tetgen from the command line? For now, I'm avoiding this wrapper library and just using the command-line interface to tetgen, since it seems to, you know... work...

I would really like to be able to use this wrapper to eliminate a few shell scripts from my usual workflow, but can't do this right now since this wrapper doesn't seem very reliable (or developed for actively, for that matter). I also don't have time to take this project on myself at the moment.

Bummer. :-(

@MichaelHillier
Copy link

Tetgen from the command line does not have the same problem. It's really robust code. I kept hammering away at finding work arounds within the wrapper library to get it to work to streamline my workflow. Having to run separate programs to get my end result was cumbersome. I have something working for my current needs but the process was frustrating. If I had the time to make the necessary updates to the wrapper I would, but don't have the time.

@tkoyama010 tkoyama010 added the bug Something isn't working label Jun 25, 2021
@Nobregaigor
Copy link

I am also experiencing similar issues. Is there any update on this topic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants