MED fichier: Fichier source de Unittest_MEDinterp_2.f

MED fichier

Unittest_MEDinterp_2.f
Aller à la documentation de ce fichier.
1 C* This file is part of MED.
2 C*
3 C* COPYRIGHT (C) 1999 - 2021 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 interp module
20 C *
21 C *****************************************************************************
22 program medinterp2
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_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)
56 C
57 C
58 C 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
65 C
66 C
67 C 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
75 c
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
85 C
86 C
87 C 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
95 c
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
102 c
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
109 c
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
116 C
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
123 c
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
139 c
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
149 c
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
160 C
161 C
162 C 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
169 C
170 C
171 C
172 end
173
mficlo
subroutine mficlo(fid, cret)
Fermeture d'un fichier MED.
Definition: medfile.f:82
medinterp2
program medinterp2
Definition: Unittest_MEDinterp_2.f:22
mipbfr
subroutine mipbfr(fid, name, it, nc, pw, co, cret)
Cette routine permet la lecture d'une fonction de base/forme de l'interpolation interpname.
Definition: medinterp.f:58
mfiope
subroutine mfiope(fid, name, access, cret)
Ouverture d'un fichier MED.
Definition: medfile.f:42
mipiin
subroutine mipiin(fid, name, gtype, cnode, nbf, nvar, maxd, nmaxc, cret)
Cette fonction informe des caractéristiques de la fonction d'interpolation nommée interpname.
Definition: medinterp.f:102
mipcsz
subroutine mipcsz(fid, name, it, n, cret)
Cette routine retourne ne nombre de coefficients/monômes de la fonction de base/forme n° basisfunctit...
Definition: medinterp.f:142