338
339
340
343
344
345
346#include "implicit_f.inc"
347
348
349
350#include "param_c.inc"
351#include "com04_c.inc"
352
353
354
355 INTEGER IOUT,IXR(NIXR,*),IEL,JTYP,IXR_KJ(5,*)
357 INTEGER ID
358 INTEGER, INTENT(INOUT) :: IDSK1,IDSK2
359 my_real,
INTENT(INOUT) :: vect1(lskew),vect2(lskew)
360 my_real,
INTENT(INOUT) :: theta0(3)
361 my_real,
INTENT(INOUT) :: stop_angl_min(3),stop_angl_max(3)
362 CHARACTER(LEN=NCHARTITLE) :: TITR
363
364
365
366 INTEGER I,J,K,NNOD,N1,N2,N3,N4,IERR1,IELUSR,NN(6),HH
367 INTEGER NUMEL_KJ,ID_KJ,NNOD2,NNOD_REQ(9),NB_ROT
368 my_real pp1,pp2,pp3,pp4,len,scal,exmax
369 my_real vect1_upt(lskew),vect2_upt(lskew),q(lskew),nr,t(3),
370 . cosk,sink,si2,e,ksi,umi,err,scal_sign
371 DATA umi/-1.0/
372
373
374 ierr1 = 0
375 nnod = 0
376 nn = 0
377 n1 = 0
378 n2 = 0
379 n3 = 0
380 n4 = 0
381 numel_kj = ixr_kj(1,numelr+1)
382 ielusr = ixr(nixr,iel)
383
384 nnod_req(1) = 2
385 nnod_req(2) = 3
386 nnod_req(3) = 3
387 nnod_req(4) = 3
388 nnod_req(5) = 4
389 nnod_req(6) = 3
390 nnod_req(7) = 3
391 nnod_req(8) = 2
392 nnod_req(9) = 4
393
394 DO j=1,3
395 IF (ixr(1+j,iel)/=0) THEN
396 nnod = nnod + 1
397 nn(nnod) = ixr(1+j,iel)
398 ENDIF
399 END DO
400
401 DO j=1,numel_kj
402 IF (ixr_kj(4,j)==ielusr) id_kj = j
403 END DO
404
405 IF (id_kj>0) THEN
406 DO j=1,3
407 IF (ixr_kj(j,id_kj)/=0) THEN
408 nnod = nnod + 1
409 nn(nnod) = ixr_kj(j,id_kj)
410 ENDIF
411 END DO
412 ENDIF
413
414 nnod2 = nnod
415
416 len = sqrt((x(1,nn(1))-x(1,nn(2)))**2+(x(2,nn(1))-x(2,nn(2)))**2
417 . +(x(3,nn(1))-x(3,nn(2)))**2)
418 IF ((nnod==2).AND.(len>em10)) nnod2=3
419
420 IF ((nnod2<nnod_req(jtyp)).AND.(idsk1 == 0)) THEN
421
422
423
425 . msgtype=msgerror,
426 . anmode=aninfo_blind_2,
428 . c1=titr,
429 . i2=ielusr,
430 . i3=jtyp,
431 . i4=nnod_req(jtyp)-nnod2)
432 ELSEIF ((nnod==2).AND.((jtyp==1).OR.(jtyp==8)).AND.(idsk1==0)) THEN
433
434
435
436 ex(1)= one
437 ex(2)= zero
438 ex(3)= zero
439 ex(4)= zero
440 ex(5)= one
441 ex(6)= zero
442 ex(7)= zero
443 ex(8)= zero
444 ex(9)= one
445 pp1 = one
446 pp2 = one
447 pp3 = one
448 ELSEIF ((nnod==2).AND.(len>em10)) THEN
449
450
451
452 n1 = nn(1)
453 n2 = nn(2)
454
455 ex(1)=x(1,n2)-x(1,n1)
456 ex(2)=x(2,n2)-x(2,n1)
457 ex(3)=x(3,n2)-x(3,n1)
458 pp1=sqrt(ex(1)*ex(1)+ex(2)*ex(2)+ex(3)*ex(3))
459 exmax =zero
460 DO j=1,3
461 IF (abs(ex(j))>= exmax) THEN
462 exmax = abs(ex(j))
463 hh = j
464 ENDIF
465 END DO
466
467 IF (hh<3) THEN
468 ex(4)= -ex(2)
469 ex(5)= ex(1)
470 ex(6)= zero
471 ELSE
472 ex(4)= zero
473 ex(5)= ex(3)
474 ex(6)= -ex(2)
475 ENDIF
476 pp2=sqrt(ex(4)*ex(4)+ex(5)*ex(5)+ex(6)*ex(6))
477
478 ex(7)=ex(2)*ex(6)-ex(3)*ex(5)
479 ex(8)=ex(3)*ex(4)-ex(1)*ex(6)
480 ex(9)=ex(1)*ex(5)-ex(2)*ex(4)
481 pp3=sqrt(ex(7)*ex(7)+ex(8)*ex(8)+ex(9)*ex(9))
482 ELSEIF (nnod==3) THEN
483
484
485
486 n1 = nn(1)
487 n2 = nn(3)
488
489 ex(1)=x(1,n2)-x(1,n1)
490 ex(2)=x(2,n2)-x(2,n1)
491 ex(3)=x(3,n2)-x(3,n1)
492 pp1=sqrt(ex(1)*ex(1)+ex(2)*ex(2)+ex(3)*ex(3))
493 exmax =zero
494 DO j=1,3
495 IF (abs(ex(j)) >= exmax) THEN
496 exmax = abs(ex(j))
497 hh = j
498 ENDIF
499 END DO
500
501 IF (hh<3) THEN
502 ex(4)= -ex(2)
503 ex(5)= ex(1)
504 ex(6)= zero
505 ELSE
506 ex(4)= zero
507 ex(5)= ex(3)
508 ex(6)= -ex(2)
509 ENDIF
510 pp2=sqrt(ex(4)*ex(4)+ex(5)*ex(5)+ex(6)*ex(6))
511
512 ex(7)=ex(2)*ex(6)-ex(3)*ex(5)
513 ex(8)=ex(3)*ex(4)-ex(1)*ex(6)
514 ex(9)=ex(1)*ex(5)-ex(2)*ex(4)
515 pp3=sqrt(ex(7)*ex(7)+ex(8)*ex(8)+ex(9)*ex(9))
516
517 IF (pp1<=em10) THEN
519 . msgtype=msgerror,
520 . anmode=aninfo_blind_2,
522 . c1=titr,
523 . i2=ielusr)
524 ENDIF
525 ELSEIF ((nnod>=4).AND.(jtyp/=5)) THEN
526
527
528
529 n1 = nn(1)
530 n2 = nn(3)
531 n3 = nn(4)
532
533 ex(1)=x(1,n2)-x(1,n1)
534 ex(2)=x(2,n2)-x(2,n1)
535 ex(3)=x(3,n2)-x(3,n1)
536 pp1=sqrt(ex(1)*ex(1)+ex(2)*ex(2)+ex(3)*ex(3))
537
538 ex(4)=x(1,n3)-x(1,n1)
539 ex(5)=x(2,n3)-x(2,n1)
540 ex(6)=x(3,n3)-x(3,n1)
541 pp2=sqrt(ex(4)*ex(4)+ex(5)*ex(5)+ex(6)*ex(6))
542
543 ex(7)=ex(2)*ex(6)-ex(3)*ex(5)
544 ex(8)=ex(3)*ex(4)-ex(1)*ex(6)
545 ex(9)=ex(1)*ex(5)-ex(2)*ex(4)
546 pp3=sqrt(ex(7)*ex(7)+ex(8)*ex(8)+ex(9)*ex(9))
547
548 scal =abs(ex(1)*ex(4)+ex(2)*ex(5)+ex(3)*ex(6))/(pp1*pp2)
549 IF (abs(scal)>=0.98) THEN
551 . msgtype=msgerror,
552 . anmode=aninfo_blind_2,
554 . c1=titr,
555 . i2=ielusr)
556 ELSE
557 ex(4)=ex(8)*ex(3)-ex(9)*ex(2)
558 ex(5)=ex(9)*ex(1)-ex(7)*ex(3)
559 ex(6)=ex(7)*ex(2)-ex(8)*ex(1)
560 pp2=sqrt(ex(4)*ex(4)+ex(5)*ex(5)+ex(6)*ex(6))
561 ENDIF
562
563 IF ((n4==n1).OR.(n4==n2).OR.(n4==n3)) THEN
565 . msgtype=msgerror,
566 . anmode=aninfo_blind_2,
567 . i1=ielusr)
568 ENDIF
569
570 pp4 = sqrt((x(1,n3)-x(1,n2))**2+(x(2,n3)-x(2,n2))**2
571 . +(x(3,n3)-x(3,n2))**2)
572 IF ((pp1<=em10).OR.(pp2<=em10).OR.(pp4<=em10)) THEN
574 . msgtype=msgerror,
575 . anmode=aninfo_blind_2,
577 . c1=titr,
578 . i2=ielusr)
579 ENDIF
580 ELSEIF ((nnod>=4).AND.(jtyp==5)) THEN
581
582
583
584 n1 = nn(1)
585 n2 = nn(3)
586 n3 = nn(4)
587
588 ex(4)=x(1,n2)-x(1,n1)
589 ex(5)=x(2,n2)-x(2,n1)
590 ex(6)=x(3,n2)-x(3,n1)
591 pp2=sqrt(ex(4)*ex(4)+ex(5)*ex(5)+ex(6)*ex(6))
592
593 ex(7)=x(1,n3)-x(1,n1)
594 ex(8)=x(2,n3)-x(2,n1)
595 ex(9)=x(3,n3)-x(3,n1)
596 pp3=sqrt(ex(7)*ex(7)+ex(8)*ex(8)+ex(9)*ex(9))
597
598 ex(1)=ex(5)*ex(9)-ex(6)*ex(8)
599 ex(2)=ex(6)*ex(7)-ex(4)*ex(9)
600 ex(3)=ex(4)*ex(8)-ex(5)*ex(7)
601 pp1=sqrt(ex(1)*ex(1)+ex(2)*ex(2)+ex(3)*ex(3))
602
603 scal =abs(ex(7)*ex(4)+ex(8)*ex(5)+ex(9)*ex(6))/(pp1+pp2)
604 IF (abs(scal)>=0.98) THEN
606 . msgtype=msgerror,
607 . anmode=aninfo_blind_2,
609 . c1=titr,
610 . i2=ielusr)
611 ELSEIF (scal>=1e-4) THEN
612
614 . msgtype=msgwarning,
615 . anmode=aninfo_blind_2,
617 . c1=titr,
618 . i2=ielusr)
619
620 ex(7)=ex(2)*ex(6)-ex(3)*ex(5)
621 ex(8)=ex(3)*ex(4)-ex(1)*ex(6)
622 ex(9)=ex(1)*ex(5)-ex(2)*ex(4)
623 pp3=sqrt(ex(7)*ex(7)+ex(8)*ex(8)+ex(9)*ex(9))
624 ENDIF
625
626 pp4 = sqrt((x(1,n3)-x(1,n2))**2+(x(2,n3)-x(2,n2))**2
627 . +(x(3,n3)-x(3,n2))**2)
628 IF ((pp1<=em10).OR.(pp2<=em10).OR.(pp4<=em10)) THEN
630 . msgtype=msgerror,
631 . anmode=aninfo_blind_2,
633 . c1=titr,
634 . i2=ielusr)
635 ENDIF
636 ELSEIF (idsk1 > 0) THEN
637
638
639
640 ex(1:9)= vect1(1:9)
641 pp1 = one
642 pp2 = one
643 pp3 = one
644 ELSE
646 . msgtype=msgerror,
647 . anmode=aninfo_blind_2,
649 . c1=titr,
650 . i2=ielusr)
651 ENDIF
652
653
654
655 ex(1)=ex(1)/pp1
656 ex(2)=ex(2)/pp1
657 ex(3)=ex(3)/pp1
658 ex(4)=ex(4)/pp2
659 ex(5)=ex(5)/pp2
660 ex(6)=ex(6)/pp2
661 ex(7)=ex(7)/pp3
662 ex(8)=ex(8)/pp3
663 ex(9)=ex(9)/pp3
664
665
666
667
668 IF ((idsk1 > 0).AND.(idsk2 > 2)) THEN
669
670 nb_rot = 3
671 IF ((jtyp==2).OR.(jtyp==3).OR.(jtyp==4)) THEN
672
673 nb_rot = 1
674
675 scal_sign = sign(one,ex(1)*vect1(1)+ex(2)*vect1(2)+ex(3)*vect1(3))
676 scal = abs(ex(1)*vect1(1)+ex(2)*vect1(2)+ex(3)*vect1(3))
677 IF (scal.LT.0.98) THEN
678
680 . msgtype=msgerror,
681 . anmode=aninfo_blind_1,
683 . c1=titr,
684 . i2=ielusr,
685 . c2='SKEW1')
686 ELSE
687 IF ((one-scal).GT.em05) THEN
688
690 . msgtype=msgwarning,
691 . anmode=aninfo_blind_2,
693 . c1=titr,
694 . i2=ielusr,
695 . c2='SKEW1')
696 ENDIF
697
698 vect1_upt(1:3) = scal_sign*ex(1:3)
699
700 vect1_upt(7)=vect1_upt(2)*vect1(6)-vect1_upt(3)*vect1(5)
701 vect1_upt(8)=vect1_upt(3)*vect1(4)-vect1_upt(1)*vect1(6)
702 vect1_upt(9)=vect1_upt(1)*vect1(5)-vect1_upt(2)*vect1(4)
703
704 vect1_upt(4)=vect1_upt(8)*vect1_upt(3)-vect1_upt(9)*vect1_upt(2)
705 vect1_upt(5)=vect1_upt(9)*vect1_upt(1)-vect1_upt(7)*vect1_upt(3)
706 vect1_upt(6)=vect1_upt(7)*vect1_upt(2)-vect1_upt(8)*vect1_upt(1)
707 vect1(1:9) = vect1_upt(1:9)
708 ENDIF
709 scal_sign = sign(one,ex(1)*vect2(1)+ex(2)*vect2(2)+ex(3)*vect2(3))
710 scal = abs(ex(1)*vect2(1)+ex(2)*vect2(2)+ex(3)*vect2(3))
711 IF (scal.LT.0.98) THEN
712
714 . msgtype=msgerror,
715 . anmode=aninfo_blind_1,
717 . c1=titr,
718 . i2=ielusr,
719 . c2='SKEW2')
720 ELSE
721 IF ((one-scal).GT.em05) THEN
722
724 . msgtype=msgwarning,
725 . anmode=aninfo_blind_2,
727 . c1=titr,
728 . i2=ielusr,
729 . c2='SKEW2')
730 ENDIF
731
732 vect2_upt(1:3) = scal_sign*ex(1:3)
733
734 vect2_upt(7)=vect2_upt(2)*vect2(6)-vect2_upt(3)*vect2(5)
735 vect2_upt(8)=vect2_upt(3)*vect2(4)-vect2_upt(1)*vect2(6)
736 vect2_upt(9)=vect2_upt(1)*vect2(5)-vect2_upt(2)*vect2(4)
737
738 vect2_upt(4)=vect2_upt(8)*vect2_upt(3)-vect2_upt(9)*vect2_upt(2)
739 vect2_upt(5)=vect2_upt(9)*vect2_upt(1)-vect2_upt(7)*vect2_upt(3)
740 vect2_upt(6)=vect2_upt(7)*vect2_upt(2)-vect2_upt(8)*vect2_upt(1)
741 vect2(1:9) = vect2_upt(1:9)
742 ENDIF
743 ENDIF
744
745
747
748 e = q(1)+q(5)+q(9)
749 cosk = half * (e - one)
751 cosk =
max(cosk,-one)
752 ksi = acos(cosk)
753 sink = sin(ksi)
754 IF(sink==zero) THEN
755 si2 = zero
756 ELSE
757 si2 = half / sink
758 ENDIF
759
760 t(1) = (q(6) - q(8)) * si2
761 t(2) = (q(7) - q(3)) * si2
762 t(3) = (q(2) - q(4)) * si2
763 nr = sqrt(t(1)*t(1)+t(2)*t(2)+t(3)*t(3))
764 IF (nr/=zero) nr = one/nr
765 t(1) = t(1)*nr
766 t(2) = t(2)*nr
767 t(3) = t(3)*nr
768
769
770 theta0(1) = t(1)*ksi
771 theta0(2) = t(2)*ksi
772 theta0(3) = t(3)*ksi
773
774
775 DO i=1,nb_rot
776 IF (theta0(i)<0) THEN
777 IF ((theta0(i)<stop_angl_min(i)).AND.(stop_angl_min(i)/=zero)) THEN
779 . msgtype=msgerror,
780 . anmode=aninfo_blind_1,
782 . c1=titr,
783 . r1=theta0(i),
784 . r2=stop_angl_min(i))
785 ENDIF
786 ELSE
787 IF ((theta0(i)>stop_angl_max(i)).AND.(stop_angl_max(i)/=zero)) THEN
789 . msgtype=msgerror,
790 . anmode=aninfo_blind_1,
792 . c1=titr,
793 . r1=theta0(i),
794 . r2=stop_angl_max(i))
795 ENDIF
796 ENDIF
797 ENDDO
798
799 ENDIF
800
802
803 RETURN
integer, parameter nchartitle
subroutine prod_atb(a, b, x)
integer function get_skew45(iout, jtyp, ex, ixr, ixr_kj, iel, x, id, titr, idsk1, idsk2, vect1, vect2, theta0, stop_angl_min, stop_angl_max)
subroutine ancmsg(msgid, msgtype, anmode, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, r1, r2, r3, r4, r5, r6, r7, r8, r9, c1, c2, c3, c4, c5, c6, c7, c8, c9, prmode)