kres14
C KRES14 SOURCE GOUNAND 25/04/30 21:15:12 12258
$ IPERM,JPERM)
IMPLICIT REAL*8 (A-H,O-Z)
IMPLICIT INTEGER (I-N)
C***********************************************************************
C NOM : KRES14
C DESCRIPTION : - Placer correctement les multiplicateurs de
C Lagrange
C
C
C LANGAGE : ESOPE
C AUTEUR : Stéphane GOUNAND (CEA/DEN/DM2S/SFME/LTMF)
C mél : gounand@semt2.smts.cea.fr
C***********************************************************************
C VERSION : v1, 10/04/2025, version initiale
C HISTORIQUE : v1, 10/04/2025, création
C HISTORIQUE :
C HISTORIQUE :
C***********************************************************************
-INC PPARAM
-INC CCOPTIO
-INC CCREEL
-INC SMRIGID
-INC SMVECTD
POINTEUR ISMBR.MVECTD
-INC SMMATRI
SEGMENT PMORS
INTEGER IA (NTT+1)
INTEGER JA (NJA)
ENDSEGMENT
POINTEUR KMORS.PMORS
C Segment de stokage
SEGMENT IZA
REAL*8 A(NBVA)
ENDSEGMENT
POINTEUR KIZA.IZA
-INC SMLENTI
POINTEUR KTYP.MLENTI
POINTEUR KRINC.MLENTI
POINTEUR IWORK.MLENTI
POINTEUR LAGRAN.MLENTI
POINTEUR JORDRE.MLENTI,JORTMP.MLENTI
POINTEUR IPERM.MLENTI,JPETMP.MLENTI
POINTEUR JPERM.MLENTI
-INC SMLMOTS
POINTEUR IORINC.MLMOTS
POINTEUR IORINU.MLMOTS
POINTEUR MLAG1.MLMOTS,MLAG2.MLMOTS
-INC SMTABLE
POINTEUR KTIME.MTABLE
DIMENSION ITTIME(4)
CHARACTER*(LOCHPO) CHCOMP
CHARACTER*16 CHARI
CHARACTER*1 CCOMP
LOGICAL LTIME,LDBNUM,LVERIF,LNOLAG
C
C Executable statements
C
LDBNUM=.FALSE.
LVERIF=.FALSE.
* Pour un non multigrille, il faut quand même placer les
* multiplicateurs correctement avant et après les inconnues
* KTYP=-1 multiplicateurs avant
* KTYP=0 inconnues normales
* KTYP=+1 multiplicateurs apres
* IL faut distinguer les 'LX' qui ont deja ete renumerotes et les
* LXP, MXP
MMATRI=ICHOLE
SEGACT MMATRI
MINCPO=IINCPO
SEGACT MINCPO
NCOMP=INCPO(/1)
NNOE=INCPO(/2)
SEGACT ISMBR
INC=ISMBR.VECTBB(/1)
SEGDES ISMBR
JG=INC
SEGINI KTYP
MIMIK=IIMIK
* write(ioimp,*) 'coucou mimik'
SEGACT,MIMIK
* SEGPRT,MIMIK
NBLAG=0
NBNLA=0
if (mlag1.ne.0) segact mlag1
if (mlag2.ne.0) segact mlag2
*
DO ICOMP=1,NCOMP
CHCOMP=IMIK(ICOMP)
JTYP=0
IF (CHCOMP(1:8).EQ.'LX ') THEN
JTYP=-3
ELSE
if (mlag1.ne.0) then
if (imot.ne.0) then
JTYP=1
GOTO 33
endif
else
IF (CHCOMP(1:2).EQ.'LX') THEN
JTYP=1
GOTO 33
endif
endif
if (mlag2.ne.0) then
if (imot.ne.0) then
JTYP=-1
GOTO 33
endif
else
IF (CHCOMP(1:2).EQ.'MX') THEN
JTYP=-1
GOTO 33
endif
endif
ENDIF
33 CONTINUE
DO INOE=1,NNOE
IG=INCPO(ICOMP,INOE)
IF (IG.GT.0) THEN
KTYP.LECT(IG)=JTYP
IF (JTYP.NE.0) THEN
NBLAG=NBLAG+1
ELSE
NBNLA=NBNLA+1
ENDIF
ENDIF
ENDDO
ENDDO
*
if (ldbnum) write(ioimp,*) 'avant tri ktyp=-3'
if (ldbnum) segprt,ktyp
*
IF (NBLAG.EQ.0) THEN
IPERM=0
JPERM=0
RETURN
ENDIF
NBDDL=NBLAG+NBNLA
JG=NBLAG
SEGINI LAGRAN
SEGACT KMORS
IF (NTT.NE.NBDDL) THEN
write(ioimp,*) 'Pas egaux NTT,NBDDL=',NTT,NBDDL
GOTO 9999
ENDIF
ILAG=0
DO IDDL=1,NBDDL
ITYP=KTYP.LECT(IDDL)
IF (ITYP.EQ.-3) THEN
ISUPS=0
IINFS=0
IF (JDDL.NE.IDDL) THEN
JTYP=KTYP.LECT(JDDL)
IF (ABS(JTYP).LE.1) THEN
IF (JDDL.GT.IDDL) THEN
ISUPS=ISUPS+1
ELSE
IINFS=IINFS+1
ENDIF
ENDIF
ENDIF
ENDDO
IF (ISUPS.EQ.0.AND.IINFS.EQ.0) THEN
ITYP=0
ELSEIF (ISUPS.GT.0) THEN
ITYP=-2
ELSEIF (IINFS.GT.0) THEN
ITYP=2
ELSE
write(ioimp,*) '2 positifs IINFS,ISUPS=',IINFS,ISUPS
GOTO 9999
ENDIF
KTYP.LECT(IDDL)=ITYP
ENDIF
IF (ITYP.NE.0) THEN
ILAG=ILAG+1
LAGRAN.LECT(ILAG)=IDDL
ENDIF
ENDDO
if (ldbnum) write(ioimp,*) 'apres tri ktyp=-3'
if (ldbnum) SEGPRT,KTYP
IF (NBLAG.NE.ILAG) GOTO 9999
*
* Placement des multiplicateurs inspiré de NUMOP2
*
JG=NBDDL
SEGINI JPERM
DO I=1,NBDDL
JPERM.LECT(I)=I
ENDDO
* Il y a quatre types différents de -2 à 2 : il faut pouvoir placer
* les multiplicateurs de lagrange entre les autres noeuds
NTYP=5
JG=NBDDL
SEGINI JORDRE
DO I=1,NBDDL
JORDRE.LECT(I)=I*NTYP
ENDDO
JORMAX= (NBDDL+1)*NTYP
if (ldbnum) write(ioimp,*) 'Avant mise a la bonne place'
if (ldbnum) segprt,jordre
* mise a la bonne place des multiplicateurs de Lagrange
do 700 J=1,NBLAG
IDDL=LAGRAN.LECT(J)
ITYP=KTYP.LECT(IDDL)
if (ldbnum)write(ioimp,*) 'iddl,ityp=',iddl,ityp
* write (6,*) 'kres14 ',(kmors.JA(icol),icol=icold,icolf)
ipaur=-igrand
ipaus=igrand
do 800 ICOL=ICOLD,ICOLF
JTYP=KTYP.LECT(JDDL)
* write(ioimp,*) ' jddl,jtyp=',jddl,jtyp
IF (ABS(ITYP).NE.ABS(JTYP)) THEN
* deplacer les noeuds en relation en fin de zone
jordre.lect(jddl)=-abs(jordre.lect(jddl))
ipaur=max(ipaur,jordre.lect(jddl))
ipaus=min(ipaus,jordre.lect(jddl))
endif
800 continue
*
* On va laisser comme ça
* Ce cas peut arriver après élimination
* Cela devrait revenir à placer les multiplicateurs en fin ou début
* de matrice
if (ipaur.eq.-igrand.or.ipaus.eq.igrand) then
* Write(ioimp,*) 'mulag sans relations pas ok'
* goto 9999
ipaur=0
ipaus=-jormax
endif
if (ldbnum) write(ioimp,*) 'iddl,ipaur,ipaus=',iddl,ipaur
$ ,ipaus
*
* le premier mult avant le premier noeud
IF (ITYP.EQ.-2) THEN
JORDRE.LECT(IDDL)=ipaur+2
ELSEIF (ITYP.EQ.-1) THEN
JORDRE.LECT(IDDL)=ipaur+1
*
* le deuxieme mult apres le dernier noeud
ELSEIF (ITYP.EQ.1) THEN
JORDRE.LECT(IDDL)= ipaus-1
ELSEIF (ITYP.EQ.2) THEN
JORDRE.LECT(IDDL)= ipaus-2
ELSEIF (ITYP.NE.0) THEN
write(ioimp,*) 'ityp=',ityp,' non prevu'
goto 9999
ENDIF
*
700 continue
* WRITE(IOIMP,*) 'Avant chgt signe'
* segprt,jordre
DO I=1,NBDDL
JORDRE.LECT(I)=-JORDRE.LECT(I)
ENDDO
* Avant tri
if (ldbnum) WRITE(IOIMP,*) 'Avant TRIFUS'
if (ldbnum) SEGPRT,JPERM
if (ldbnum) SEGPRT,JORDRE
JG=NBDDL
SEGINI JORTMP
SEGINI JPETMP
* ok maintenant on trie
CALL TRIFUS(NBDDL,JORDRE.LECT,JPERM.LECT,JORTMP.LECT
$ ,JPETMP.LECT)
SEGSUP JPETMP
SEGSUP JORTMP
* Apres tri
if (ldbnum) WRITE(IOIMP,*) 'Apres TRIFUS'
if (ldbnum) SEGPRT,JPERM
if (ldbnum) SEGPRT,JORDRE
* permutation inverse
JG=NBDDL
SEGINI IPERM
DO I=1,NBDDL
IPERM.LECT(JPERM.LECT(I))=I
ENDDO
* Verification que dans la nouvelle numerotation les multiplicateurs
* sont correctement places...
IF (LVERIF) THEN
write(ioimp,*) 'VERIF KRES14'
do 1700 J=1,NBLAG
IDDL=LAGRAN.LECT(J)
ITYP=KTYP.LECT(IDDL)
iddln=iperm.lect(iddl)
ipaur=-igrand
ipaus=igrand
do 1800 ICOL=ICOLD,ICOLF
JTYP=KTYP.LECT(JDDL)
IF (ABS(ITYP).NE.ABS(JTYP)) THEN
JDDLN=IPERM.LECT(JDDL)
ipaur=max(ipaur,jddln)
ipaus=min(ipaus,jddln)
endif
1800 continue
if (ldbnum) write(ioimp,*) 'iddl,ipaur,ipaus=',iddl,ipaur
$ ,ipaus
if (ipaur.eq.-igrand.or.ipaus.eq.igrand) then
goto 1700
* Write(ioimp,*) 'mulag sans relations pas ok'
* goto 9999
endif
if (ityp.lt.0) THEN
if (ipaus.le.iddln) then
write(ioimp,*) 'Erreur numerotation'
write(ioimp,*) 'iddl,iddln,ipaus=',iddl,iddln,ipaus
goto 9999
endif
elseif (ityp.gt.0) THEN
if (ipaur.ge.iddln) then
write(ioimp,*) 'Erreur numerotation'
write(ioimp,*) 'iddl,iddln,ipaur=',iddl,iddln,ipaur
goto 9999
endif
else
write(ioimp,*) 'ityp=0 pas normal pour un lagrange'
goto 9999
endif
1700 continue
ENDIF
*
* Menage
*
SEGSUP JORDRE
SEGSUP LAGRAN
SEGSUP KTYP
C
C Normal termination
C
RETURN
C
C Error Handling
C
9999 CONTINUE
MOTERR(1:8)='KRES14 '
RETURN
C
C Format handling
C
2022 FORMAT(10(1X,1PG12.5))
C
C End of subroutine KRES14
C
END
					© Cast3M 2003 - Tous droits réservés.
					Mentions légales