save_obj.f90

### TABLE OF CONTENTS

- 1. UTI/save_obj

## UTI/save_obj [ Modules ]

[ Top ] [ Modules ]

NOM

     save_obj  (calc)

DESCRIPTION

     Sauvegarde au format OBJ des objets solides
     Save solid objects in OBJ format

        ENTREES / INPUT
     calc : objet calcul / calculation object

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 num_typ
      IMPLICIT NONE
    !.2-----  Declaration
      type(calcul),intent(in) :: calc !! Objet calcul / Calcul object
      character               :: fsol*14,cn*10
      integer                 :: i,ic,id,iu,isol
    !=========================== DEBUT DU CODE EXECUTABLE ==================
      cn='0123456789'
      do isol=1,calc%nb_sol
        ic=int(isol/100.)
        id=int((isol-ic*100.)/10.)
        iu=isol-id*10-ic*100

        fsol( 1: 6)='solide'
        fsol( 7: 7)='_'
        fsol( 8: 8)=cn(ic+1:ic+1)
        fsol( 9: 9)=cn(id+1:id+1)
        fsol(10:10)=cn(iu+1:iu+1)
        fsol(11:14)='.obj'
        open(11,file=fsol,status='unknown')

        write(11,1020)calc%list_sol(isol)%xg%v
        write(11,1021)calc%list_sol(isol)%theta%v
    1020  format('# Position of the center of gravity of the solid           :',3e13.5)
    1021  format('# Angle of rotation relative to the global reference frame :',3e13.5)

        do i=1,calc%list_sol(isol)%nb_vert
          write(11,1000)calc%list_sol(isol)%list_vertex(i)%x,&
                        calc%list_sol(isol)%list_vertex(i)%y,&
                        calc%list_sol(isol)%list_vertex(i)%z
        enddo
        do i=1,calc%list_sol(isol)%nb_face
          write(11,1010)calc%list_sol(isol)%list_facette(i)%vertex(1),&
                        calc%list_sol(isol)%list_facette(i)%vertex(2),&
                        calc%list_sol(isol)%list_facette(i)%vertex(3)
        enddo
        close(11)

      enddo
     1000   format('v ',3e13.5)
     1010   format('f ',3i9)

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