Dear MMG users and developers,
I am trying to use MMG3D_Set_tensorSols
, and I have tested it using the built-in example:
File:
mmg/libexamples/mmg3d/adaptation_example0/example0_b/main.c
In the main
function of this example, the metric solution is set to 0.5
using MMG3D_Set_scalarSols
.
To experiment with tensor-based metric input, I modified the code to use MMG3D_Set_tensorSols
. The final mesh generated appears reasonable, but it differs slightly from the one obtained using MMG3D_Set_scalarSols
. I am a bit confused about this discrepancy.
Could anyone clarify why the final mesh from MMG3D_Set_tensorSols
differs from the one obtained using MMG3D_Set_scalarSols
? Is there an expected behavior that I might be overlooking?
The complete code is attached. main.c (15.1 KB)
Hereโs the modified snippet using MMG3D_Set_tensorSols
:
if ( MMG3D_Set_solSize(mmgMesh, mmgSol, MMG5_Vertex, 12, MMG5_Tensor) != 1 )
exit(EXIT_FAILURE);
Nequation = 6;
sizeV = 0.5;
metric = (double *)malloc(12 * Nequation * sizeof(double));
for (v = 0; v < 12; v++) {
metric[Nequation * v + 0] = 1.0 / (sizeV * sizeV);
metric[Nequation * v + 1] = 0;
metric[Nequation * v + 2] = 0;
metric[Nequation * v + 3] = 1.0 / (sizeV * sizeV);
metric[Nequation * v + 4] = 0;
metric[Nequation * v + 5] = 1.0 / (sizeV * sizeV);
}
/* Assign metric tensor values */
if ( MMG3D_Set_tensorSols(mmgSol, metric) != 1 )
exit(EXIT_FAILURE);
Thanks,
Xiaodong