UsesCase_MEDmesh_1.f

Aller à la documentation de ce fichier.
00001 C*  This file is part of MED.
00002 C*
00003 C*  COPYRIGHT (C) 1999 - 2012  EDF R&D, CEA/DEN
00004 C*  MED is free software: you can redistribute it and/or modify
00005 C*  it under the terms of the GNU Lesser General Public License as published by
00006 C*  the Free Software Foundation, either version 3 of the License, or
00007 C*  (at your option) any later version.
00008 C*
00009 C*  MED is distributed in the hope that it will be useful,
00010 C*  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 C*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 C*  GNU Lesser General Public License for more details.
00013 C*
00014 C*  You should have received a copy of the GNU Lesser General Public License
00015 C*  along with MED.  If not, see <http://www.gnu.org/licenses/>.
00016 C*
00017 
00018 C******************************************************************************
00019 C * How to create an unstructured mesh
00020 C * Use case 1 : a 2D unstructured mesh with 15 nodes, 
00021 C *              8 triangular cells, 4 triangular cells
00022 C *
00023 C *****************************************************************************
00024       program UsesCase_MEDmesh_1
00025 C     
00026       implicit none
00027       include 'med.hf'
00028 C
00029 C     
00030       integer cret
00031       integer fid
00032       integer sdim, mdim, stype, mtype, atype, nnode
00033       integer ntria, nquad
00034       integer fnum, ngro
00035       character*200 cmt1,mdesc
00036       character*64  fname
00037       character*64 mname
00038       character*16 nomcoo(2)
00039       character*16 unicoo(2)
00040       character*16 dtunit
00041       real*8 dt
00042       parameter (fname = "UsesCase_MEDmesh_1.med")
00043       parameter (mdesc = "A 2D unstructured mesh")
00044       parameter (cmt1 = "A 2D unstructured mesh : 15 nodes, 12 cells")
00045       parameter (mname = "2D unstructured mesh")
00046       parameter (sdim = 2, mdim = 2, nnode=15)
00047       parameter (stype=MED_SORT_DTIT, mtype=MED_UNSTRUCTURED_MESH)
00048       parameter (atype=MED_CARTESIAN)
00049       parameter (dt=0.0)
00050       parameter (ntria =  8, nquad = 4)
00051       parameter (fnum = 0, ngro = 0) 
00052       data  dtunit /""/
00053       data  nomcoo /"x               ","y               "/
00054       data  unicoo /"cm              ","cm              "/
00055       real*8 coo(30)
00056       data  coo /2.,1.,7.,1.,12.,1.,17.,1.,22.,1.,
00057      &           2.,6.,  7.,6.,  12.,6.,  17.,6.,  22.,6.,
00058      &           2.,11., 7.,11., 12.,11., 17.,11., 22.,11./
00059       integer tricon(24)
00060       data tricon /1,7,6,   2,7,1,  3,7,2,   8,7,3,
00061      &             13,7,8, 12,7,13, 11,7,12, 6,7,11/
00062       integer quacon(16)
00063       data quacon /3,4,9,8,    4,5,10,9,
00064      &             15,14,9,10, 13,8,9,14 /
00065 C
00066 C
00067 C     file creation
00068       call mfiope(fid,fname,MED_ACC_CREAT,cret)
00069       print *,cret
00070       print *,fid
00071       if (cret .ne. 0 ) then
00072          print *,'ERROR : file creation'
00073          call efexit(-1)
00074       endif
00075 C
00076 C
00077 C     write a comment in the file
00078       call mficow(fid,cmt1,cret)
00079       print *,cret
00080       if (cret .ne. 0 ) then
00081          print *,'ERROR : write file description'
00082          call efexit(-1)
00083       endif
00084 C
00085 C
00086 C     mesh creation
00087       call mmhcre(fid, mname, sdim, mdim, mtype,mdesc,
00088      &            dtunit, stype, atype, nomcoo, unicoo, cret)
00089       print *,cret
00090       if (cret .ne. 0 ) then
00091          print *,'ERROR : mesh creation'
00092          call efexit(-1)
00093       endif
00094 C
00095 C
00096 C     write nodes coordinates
00097       call mmhcow(fid,mname,MED_NO_DT,MED_NO_IT,dt, 
00098      &            MED_FULL_INTERLACE,nnode,coo,cret)
00099       print *,cret
00100       if (cret .ne. 0 ) then
00101          print *,'ERROR : write nodes coordinates description'
00102          call efexit(-1)
00103       endif
00104 C
00105 C
00106 C     cells connectiviy is defined in nodal mode with
00107 C     no iteration and computation step
00108       call mmhcyw(fid,mname,MED_NO_DT,MED_NO_IT,dt,MED_CELL,
00109      &            MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,
00110      &            ntria,tricon,cret)
00111       print *,cret
00112       if (cret .ne. 0 ) then
00113          print *,'ERROR : triangular cells connectivity'
00114          call efexit(-1)
00115       endif
00116 C
00117       call mmhcyw(fid,mname,MED_NO_DT,MED_NO_IT,dt,MED_CELL,
00118      &            MED_QUAD4,MED_NODAL,MED_FULL_INTERLACE,
00119      &            nquad,quacon,cret)
00120       print *,cret
00121       if (cret .ne. 0 ) then
00122          print *,'ERROR : quadrangular cells connectivity'
00123          call efexit(-1)
00124       endif
00125 C
00126 C
00127 C     create family 0 : by default, all mesh entities family number is 0
00128       call mfacre(fid,mname,MED_NO_NAME,fnum,ngro,MED_NO_GROUP,cret)
00129       print *,cret
00130       if (cret .ne. 0 ) then
00131          print *,'ERROR : family 0 creation'
00132          call efexit(-1)
00133       endif
00134 C
00135 C
00136 C     close file
00137       call mficlo(fid,cret)
00138       print *,cret
00139       if (cret .ne. 0 ) then
00140          print *,'ERROR :  close file'
00141          call efexit(-1)
00142       endif
00143 C
00144 C
00145 C
00146       end
00147 

Généré le Mon Apr 23 11:30:27 2012 pour MED fichier par  doxygen 1.6.1