C VCHBOR    SOURCE    CB215821  26/08/24    21:18:48     12622          
C
C   Calcul des min et max du champ sur un objet deforme
C
      SUBROUTINE VCHBOR(MDEFOR,NDEB,NFIN,VCHMIN,VCHMAX)
      IMPLICIT INTEGER(I-N)

-INC PPARAM
-INC CCOPTIO
-INC SMELEME
-INC SMCHPOI
-INC SMCHAML
-INC SMDEFOR
C
C
      segact mdefor
      IF(NDEB.LE.0) NDEB=1
      IF(NFIN.LE.0) NFIN=ampl(/1)
c       do 100 idef=1,ampl(/1)
      do 100 idef=NDEB,NFIN
      meleme=ieldef(idef)
      mchpoi=mdchp(idef)
      mcham=mdchel(idef)
      model=mdmode(idef)
C
      if (mcham.ne.0) then
*  on cree le meleme a tracer
*  on stocke les melval dans lisref (tres astucieux)
      mchelm=mcham
      segact mchelm
      nbsous=imache(/1)
      nbref=nbsous
      nbnn=0
      nbelem=0
      segini meleme
      itypel=0
      do 10 isous=1,nbsous
       lisous(isous)=imache(isous)
  10  continue
      do 20 isous=1,nbsous
       if (infche(isous,2).eq.1.and.infche(isous,6).ne.1) then
*  pas un chamelem aux noeuds
        call erreur(609)
        return
       endif
       mchaml=ichaml(isous)
       segact mchaml
       if (typche(/2).ne.1.or.typche(1).ne.'REAL*8') then
* pas un chamelem de scalaires
        call erreur(320)
        return
       endif
       lisref(isous)=ielval(1)
       segdes mchaml
  20  continue
      segdes mchelm
*
      do 30 isous=1,nbsous
       melval=lisref(isous)
       segact melval
       do 9511 inn=1,velche(/1)
       do 40 iel=1,velche(/2)
        vchmin=min(vchmin,real(velche(inn,iel)))
        vchmax=max(vchmax,real(velche(inn,iel)))
  40  continue
 9511  CONTINUE
  30  continue
      endif
**
      if (mchpoi.ne.0) then
C
      SEGACT MELEME
      SEGACT MCHPOI
      NSOUPO=IPCHP(/1)
      DO 9500 ISOUPO=1,NSOUPO
          MSOUPO=IPCHP(ISOUPO)
          SEGACT MSOUPO
          MPOVAL=IPOVAL
          SEGACT MPOVAL
          IPT2=IGEOC
          SEGACT IPT2
          NCC=NOCOMP(/2)
          IF (NCC.NE.1) CALL ERREUR(180)
          DO 9512 IC=1,NCC
            DO 9510 IEL=1,IPT2.NUM(/2)
              vchmin=min(vchmin,real(VPOCHA(IEL,IC)))
              vchmax=max(vchmax,real(VPOCHA(IEL,IC)))
9510      CONTINUE
 9512     CONTINUE
9500  CONTINUE
      endif
C
 100  continue
C
      RETURN
      END











 
 
