MED fichier
Unittest_MEDinterp_2.f
Aller à la documentation de ce fichier.
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 * Tests for interp module
20C *
21C *****************************************************************************
22 program medinterp2
23C
24 implicit none
25 include 'med.hf'
26C
27C
28 integer cret
29 integer*8 fid
30
31 character*64 fname
32 parameter(fname = "Unittest_MEDinterp_1.med")
33 character *64 name1
34 parameter(name1="Interpolation family name")
35 integer gtype1,gtype
36 parameter(gtype1=med_tria3)
37 integer cnode1,cnode
38 parameter(cnode1=med_false)
39 integer nvar1,maxd1,nmaxc1
40 integer nvar,maxd,nmaxc
41 parameter(nvar1=2,maxd1=1,nmaxc1=3)
42 integer ncoef1,ncoef2,ncoef3,ncoef
43 parameter(ncoef1=3,ncoef2=1,ncoef3=1)
44 integer power1(6),power2(2),power3(2)
45 integer power(6)
46 data power1 / 0,0, 1,0, 0,1 /
47 data power2 / 1,0 /
48 data power3 / 0,1 /
49 real*8 coef1(3), coef2(1), coef3(1)
50 real*8 coef(3)
51 data coef1 / 1., -1., -1. /
52 data coef2 / 1. /
53 data coef3 / 1. /
54 integer nbf,nbf1,it,size,size1,size2,size3
55 parameter(nbf1=3,size1=3,size2=1,size3=1)
56C
57C
58C file creation
59 call mfiope(fid,fname,med_acc_rdonly,cret)
60 print *,'Open file',cret
61 if (cret .ne. 0 ) then
62 print *,'ERROR : open file'
63 call efexit(-1)
64 endif
65C
66C
67C interpolation information
68 call mipiin(fid,name1,gtype,cnode,nbf,nvar,
69 & maxd,nmaxc,cret)
70 print *,'interpolation information',cret
71 if (cret .ne. 0 ) then
72 print *,'ERROR : interpolation information'
73 call efexit(-1)
74 endif
75c
76 if ( (gtype .ne. gtype1) .or.
77 & (cnode .ne. cnode1) .or.
78 & (nbf .ne. nbf1) .or.
79 & (nvar .ne. nvar1) .or.
80 & (maxd .ne. maxd1) .or.
81 & (nmaxc .ne. nmaxc1) ) then
82 print *,'ERROR : interpolation information'
83 call efexit(-1)
84 endif
85C
86C
87C read functions
88 do it=1,nbf
89 call mipcsz(fid,name1,it,size,cret)
90 print *,'memory size',cret
91 if (cret .ne. 0 ) then
92 print *,'ERROR : memory size'
93 call efexit(-1)
94 endif
95c
96 if (it .eq. 1) then
97 if (size .ne. size1) then
98 print *,'ERROR : memory size size'
99 call efexit(-1)
100 endif
101 endif
102c
103 if (it .eq. 2) then
104 if (size .ne. size2) then
105 print *,'ERROR : allocation size'
106 call efexit(-1)
107 endif
108 endif
109c
110 if (it .eq. 3) then
111 if (size .ne. size3) then
112 print *,'ERROR : allocation size'
113 call efexit(-1)
114 endif
115 endif
116C
117 call mipbfr(fid,name1,it,ncoef,power,coef,cret)
118 print *,'read function',cret
119 if (cret .ne. 0 ) then
120 print *,'ERROR : read function'
121 call efexit(-1)
122 endif
123c
124 if (it .eq. 1) then
125 if ( (ncoef .ne. ncoef1) .or.
126 & (power(1) .ne. power1(1)) .or.
127 & (power(2) .ne. power1(2)) .or.
128 & (power(3) .ne. power1(3)) .or.
129 & (power(4) .ne. power1(4)) .or.
130 & (power(5) .ne. power1(5)) .or.
131 & (power(6) .ne. power1(6)) .or.
132 & (coef(1) .ne. coef1(1)) .or.
133 & (coef(2) .ne. coef1(2)) .or.
134 & (coef(3) .ne. coef1(3)) ) then
135 print *,'ERROR : read function'
136 call efexit(-1)
137 endif
138 endif
139c
140 if (it .eq. 2) then
141 if ( (ncoef .ne. ncoef2) .or.
142 & (power(1) .ne. power2(1)) .or.
143 & (power(2) .ne. power2(2)) .or.
144 & (coef(1) .ne. coef2(1)) ) then
145 print *,'ERROR : read function'
146 call efexit(-1)
147 endif
148 endif
149c
150 if (it .eq. 3) then
151 if ( (ncoef .ne. ncoef3) .or.
152 & (power(1) .ne. power3(1)) .or.
153 & (power(2) .ne. power3(2)) .or.
154 & (coef(1) .ne. coef3(1)) ) then
155 print *,'ERROR : read function'
156 call efexit(-1)
157 endif
158 endif
159 enddo
160C
161C
162C close file
163 call mficlo(fid,cret)
164 print *,'Close file',cret
165 if (cret .ne. 0 ) then
166 print *,'ERROR : close file'
167 call efexit(-1)
168 endif
169C
170C
171C
172 end
173
program medinterp2
subroutine mfiope(fid, name, access, cret)
Definition medfile.f:42
subroutine mficlo(fid, cret)
Definition medfile.f:82
subroutine mipiin(fid, name, gtype, cnode, nbf, nvar, maxd, nmaxc, cret)
Definition medinterp.f:102
subroutine mipcsz(fid, name, it, n, cret)
Definition medinterp.f:142
subroutine mipbfr(fid, name, it, nc, pw, co, cret)
Definition medinterp.f:58