1 /*  This file is part of MED.
2  *
3  *  COPYRIGHT (C) 1999 - 2019  EDF R&D, CEA/DEN
4  *  MED is free software: you can redistribute it and/or modify
5  *  it under the terms of the GNU Lesser General Public License as published by
6  *  the Free Software Foundation, either version 3 of the License, or
7  *  (at your option) any later version.
8  *
9  *  MED is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU Lesser General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Lesser General Public License
15  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 
19 #include <med.h>
20 #include <med_config.h>
21 #include <med_outils.h>
22 #include <string.h>
23 
24 #include <2.3.6/med23v30.h>
25 #include <2.3.6/med23v30_proto.h>
26 #include "2.3.6/med23v30_misc.h"
27 
28 void
_MEDfieldComputingStepInfo236(int dummy,...)29 _MEDfieldComputingStepInfo236(int dummy,...)
30 
31 {
32 
33 
34   med_err   _ret=-1,_err=0;
35   med_size  _num;
36 
37   med_idt   _datagroup1=0;
38   char      _datagroupname1[2*MED_MAX_PARA+1]         ="";
39   char      _ent_geo       [2*MED_TAILLE_NOM_ENTITE+2]="";
40   char      _path          [(MED_FIELD_GRP_SIZE+MED_TAILLE_NOM+1)+
41 			    (2*MED_TAILLE_NOM_ENTITE+1)+1+(2*MED_MAX_PARA)+1]=MED_FIELD_GRP;
42   med_size _ncpst=0;
43   med_bool _checkmultiplemesh=MED_TRUE, _multiplemesh       =MED_FALSE;
44   med_bool _checkmeshname    =MED_TRUE, _samedefaultmeshname=MED_FALSE;
45 
46 
47   MED_VARGS_DECL(const, med_idt       , , fid       );
48   MED_VARGS_DECL(const, char * , const  , fieldname );
49   MED_VARGS_DECL(const, int           , , csit      );
50   MED_VARGS_DECL(, med_int *, const     , numdt     );
51   MED_VARGS_DECL(, med_int *, const     , numit     );
52   MED_VARGS_DECL(, med_float *, const   , dt        );
53   MED_VARGS_DECL(, med_err *           ,, fret      );
54 
55   va_list params;
56   va_start(params,dummy);
57 
58   MED_VARGS_DEF(const, med_idt       , , fid       );
59   MED_VARGS_DEF(const, char * , const  , fieldname );
60   MED_VARGS_DEF(const, int           , , csit      );
61   MED_VARGS_DEF(, med_int *, const     , numdt     );
62   MED_VARGS_DEF(, med_int *, const     , numit     );
63   MED_VARGS_DEF(, med_float *, const   , dt        );
64   MED_VARGS_DEF(, med_err *           ,, fret      );
65 
66   _num=csit-1;
67 
68   /*
69    * On inhibe le gestionnaire d'erreur HDF 5
70    */
71   _MEDmodeErreurVerrouiller();
72 
73   /*
74    * On construit le nom du datagroup
75    */
76   strcat(_path,fieldname);
77 
78 /*   if ( _MEDfieldComputingStepCheck236(fid,  fieldname, */
79 /* 				      &_ncpst, */
80 /* 				      _checkmultiplemesh, &_multiplemesh, */
81 /* 				      _checkmeshname,     &_samedefaultmeshname) < 0) { */
82 /*     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_FIELD,fieldname); */
83 /*     goto ERROR; */
84 /*   } */
85 
86 /*
87  * On suppose que le modèle 2.3.6 est respecté :
88  * Il y a les mêmes séquences de calcul pour tous les couples
89  * (typent,typegeo)
90  */
91   if ( _MEDobjectGetName(fid, _path ,0, _ent_geo) < 0 ) {
92     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);
93     SSCRUTE(_path); SSCRUTE(_ent_geo); goto ERROR;
94   }
95 
96   strcat(_path,"/");
97   strcat(_path,_ent_geo);
98 
99   if ( _MEDobjectGetName(fid, _path ,_num, _datagroupname1) < 0 ) {
100     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);
101     SSCRUTE(_path); SSCRUTE(_ent_geo); goto ERROR;
102   }
103 
104   strcat(_path,"/");
105   strcat(_path,_datagroupname1);
106 
107   if ((_datagroup1 = _MEDdatagroupOuvrir(fid,_path)) < 0) {
108     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
109     goto ERROR;
110   }
111 
112 
113   /*
114    * Lecture des attributs
115    */
116 
117   if (_MEDattrEntierLire(_datagroup1,MED_NOM_NDT,(med_int*) numdt) < 0) {
118     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NDT);
119     SSCRUTE(_path);ISCRUTE(*numdt);goto ERROR;
120   }
121 
122   if (_MEDattrFloatLire(_datagroup1,MED_NOM_PDT,(med_float*) dt) < 0) {
123     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_PDT);
124     SSCRUTE(_path);RSCRUTE(*dt);goto ERROR;
125   }
126 
127   if (_MEDattrEntierLire(_datagroup1,MED_NOM_NOR,(med_int*) numit) < 0) {
128     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NOR);
129     SSCRUTE(_path);ISCRUTE(*numit);goto ERROR;
130   }
131 
132 
133   _ret = 0;
134 
135  ERROR:
136 
137 
138   if (_datagroup1>0)            if (_MEDdatagroupFermer(_datagroup1) < 0) {
139     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
140     ISCRUTE_id(_datagroup1);
141   }
142 
143   va_end(params);
144   *fret = _ret;
145   return;
146 
147 }
148