Debian Codegraph @

tests/unittests/f/Unittest_MEDsupportMesh_3.f

raw
1 C* This file is part of MED.
2 C*
3 C* COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN
4 C* MED is free software: you can redistribute it and/or modify
5 C* it under the terms of the GNU Lesser General Public License as published by
6 C* the Free Software Foundation, either version 3 of the License, or
7 C* (at your option) any later version.
8 C*
9 C* MED is distributed in the hope that it will be useful,
10 C* but WITHOUT ANY WARRANTY; without even the implied warranty of
11 C* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 C* GNU Lesser General Public License for more details.
13 C*
14 C* You should have received a copy of the GNU Lesser General Public License
15 C* along with MED. If not, see <http://www.gnu.org/licenses/>.
16 C*
17
18 C******************************************************************************
19 C * Tests for support mesh module
20 C *
21 C *****************************************************************************
22 program MEDsupportMesh3
23 C
24 implicit none
25 include 'med.hf'
26 C
27 C
28 integer cret
29 integer*8 fid
30
31 character*64 fname
32 parameter (fname = "Unittest_MEDsupportMesh_1.med")
33 character*64 smname1
34 integer sdim1,mdim1
35 parameter (sdim1=2, mdim1=2)
36 integer sdim2,mdim2
37 parameter (sdim2=3,mdim2=2)
38 parameter (smname1 = "supportMesh1")
39 character*64 smname2
40 parameter (smname2 = "supportMesh2")
41 character*200 description1
42 parameter (description1="support mesh1 description")
43 character*200 description2
44 parameter (description2="support mesh2 description")
45 character*16 nomcoo2D(2)
46 character*16 unicoo2D(2)
47 data nomcoo2D /"x","y"/, unicoo2D /"cm","cm"/
48 character*16 nomcoo3D(3)
49 character*16 unicoo3D(3)
50 data nomcoo3D /"x","y","z"/, unicoo3D /"cm","cm","cm"/
51 integer atype1, atype2
52 parameter (atype1=MED_CARTESIAN, atype2=MED_CARTESIAN)
53 integer nsmesh, i
54 character*64 smname
55 character*16 aunit(3), aname(3)
56 character*200 description
57 integer sdim, mdim, atype
58 C
59 C
60 C open file in read only access mode
61 call mfiope(fid,fname,MED_ACC_RDONLY,cret)
62 print *,'Open file in RD_ONLY access mode',cret
63 if (cret .ne. 0 ) then
64 print *,'ERROR : open file in READ_ONLY access mode'
65 call efexit(-1)
66 endif
67 C
68 C How many mesh in the file ?
69 C
70 call msmnsm(fid,nsmesh,cret)
71 print *,'Read number of support mesh : ',nsmesh
72 print *,cret
73 if (cret .ne. 0 ) then
74 print *,'ERROR : read number of support mesh'
75 call efexit(-1)
76 endif
77 if (nsmesh .ne. 2) then
78 print *,'ERROR : number of support mesh'
79 call efexit(-1)
80 endif
81 C
82 C
83 C Read support mesh information and number of axis
84 C by iterator
85 do i=1,nsmesh
86 call msmnax(fid,i,sdim,cret)
87 if (cret .ne. 0 ) then
88 print *,'ERROR : read number of axis '
89 call efexit(-1)
90 endif
91 print *,'Number of axis : ',sdim
92 c
93 if (i .eq. 1) then
94 if (sdim .ne. sdim1) then
95 print *,'ERROR : support mesh information'
96 call efexit(-1)
97 endif
98 endif
99 if (i .eq. 2) then
100 if (sdim .ne. sdim2) then
101 print *,'ERROR : support mesh information'
102 call efexit(-1)
103 endif
104 endif
105 C
106 call msmsmi(fid,i,smname,sdim,mdim,
107 & description,
108 & atype,aname,aunit,cret)
109 print *,'Support mesh information',cret
110 if (cret .ne. 0 ) then
111 print *,'ERROR : read support mesh information'
112 call efexit(-1)
113 endif
114 c
115 if (i .eq. 1) then
116 if ((sdim .ne. sdim1) .or.
117 & (mdim .ne. mdim1) .or.
118 & (description .ne. description1) .or.
119 & (atype .ne. atype1) .or.
120 & (aunit(1) .ne. unicoo2D(1)) .or.
121 & (aunit(2) .ne. unicoo2D(2)) .or.
122 & (aname(1) .ne. nomcoo2D(1)) .or.
123 & (aname(2) .ne. nomcoo2D(2))
124 & ) then
125 print *,'ERROR : support mesh information by name'
126 call efexit(-1)
127 endif
128 endif
129 c
130 if (i .eq. 2) then
131 if ((sdim .ne. sdim2) .or.
132 & (mdim .ne. mdim2) .or.
133 & (description .ne. description2) .or.
134 & (atype .ne. atype2) .or.
135 & (aunit(1) .ne. unicoo3D(1)) .or.
136 & (aunit(2) .ne. unicoo3D(2)) .or.
137 & (aunit(3) .ne. unicoo3D(3)) .or.
138 & (aname(1) .ne. nomcoo3D(1)) .or.
139 & (aname(2) .ne. nomcoo3D(2)) .or.
140 & (aname(3) .ne. nomcoo3D(3))
141 & ) then
142 print *,'ERROR : support mesh information by name'
143 call efexit(-1)
144 endif
145 endif
146 c
147 enddo
148 C
149 C
150 C close file
151 call mficlo(fid,cret)
152 print *,'Close file',cret
153 if (cret .ne. 0 ) then
154 print *,'ERROR : close file'
155 call efexit(-1)
156 endif
157 C
158 C
159 C
160 end
161