MED fichier
usecases/f/UsesCase_MEDmesh_13.f
1C* This file is part of MED.
2C*
3C* COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN
4C* MED is free software: you can redistribute it and/or modify
5C* it under the terms of the GNU Lesser General Public License as published by
6C* the Free Software Foundation, either version 3 of the License, or
7C* (at your option) any later version.
8C*
9C* MED is distributed in the hope that it will be useful,
10C* but WITHOUT ANY WARRANTY; without even the implied warranty of
11C* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12C* GNU Lesser General Public License for more details.
13C*
14C* You should have received a copy of the GNU Lesser General Public License
15C* along with MED. If not, see <http://www.gnu.org/licenses/>.
16C*
17
18C******************************************************************************
19C*
20C* Use case 13 : a 2D unstructured mesh with 10 nodes and 2 polygons
21C*
22C* poly1 : 1,4,7,9,6,3
23C* poly2 : 2,5,8,10,7,4
24C
25C* 9 10
26C*
27C* 6 7 8
28C*
29C* 3 4 5
30C*
31C* 1 2
32C*
33C *****************************************************************************
35C
36 implicit none
37 include 'med.hf77'
38C
39C
40 integer cret
41 integer*8 fid
42
43C space dim, mesh dim
44 integer sdim, mdim
45C axis name, unit name
46 character*16 axname(2), unname(2)
47C mesh name, file name
48 character*64 mname, finame
49 character*64 dtunit
50C coordinates
51 real*8 coords(2*10)
52 integer nnodes
53 integer isize
54 integer index(3)
55 integer conity(12)
56C comment 1, mesh description
57 character*200 cmt1, mdesc
58C
59 parameter(sdim = 2, mdim = 2)
60 parameter(mname = "2D unstructured mesh")
61 parameter(dtunit = "")
62 parameter(finame = "UsesCase_MEDmesh_13.med")
63C Dix noeuds dont deux communs aux deux polygones */
64 parameter(nnodes = 10)
65 parameter(isize = 3)
66 parameter(cmt1 ="A 2D unstructured mesh : 10 nodes, 2 polygons")
67 parameter(mdesc = "A 2D mesh with 2 polygons")
68C
69 data axname /"x ","y "/
70 data unname /"cm ","cm "/
71 data coords / 0.5, 0.,
72 & 1.5, 0.,
73 & 0., 0.5,
74 & 1., 0.5,
75 & 2., 0.5,
76 & 0., 1.,
77 & 1., 1.,
78 & 2., 1.,
79 & 0.5, 2.,
80 & 1.5, 2. /
81 data index / 1, 7, 13 /
82 data conity / 1,4,7,9,6,3,
83 & 2,5,8,10,7,4 /
84C
85C
86C file creation
87 call mfiope(fid,finame,med_acc_creat,cret)
88 if (cret .ne. 0 ) then
89 print *,'ERROR : file creation'
90 call efexit(-1)
91 endif
92C
93C
94C write a comment in the file
95 call mficow(fid,cmt1,cret)
96 if (cret .ne. 0 ) then
97 print *,'ERROR : write file description'
98 call efexit(-1)
99 endif
100C
101C
102C mesh creation : a 2D unstructured mesh
103 call mmhcre(fid, mname, sdim, mdim, med_unstructured_mesh, mdesc,
104 & dtunit, med_sort_dtit, med_cartesian,
105 & axname, unname, cret)
106 if (cret .ne. 0 ) then
107 print *,'ERROR : mesh creation'
108 call efexit(-1)
109 endif
110C
111C
112C nodes coordinates in a cartesian axis in full interlace mode
113C (X1,Y1, X2,Y2, X3,Y3, ...) with no iteration and computation step
114 call mmhcow(fid,mname,med_no_dt,med_no_it, med_undef_dt,
115 & med_full_interlace,nnodes,coords,cret)
116 if (cret .ne. 0 ) then
117 print *,'ERROR : write nodes coordinates description'
118 call efexit(-1)
119 endif
120C
121C
122C cells connectiviy is defined in nodal mode
123C 2 polygons
124 call mmhpgw(fid, mname, med_no_dt, med_no_it, med_undef_dt,
125 & med_cell, med_nodal, isize, index, conity, cret)
126 if (cret .ne. 0 ) then
127 print *,'ERROR : polygon connectivity ...'
128 call efexit(-1)
129 endif
130C
131C
132C create family 0 : by default, all mesh entities family number is 0
133 call mfacre(fid,mname,med_no_name,0,0,med_no_group,cret)
134 if (cret .ne. 0 ) then
135 print *,'ERROR : create family 0'
136 call efexit(-1)
137 endif
138C
139C
140C close file
141 call mficlo(fid,cret)
142 if (cret .ne. 0 ) then
143 print *,'ERROR : close file'
144 call efexit(-1)
145 endif
146C
147C
148C
149 end
150C
program usescase_medmesh_13
subroutine mfacre(fid, name, fname, fnum, ngro, gname, cret)
Cette routine permet la création d'une famille portant sur les entités d'un maillage.
Definition medfamily.f:19
subroutine mfiope(fid, name, access, cret)
Ouverture d'un fichier MED.
Definition medfile.f:42
subroutine mficow(fid, cmt, cret)
Ecriture d'un descripteur dans un fichier MED.
Definition medfile.f:99
subroutine mficlo(fid, cret)
Fermeture d'un fichier MED.
Definition medfile.f:82
subroutine mmhcre(fid, name, sdim, mdim, mtype, desc, dtunit, stype, atype, aname, aunit, cret)
Cette routine permet de créer un maillage dans un fichier.
Definition medmesh.f:20
subroutine mmhpgw(fid, name, numdt, numit, dt, entype, cmode, isize, index, con, cret)
Definition medmesh.f:890
subroutine mmhcow(fid, name, numdt, numit, dt, swm, n, coo, cret)
Definition medmesh.f:299