4 & NSD,P,Q,R,NSHL,MCP,NCP,OCP,NEL,
5 & U_KNOT,V_KNOT,W_KNOT,B_NET,
6 & ni,nj,nk,u_hat,v_hat,w_hat,nders,
7 & shl,shgradl,shgradg,shhessg,dxidx,DetJ
17 integer MCP,NCP,OCP,NEL
19 real*8 u_knot(mcp+p+1),v_knot(ncp+q+1),w_knot(ocp+r+1)
20 real*8 b_net(mcp,ncp,ocp,nsd+1)
28 real*8 u_hat, v_hat, w_hat, du, dv, dw
35 real*8 shl(nshl),shgradl(nshl,nsd),shgradg(nshl,nsd),
36 & shhessg(nshl,nsd,nsd), tempshl(nshl),tempshgradl(nshl,nsd),
37 & shhessl(nshl,6), tempshhessl(nshl,6)
39 real*8 dxdxi(nsd,nsd), dxidx(nsd,nsd),dxdxixj(nsd,6), loclhs(6,6)
45 real*8 n(nders+1,p+1), m(nders+1,q+1),o(nders+1,r+1)
48 real*8 u, v,
w, denom_sum, derv_sum_u, derv_sum_v,
49 & derv_sum_w, derv_sum_uu,
50 & derv_sum_uv, derv_sum_uw,derv_sum_vv, derv_sum_vw,derv_sum_ww
53 integer ni, nj, nk, i, j, k, icount, aa
63 u = ((u_knot(ni+1)-u_knot(ni))*u_hat +
64 & u_knot(ni+1) + u_knot(ni))/2d+0
65 v = ((v_knot(nj+1)-v_knot(nj))*v_hat +
66 & v_knot(nj+1) + v_knot(nj))/2d+0
67 w = ((w_knot(nk+1)-w_knot(nk))*w_hat +
68 & w_knot(nk+1) + w_knot(nk))/2d+0
72 du = u_knot(ni+1)-u_knot(ni)
73 dv = v_knot(nj+1)-v_knot(nj)
74 dw = w_knot(nk+1)-w_knot(nk)
98 shl(icount) = n(1,p+1-i)*m(1,q+1-j)*o(1,r+1-k)*
99 & b_net(ni-i,nj-j,nk-k,nsd+1)
100 denom_sum = denom_sum + shl(icount)
104 & n(2,p+1-i)*m(1,q+1-j)*o(1,r+1-k)*
105 & b_net(ni-i,nj-j,nk-k,nsd+1)
106 derv_sum_u = derv_sum_u + shgradl(icount,1)
108 & n(1,p+1-i)*m(2,q+1-j)*o(1,r+1-k)*
109 & b_net(ni-i,nj-j,nk-k,nsd+1)
110 derv_sum_v = derv_sum_v + shgradl(icount,2)
112 & n(1,p+1-i)*m(1,q+1-j)*o(2,r+1-k)*
113 & b_net(ni-i,nj-j,nk-k,nsd+1)
114 derv_sum_w = derv_sum_w + shgradl(icount,3)
123 tempshgradl = shgradl
127 shgradl(i,1) = shgradl(i,1)/denom_sum -
128 & (shl(i)*derv_sum_u)/(denom_sum**2)
129 shgradl(i,2) = shgradl(i,2)/denom_sum -
130 & (shl(i)*derv_sum_v)/(denom_sum**2)
131 shgradl(i,3) = shgradl(i,3)/denom_sum -
132 & (shl(i)*derv_sum_w)/(denom_sum**2)
133 shl(i) = shl(i)/denom_sum
154 dxdxi(1,1) = dxdxi(1,1) +
155 & b_net(ni-i,nj-j,nk-k,1) *
157 dxdxi(1,2) = dxdxi(1,2) +
158 & b_net(ni-i,nj-j,nk-k,1) *
160 dxdxi(1,3) = dxdxi(1,3) +
161 & b_net(ni-i,nj-j,nk-k,1) *
163 dxdxi(2,1) = dxdxi(2,1) +
164 & b_net(ni-i,nj-j,nk-k,2) *
166 dxdxi(2,2) = dxdxi(2,2) +
167 & b_net(ni-i,nj-j,nk-k,2) *
169 dxdxi(2,3) = dxdxi(2,3) +
170 & b_net(ni-i,nj-j,nk-k,2) *
172 dxdxi(3,1) = dxdxi(3,1) +
173 & b_net(ni-i,nj-j,nk-k,3) *
175 dxdxi(3,2) = dxdxi(3,2) +
176 & b_net(ni-i,nj-j,nk-k,3) *
178 dxdxi(3,3) = dxdxi(3,3) +
179 & b_net(ni-i,nj-j,nk-k,3) *
191 dxidx(1,1) = dxdxi(2,2) * dxdxi(3,3)
192 & - dxdxi(3,2) * dxdxi(2,3)
193 dxidx(1,2) = dxdxi(3,2) * dxdxi(1,3)
194 & - dxdxi(1,2) * dxdxi(3,3)
195 dxidx(1,3) = dxdxi(1,2) * dxdxi(2,3)
196 & - dxdxi(1,3) * dxdxi(2,2)
197 tmp = 1d+0 / ( dxidx(1,1) * dxdxi(1,1)
198 & + dxidx(1,2) * dxdxi(2,1)
199 & + dxidx(1,3) * dxdxi(3,1) )
200 dxidx(1,1) = dxidx(1,1) * tmp
201 dxidx(1,2) = dxidx(1,2) * tmp
202 dxidx(1,3) = dxidx(1,3) * tmp
203 dxidx(2,1) = (dxdxi(2,3) * dxdxi(3,1)
204 & - dxdxi(2,1) * dxdxi(3,3)) * tmp
205 dxidx(2,2) = (dxdxi(1,1) * dxdxi(3,3)
206 & - dxdxi(3,1) * dxdxi(1,3)) * tmp
207 dxidx(2,3) = (dxdxi(2,1) * dxdxi(1,3)
208 & - dxdxi(1,1) * dxdxi(2,3)) * tmp
209 dxidx(3,1) = (dxdxi(2,1) * dxdxi(3,2)
210 & - dxdxi(2,2) * dxdxi(3,1)) * tmp
211 dxidx(3,2) = (dxdxi(3,1) * dxdxi(1,2)
212 & - dxdxi(1,1) * dxdxi(3,2)) * tmp
213 dxidx(3,3) = (dxdxi(1,1) * dxdxi(2,2)
214 & - dxdxi(1,2) * dxdxi(2,1)) * tmp
223 shgradg(i,1) = shgradl(i,1) * dxidx(1,1) +
224 & shgradl(i,2) * dxidx(2,1) +
225 & shgradl(i,3) * dxidx(3,1)
226 shgradg(i,2) = shgradl(i,1) * dxidx(1,2) +
227 & shgradl(i,2) * dxidx(2,2) +
228 & shgradl(i,3) * dxidx(3,2)
229 shgradg(i,3) = shgradl(i,1) * dxidx(1,3) +
230 & shgradl(i,2) * dxidx(2,3) +
231 & shgradl(i,3) * dxidx(3,3)
251 tempshhessl(icount,1) =
252 & n(3,p+1-i)*m(1,q+1-j)*o(1,r+1-k)*
253 & b_net(ni-i,nj-j,nk-k,nsd+1)
254 derv_sum_uu = derv_sum_uu + tempshhessl(icount,1)
255 tempshhessl(icount,2) =
256 & n(2,p+1-i)*m(2,q+1-j)*o(1,r+1-k)*
257 & b_net(ni-i,nj-j,nk-k,nsd+1)
258 derv_sum_uv = derv_sum_uv + tempshhessl(icount,2)
259 tempshhessl(icount,3) =
260 & n(2,p+1-i)*m(1,q+1-j)*o(2,r+1-k)*
261 & b_net(ni-i,nj-j,nk-k,nsd+1)
262 derv_sum_uw = derv_sum_uw + tempshhessl(icount,3)
263 tempshhessl(icount,4) =
264 & n(1,p+1-i)*m(3,q+1-j)*o(1,r+1-k)*
265 & b_net(ni-i,nj-j,nk-k,nsd+1)
266 derv_sum_vv = derv_sum_vv + tempshhessl(icount,4)
267 tempshhessl(icount,5) =
268 & n(1,p+1-i)*m(2,q+1-j)*o(2,r+1-k)*
269 & b_net(ni-i,nj-j,nk-k,nsd+1)
270 derv_sum_vw = derv_sum_vw + tempshhessl(icount,5)
271 tempshhessl(icount,6) =
272 & n(1,p+1-i)*m(1,q+1-j)*o(3,r+1-k)*
273 & b_net(ni-i,nj-j,nk-k,nsd+1)
274 derv_sum_ww = derv_sum_ww + tempshhessl(icount,6)
282 shhessl(i,1) = tempshhessl(i,1)/denom_sum -
283 & tempshgradl(i,1)*derv_sum_u/(denom_sum**2) -
284 & ((tempshgradl(i,1)*derv_sum_u+tempshl(i)*derv_sum_uu)/
285 & (denom_sum**2) - 2d+0*tempshl(i)*derv_sum_u*derv_sum_u/
287 shhessl(i,2) = tempshhessl(i,2)/denom_sum -
288 & tempshgradl(i,1)*derv_sum_v/(denom_sum**2) -
289 & ((tempshgradl(i,2)*derv_sum_u+tempshl(i)*derv_sum_uv)/
290 & (denom_sum**2) - 2d+0*tempshl(i)*derv_sum_u*derv_sum_v/
292 shhessl(i,3) = tempshhessl(i,3)/denom_sum -
293 & tempshgradl(i,1)*derv_sum_w/(denom_sum**2) -
294 & ((tempshgradl(i,3)*derv_sum_u+tempshl(i)*derv_sum_uw)/
295 & (denom_sum**2) - 2d+0*tempshl(i)*derv_sum_u*derv_sum_w/
297 shhessl(i,4) = tempshhessl(i,4)/denom_sum -
298 & tempshgradl(i,2)*derv_sum_v/(denom_sum**2) -
299 & ((tempshgradl(i,2)*derv_sum_v+tempshl(i)*derv_sum_vv)/
300 & (denom_sum**2) - 2d+0*tempshl(i)*derv_sum_v*derv_sum_v/
302 shhessl(i,5) = tempshhessl(i,5)/denom_sum -
303 & tempshgradl(i,2)*derv_sum_w/(denom_sum**2) -
304 & ((tempshgradl(i,3)*derv_sum_v+tempshl(i)*derv_sum_vw)/
305 & (denom_sum**2) - 2d+0*tempshl(i)*derv_sum_v*derv_sum_w/
307 shhessl(i,6) = tempshhessl(i,6)/denom_sum -
308 & tempshgradl(i,3)*derv_sum_w/(denom_sum**2) -
309 & ((tempshgradl(i,3)*derv_sum_w+tempshl(i)*derv_sum_ww)/
310 & (denom_sum**2) - 2d+0*tempshl(i)*derv_sum_w*derv_sum_w/
326 dxdxixj(1,:) = dxdxixj(1,:)+
327 & b_net(ni-i,nj-j,nk-k,1)*
330 dxdxixj(2,:) = dxdxixj(2,:)+
331 & b_net(ni-i,nj-j,nk-k,2)*
334 dxdxixj(3,:) = dxdxixj(3,:)+
335 & b_net(ni-i,nj-j,nk-k,3)*
346 shhessl(:,1) = shhessl(:,1) - shgradg(:,1)*dxdxixj(1,1) -
347 & shgradg(:,2)*dxdxixj(2,1) - shgradg(:,3)*dxdxixj(3,1)
349 shhessl(:,2) = shhessl(:,2) - shgradg(:,1)*dxdxixj(1,2) -
350 & shgradg(:,2)*dxdxixj(2,2) - shgradg(:,3)*dxdxixj(3,2)
352 shhessl(:,3) = shhessl(:,3) - shgradg(:,1)*dxdxixj(1,3) -
353 & shgradg(:,2)*dxdxixj(2,3) - shgradg(:,3)*dxdxixj(3,3)
355 shhessl(:,4) = shhessl(:,4) - shgradg(:,1)*dxdxixj(1,4) -
356 & shgradg(:,2)*dxdxixj(2,4) - shgradg(:,3)*dxdxixj(3,4)
358 shhessl(:,5) = shhessl(:,5) - shgradg(:,1)*dxdxixj(1,5) -
359 & shgradg(:,2)*dxdxixj(2,5) - shgradg(:,3)*dxdxixj(3,5)
361 shhessl(:,6) = shhessl(:,6) - shgradg(:,1)*dxdxixj(1,6) -
362 & shgradg(:,2)*dxdxixj(2,6) - shgradg(:,3)*dxdxixj(3,6)
367 loclhs(1,1) = dxdxi(1,1)*dxdxi(1,1)
368 loclhs(1,2) = 2d+0*dxdxi(1,1)*dxdxi(2,1)
369 loclhs(1,3) = 2d+0*dxdxi(1,1)*dxdxi(3,1)
370 loclhs(1,4) = dxdxi(2,1)*dxdxi(2,1)
371 loclhs(1,5) = 2d+0*dxdxi(2,1)*dxdxi(3,1)
372 loclhs(1,6) = dxdxi(3,1)*dxdxi(3,1)
374 loclhs(2,1) = dxdxi(1,1)*dxdxi(1,2)
375 loclhs(2,2) = dxdxi(1,1)*dxdxi(2,2) + dxdxi(1,2)*dxdxi(2,1)
376 loclhs(2,3) = dxdxi(1,1)*dxdxi(3,2) + dxdxi(1,2)*dxdxi(3,1)
377 loclhs(2,4) = dxdxi(2,1)*dxdxi(2,2)
378 loclhs(2,5) = dxdxi(2,1)*dxdxi(3,2) + dxdxi(2,2)*dxdxi(3,1)
379 loclhs(2,6) = dxdxi(3,1)*dxdxi(3,2)
381 loclhs(3,1) = dxdxi(1,1)*dxdxi(1,3)
382 loclhs(3,2) = dxdxi(1,1)*dxdxi(2,3) + dxdxi(1,3)*dxdxi(2,1)
383 loclhs(3,3) = dxdxi(1,1)*dxdxi(3,3) + dxdxi(1,3)*dxdxi(3,1)
384 loclhs(3,4) = dxdxi(2,1)*dxdxi(2,3)
385 loclhs(3,5) = dxdxi(2,1)*dxdxi(3,3) + dxdxi(2,3)*dxdxi(3,1)
386 loclhs(3,6) = dxdxi(3,1)*dxdxi(3,3)
388 loclhs(4,1) = dxdxi(1,2)*dxdxi(1,2)
389 loclhs(4,2) = 2d+0*dxdxi(1,2)*dxdxi(2,2)
390 loclhs(4,3) = 2d+0*dxdxi(1,2)*dxdxi(3,2)
391 loclhs(4,4) = dxdxi(2,2)*dxdxi(2,2)
392 loclhs(4,5) = 2d+0*dxdxi(2,2)*dxdxi(3,2)
393 loclhs(4,6) = dxdxi(3,2)*dxdxi(3,2)
395 loclhs(5,1) = dxdxi(1,2)*dxdxi(1,3)
396 loclhs(5,2) = dxdxi(1,2)*dxdxi(2,3) + dxdxi(1,3)*dxdxi(2,2)
397 loclhs(5,3) = dxdxi(1,2)*dxdxi(3,3) + dxdxi(1,3)*dxdxi(3,2)
398 loclhs(5,4) = dxdxi(2,2)*dxdxi(2,3)
399 loclhs(5,5) = dxdxi(2,2)*dxdxi(3,3) + dxdxi(2,3)*dxdxi(3,2)
400 loclhs(5,6) = dxdxi(3,2)*dxdxi(3,3)
402 loclhs(6,1) = dxdxi(1,3)*dxdxi(1,3)
403 loclhs(6,2) = 2d+0*dxdxi(1,3)*dxdxi(2,3)
404 loclhs(6,3) = 2d+0*dxdxi(1,3)*dxdxi(3,3)
405 loclhs(6,4) = dxdxi(2,3)*dxdxi(2,3)
406 loclhs(6,5) = 2d+0*dxdxi(2,3)*dxdxi(3,3)
407 loclhs(6,6) = dxdxi(3,3)*dxdxi(3,3)
419 tmp = loclhs(i,k)/loclhs(k,k)
421 loclhs(i,j) = loclhs(i,j) - tmp*loclhs(k,j)
423 shhessl(:,i) = shhessl(:,i) - tmp*shhessl(:,k)
429 shhessl(:,i) = shhessl(:,i) - loclhs(i,j)*shhessl(:,j)
431 shhessl(:,i) = shhessl(:,i)/loclhs(i,i)
439 shhessg(:,1,1) = shhessl(:,1)
440 shhessg(:,1,2) = shhessl(:,2)
441 shhessg(:,1,3) = shhessl(:,3)
443 shhessg(:,2,1) = shhessl(:,2)
444 shhessg(:,2,2) = shhessl(:,4)
445 shhessg(:,2,3) = shhessl(:,5)
447 shhessg(:,3,1) = shhessl(:,3)
448 shhessg(:,3,2) = shhessl(:,5)
449 shhessg(:,3,3) = shhessl(:,6)
453 dxidx(1,:) = dxidx(1,:)*2d+0/du
454 dxidx(2,:) = dxidx(2,:)*2d+0/dv
455 dxidx(3,:) = dxidx(3,:)*2d+0/dw
474 integer i, pl, ml, j, r, k, j1, j2, s1, s2, rk, pk,nders
476 real*8 u, u_knotl(pl+ml+1), ders(nders+1,pl+1), ndu(pl+1,pl+1),d
478 real*8 left(pl+1), right(pl+1), saved, temp, a(2,pl+1)
484 left(j+1) = u - u_knotl(i+1-j)
485 right(j+1) = u_knotl(i+j) - u
488 ndu(j+1,r+1) = right(r+2) + left(j-r+1)
489 temp = ndu(r+1,j)/ndu(j+1,r+1)
490 ndu(r+1,j+1) = saved + right(r+2)*temp
491 saved = left(j-r+1)*temp
498 ders(1,j+1) = ndu(j+1,pl+1)
511 a(s2+1,1) = a(s1+1,1)/ndu(pk+2,rk+1)
512 d = a(s2+1,1)*ndu(rk+1,pk+1)
519 if ((r-1) <= pk)
then
525 a(s2+1,j+1) = (a(s1+1,j+1) - a(s1+1,j))/ndu(pk+2,rk+j+1)
526 d = d + a(s2+1,j+1)*ndu(rk+j+1,pk+1)
529 a(s2+1,k+1) = -a(s1+1,k)/ndu(pk+2,r+1)
530 d = d + a(s2+1,k+1)*ndu(r+1,pk+1)
543 ders(k+1,j+1) = ders(k+1,j+1)*r