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