52 MMG5_int k,i,iel,ipt,ipta,iptb;
54 MMG5_int ipt0,ipt1,ipt2,ipt3,*compt;
55 double vol,ax,ay,az,bx,by,bz;
56 double *nv,*pos,res,dd,ox,oy,oz,declic;
57 double LLAMBDA = 0.33;
76 for(i = 1 ; i<=
mesh->
np ; i++) {
78 pos[3*(i-1) + 1 + 0] = 0.;
79 pos[3*(i-1) + 1 + 1] = 0.;
80 pos[3*(i-1) + 1 + 2] = 0.;
84 for(k = 1 ; k<=
mesh->
ne ; k++) {
88 for(i=0 ; i<6 ; i++) {
96 pos[3*(ipta-1) + 1 + 0] += pptb->
c[0];
97 pos[3*(ipta-1) + 1 + 1] += pptb->
c[1];
98 pos[3*(ipta-1) + 1 + 2] += pptb->
c[2];
102 pos[3*(iptb-1) + 1 + 0] += ppta->
c[0];
103 pos[3*(iptb-1) + 1 + 1] += ppta->
c[1];
104 pos[3*(iptb-1) + 1 + 2] += ppta->
c[2];
110 for ( i=1 ; i<=
mesh->
np ; i++) {
114 assert ( !compt[i] );
119 dd = 1./(double) compt[i];
120 pos[3*(i-1) + 1 + 0] *= dd;
121 pos[3*(i-1) + 1 + 1] *= dd;
122 pos[3*(i-1) + 1 + 2] *= dd;
123 nv[3*(i-1) + 1] = ppt->
c[0] + LLAMBDA * (ppt->
c[0] - pos[3*(i-1) + 1 + 0]);
124 nv[3*(i-1) + 2] = ppt->
c[1] + LLAMBDA * (ppt->
c[1] - pos[3*(i-1) + 1 + 1]);
125 nv[3*(i-1) + 3] = ppt->
c[2] + LLAMBDA * (ppt->
c[2] - pos[3*(i-1) + 1 + 2]);
127 nv[3*(i-1) + 1] = ppt->
c[0];
128 nv[3*(i-1) + 2] = ppt->
c[1];
129 nv[3*(i-1) + 3] = ppt->
c[2];
133 pos[3*(i-1) + 1 + 0] = 0.;
134 pos[3*(i-1) + 1 + 1] = 0.;
135 pos[3*(i-1) + 1 + 2] = 0.;
140 for(k = 1 ; k<=
mesh->
ne ; k++) {
144 for(i=0 ; i<6 ; i++) {
152 pos[3*(ipta-1) + 1 + 0] += nv[3*(iptb-1) + 1];
153 pos[3*(ipta-1) + 1 + 1] += nv[3*(iptb-1) + 2];
154 pos[3*(ipta-1) + 1 + 2] += nv[3*(iptb-1) + 3];
158 pos[3*(iptb-1) + 1 + 0] += nv[3*(ipta-1) + 1];
159 pos[3*(iptb-1) + 1 + 1] += nv[3*(ipta-1) + 2];
160 pos[3*(iptb-1) + 1 + 2] += nv[3*(ipta-1) + 3];
167 for(i=1 ; i<=
mesh->
np ; i++) {
169 dd = 1./(double) compt[i];
170 pos[3*(i-1) + 1 + 0] *= dd;
171 pos[3*(i-1) + 1 + 1] *= dd;
172 pos[3*(i-1) + 1 + 2] *= dd;
173 ox = nv[3*(i-1) + 1];
174 oy = nv[3*(i-1) + 2];
175 oz = nv[3*(i-1) + 3];
176 nv[3*(i-1) + 1] = nv[3*(i-1) + 1] - LMU * (nv[3*(i-1) + 1] - pos[3*(i-1) + 1 + 0]);
177 nv[3*(i-1) + 2] = nv[3*(i-1) + 2] - LMU * (nv[3*(i-1) + 2] - pos[3*(i-1) + 1 + 1]);
178 nv[3*(i-1) + 3] = nv[3*(i-1) + 3] - LMU * (nv[3*(i-1) + 3] - pos[3*(i-1) + 1 + 2]);
180 dd = (nv[3*(i-1) + 1]-ox)*(nv[3*(i-1) + 1]-ox)
181 + (nv[3*(i-1) + 2]-oy)*(nv[3*(i-1) + 2]-oy)
182 + (nv[3*(i-1) + 3]-oz)*(nv[3*(i-1) + 3]-oz);
188 pos[3*(i-1) + 1 + 0] = 0.;
189 pos[3*(i-1) + 1 + 1] = 0.;
190 pos[3*(i-1) + 1 + 2] = 0.;
194 for(k = 1 ; k<=
mesh->
ne ; k++) {
197 if ( !
MG_EOK(pt) )
continue;
199 for(i=0 ; i<4 ; i++) {
209 for ( l=0; l<lon; l++ ) {
212 ipt0 = 3*(pt1->
v[0] - 1);
213 ipt1 = 3*(pt1->
v[1] - 1);
214 ipt2 = 3*(pt1->
v[2] - 1);
215 ipt3 = 3*(pt1->
v[3] - 1);
217 ax = nv[ipt2 + 1] - nv[ipt0 + 1];
218 ay = nv[ipt2 + 2] - nv[ipt0 + 2];
219 az = nv[ipt2 + 3] - nv[ipt0 + 3];
221 bx = nv[ipt3 + 1] - nv[ipt0 + 1];
222 by = nv[ipt3 + 2] - nv[ipt0 + 2];
223 bz = nv[ipt3 + 3] - nv[ipt0 + 3];
225 vol = (nv[ipt1 + 1] - nv[ipt0 + 1]) * (ay*bz - az*by) \
226 + (nv[ipt1 + 2] - nv[ipt0 + 2]) * (az*bx - ax*bz) \
227 + (nv[ipt1 + 3] - nv[ipt0 + 3]) * (ax*by - ay*bx);
234 memcpy(&pos[3*(ipt-1) + 1],ppt->
c,3*
sizeof(
double));
235 for ( l=0; l<lon; l++ ) {
238 ipt0 = 3*(pt1->
v[0] - 1);
239 ipt1 = 3*(pt1->
v[1] - 1);
240 ipt2 = 3*(pt1->
v[2] - 1);
241 ipt3 = 3*(pt1->
v[3] - 1);
243 ax = nv[ipt2 + 1] - nv[ipt0 + 1];
244 ay = nv[ipt2 + 2] - nv[ipt0 + 2];
245 az = nv[ipt2 + 3] - nv[ipt0 + 3];
247 bx = nv[ipt3 + 1] - nv[ipt0 + 1];
248 by = nv[ipt3 + 2] - nv[ipt0 + 2];
249 bz = nv[ipt3 + 3] - nv[ipt0 + 3];
251 vol = (nv[ipt1 + 1] - nv[ipt0 + 1]) * (ay*bz - az*by) \
252 + (nv[ipt1 + 2] - nv[ipt0 + 2]) * (az*bx - ax*bz) \
253 + (nv[ipt1 + 3] - nv[ipt0 + 3]) * (ax*by - ay*bx);
269 for(i=1 ; i<=
mesh->
np ; i++) {
271 ppt->
c[0] = nv[3*(i-1) + 1];
272 ppt->
c[1] = nv[3*(i-1) + 2];
273 ppt->
c[2] = nv[3*(i-1) + 3];
275 for(k=1 ; k<=
mesh->
ne ; k++) {
277 if ( !
MG_EOK(pt) )
continue;
281 if(
mesh->
info.
imprim > 5) fprintf(stdout,
" LAPLACIAN : %8f\n",res);
288 }
while(it++ < maxiter);
MMG5_pMesh MMG5_pSol * sol
int MMG5_boulevolp(MMG5_pMesh mesh, MMG5_int start, int ip, int64_t *list)
Given a vertex and a tetrahedron, find all tetrahedra in the ball of this vertex.
API headers and documentation for the mmg3d library, for volumetric meshes in 3D.
static const uint8_t MMG5_iare[6][2]
vertices of extremities of the edges of the tetra
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
#define MMG5_ADD_MEM(mesh, size, message, law)
#define MMG5_DEL_MEM(mesh, ptr)
int MMG3D_optlap(MMG5_pMesh mesh, MMG5_pSol sol)
Structure to store vertices of an MMG mesh.
Structure to store tetrahedra of an MMG mesh.