empty_mesh.f90

### TABLE OF CONTENTS

- 1. GEO/empty_mesh

## GEO/empty_mesh [ Modules ]

[ Top ] [ Modules ]

NOM

     empty_mesh(msh,nbd,numd)

DESCRIPTION

     Vide un maillage et desalloue les pointeurs
     alloue les listes d echange connaissant le nombre de domaines nbd
     recommande avant l utilisation et le numero du domaine numd

     Empties a mesh and deallocates pointers, allocates exchange lists knowing the number of nbd domains.
     Recommended before use and domain number numd

        ENTREES / INPUT
        msh : maillage / mesh
        nbd : nombre de domaines / domain number
        numd : numero du domaine a traiter / number of the domain to be traited

        SORTIES / OUTPUT
        msh

SOURCE

    ! Ce logiciel est regi par la licence [CeCILL-B]
    ! This software is governed by the [CeCILL-B] license
    !=========================== DEBUT DES DECLARATIONS ====================
    !.1-----  Implicit, Use
      use geo_typ
      IMPLICIT NONE
    !.2-----  Declaration
      type(mesh), intent(inout) :: msh  !! Maillage / Mesh
      integer,intent(in)        :: nbd  !! Nombre de domaines / Domain number
      integer,intent(in)        :: numd !! Numero du domaine a traiter / Number of the domain to be traited

      integer                   :: i
    !=========================== DEBUT DU CODE EXECUTABLE ==================
      IF (associated(msh%list_vertex)) THEN
          deallocate(msh%list_vertex)
          nullify(msh%list_vertex)
      END IF
      IF (associated(msh%list_cell)) THEN
          deallocate(msh%list_cell)
          nullify(msh%list_cell)
      END IF
      IF (associated(msh%list_face)) THEN
          deallocate(msh%list_face)
          nullify(msh%list_face)
      END IF

      IF (associated(msh%list_send)) THEN
          DO i=1,msh%nb_dom
              IF (associated(msh%list_send(i)%L)) THEN
                  deallocate(msh%list_send(i)%L)
                  nullify(msh%list_send(i)%L)
              END IF
          END DO
         deallocate(msh%list_send)
         nullify(msh%list_send)
      END IF

      IF (associated(msh%list_recv)) then
          DO i=1,msh%nb_dom
              IF (associated(msh%list_recv(i)%L)) THEN
                  deallocate(msh%list_recv(i)%L)
                  nullify(msh%list_recv(i)%L)
              END IF
          END DO
         deallocate(msh%list_recv)
         nullify(msh%list_recv)
      END IF

    ! Fin des liberations

      msh%numdom=numd
      msh%nb_dom=nbd

      IF (nbd.ne.0) THEN    ! reallocation si le nbre de dom different de 0
          msh%nb_cell=0
          msh%nb_vertex=0
          msh%nb_face=0
          allocate(msh%list_send(nbd))
          DO i=1,msh%nb_dom
              nullify(msh%list_send(i)%L)
          END DO
          allocate(msh%list_recv(nbd))
          DO i=1,msh%nb_dom
              nullify(msh%list_recv(i)%L)
          END DO
      END IF

    !===========================   FIN DE LA ROUTINE    ====================
    END SUBROUTINE empty_mesh