62 for (k=1; k<=
mesh->
np; k++) {
67 for (k=1; k<=
mesh->
nt; k++) {
69 if ( !
MG_EOK(ptt) )
continue;
82 ier = MMG5_solTruncature_ani(
mesh,met);
103 int MMG_inxtt[5] = {0,1,2,0,1};
110 if (
sol->size!=1 ) {
111 fprintf(stderr,
"\n ## Error: %s: unexpected size of metric: %d.\n",
121 for (k=1; k<=
mesh->
nt; k++) {
123 if ( !ptt->
v[0] )
continue;
125 for (i=0; i<3; i++) {
132 ux = p1->
c[0] - p2->
c[0];
133 uy = p1->
c[1] - p2->
c[1];
134 dd = sqrt(ux*ux + uy*uy);
144 for (k=1; k<=
mesh->
np; k++) {
148 sol->m[k] =
sol->m[k] / (double)mark[k];
156 if ( MMG2D_caltri ) {
157 for (k=1; k<=
mesh->
nt; k++) {
178 double ux,uy,dd,tensordot[3];
179 MMG5_int k,ipa,ipb,iadr;
181 int MMG_inxtt[5] = {0,1,2,0,1};
188 if (
sol->size!=3 ) {
189 fprintf(stderr,
"\n ## Error: %s: unexpected size of metric: %d.\n",
199 for (k=1; k<=
mesh->
nt; k++) {
201 if ( !ptt->
v[0] )
continue;
203 for (i=0; i<3; i++) {
210 ux = p1->
c[0] - p2->
c[0];
211 uy = p1->
c[1] - p2->
c[1];
213 tensordot[0] = ux*ux;
214 tensordot[1] = ux*uy;
215 tensordot[2] = uy*uy;
218 sol->m[iadr] += tensordot[0];
219 sol->m[iadr+1] += tensordot[1];
220 sol->m[iadr+2] += tensordot[2];
224 sol->m[iadr] += tensordot[0];
225 sol->m[iadr+1] += tensordot[1];
226 sol->m[iadr+2] += tensordot[2];
232 for (k=1; k<=
mesh->
np; k++) {
241 dd = 1./(
sol->m[iadr]*
sol->m[iadr+2] -
sol->m[iadr+1]*
sol->m[iadr+1]);
242 dd *= (double)mark[k]*0.5;
244 tensordot[0] =
sol->m[iadr+2];
245 tensordot[1] = -
sol->m[iadr+1];
246 tensordot[2] =
sol->m[iadr];
248 sol->m[iadr] = dd*tensordot[0];
249 sol->m[iadr+1] = dd*tensordot[1];
250 sol->m[iadr+2] = dd*tensordot[2];
254 double lambda[2],vp[2][2];
257 assert (lambda[0] > 0. && lambda[1] > 0. &&
"Negative eigenvalue");
261 assert (isfinite(lambda[0]) && isfinite(lambda[1]) &&
"wrong eigenvalue");
270 if ( MMG2D_caltri ) {
271 for (k=1; k<=
mesh->
nt; k++) {
int MMG2D_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol)
Set the size and type of a solution field.
MMG5_pMesh MMG5_pSol * sol
int MMG5_eigensym(double m[3], double lambda[2], double vp[2][2])
API headers and documentation for the mmg2d library.
double MMG2D_caltri_ani(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pTria)
double MMG2D_caltri_iso(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pTria)
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
int MMG5_solTruncature_iso(MMG5_pMesh mesh, MMG5_pSol met)
int MMG5_2dSolTruncature_ani(MMG5_pMesh mesh, MMG5_pSol met)
#define MMG5_SAFE_FREE(ptr)
static int MMG2D_solTruncatureForOptim(MMG5_pMesh mesh, MMG5_pSol met, int ani)
int MMG2D_doSol_iso(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG2D_doSol_ani(MMG5_pMesh mesh, MMG5_pSol sol)
Structure to store vertices of an MMG mesh.
Structure to store triangles of a MMG mesh.