Hi all, I am using mmg3d to adapt over a user defined metric.

Testing my code and inspecting my solution file, I have found out that mmg uses a too poor accuracy to read and/or process my solution file in my specific application, getting negative eigenvalues.

For instance, if my metric tensor is (copy-and-pasted from my .sol as it is)

```
8097.091091209694 1804.305060489222 402.2054081399274 -72518.23294020348 -16123.96737044247 658170.7035589842
```

with eigenvalues (computed using the above metric output in Matlab)

```
2.7982e-05 112.6875 6.6656e+05
```

The detected metric tensor in mmg is

```
2.125447e+08 4.736212e+07 1.055769e+07 -1.903568e+09 -4.232462e+08 1.727666e+10
```

with eigenvalues (computed using the above values of the output and rescaled using the right scale factor):

```
-1.9187e-05 112.6877 6.6654e+05
```

or with eigenvalues (provided in the mmg error message):

```
-1.489912e+00 2.957994e+06 1.749680e+10
```

or with eigenvalues (provided in the mmg error message and rescaled by the scale factor):

```
-5.675855238095237e-05 1.126854857142857e+02 6.665447619047619e+05
```

How can I solve this issue? (Without imposing a maximum aspect ratio, i.e. max(lambda)/min(lambda) < tol)

EDIT:

Decreasing aspect ratio tolerance, it works for only one iteration. Then, mmg computes negative eigenvalues again in the second iteration.

On the lines of “intent.c” checking the positivity of eigenvalues (line 197 and 256) I put some fprintf, and all the eigenvalues were little below zero (values like -1e-5), so that I modified those lines imposing the eigenvalues = 100*MMG5_EPSD, for instance

```
if ( lambda[i] < MMG5_EPSD )
{
lambda[i] = 100*MMG5_EPSD;
}
```

in this way it works, and produces sensible results. But the above procedure appears quite ugly. What do you think?