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 #include <stdlib.h>
24
_MEDmeshComputationStepInfo30(int dummy,...)25 void _MEDmeshComputationStepInfo30(int dummy, ...) {
26
27 /*musthave1cs utilisé uniquement en 2.3.6*/
28
29
30 med_err _ret=-1;
31 med_idt _meshid=0,_datagroup1=0;
32 int _num;
33 char _cstppath[MED_MESH_GRP_SIZE+MED_NAME_SIZE+1+2*MED_MAX_PARA+1+1]=MED_MESH_GRP;
34 char _cstpname[2*MED_MAX_PARA+1]="";
35
36
37 MED_VARGS_DECL(const, med_idt , , fid );
38 MED_VARGS_DECL(const, char * , const , meshname );
39 MED_VARGS_DECL(const, int , , csit );
40 MED_VARGS_DECL(, med_int *, const , numdt );
41 MED_VARGS_DECL(, med_int *, const , numit );
42 MED_VARGS_DECL(, med_float *, const , dt );
43 MED_VARGS_DECL(, med_bool ,, musthave1cs );
44 MED_VARGS_DECL(, med_err * ,, fret );
45
46 va_list params;
47 va_start(params,dummy);
48
49 MED_VARGS_DEF(const, med_idt , , fid );
50 MED_VARGS_DEF(const, char * , const , meshname );
51 MED_VARGS_DEF(const, int , , csit );
52 MED_VARGS_DEF(, med_int *, const , numdt );
53 MED_VARGS_DEF(, med_int *, const , numit );
54 MED_VARGS_DEF(, med_float *, const , dt );
55 MED_VARGS_DEF(, med_bool ,, musthave1cs );
56 MED_VARGS_DEF(, med_err * ,, fret );
57
58 _num = csit - 1;
59
60 /*
61 * On inhibe le gestionnaire d'erreur
62 */
63 _MEDmodeErreurVerrouiller();
64
65 strcat( _cstppath, meshname);
66 strcat( _cstppath, "/");
67 if ((_meshid = _MEDdatagroupOuvrir(fid,_cstppath)) < 0) {
68 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_cstppath);
69 ISCRUTE_id(_meshid);goto ERROR;
70 }
71
72 /*
73 * On recupere le nom de l'�tape de calcul
74 */
75 if ( _MEDobjectGetName(fid, _cstppath ,_num, &_cstppath[strlen(_cstppath)]) < 0 ) {
76 MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_cstppath);ISCRUTE_int(csit);
77 goto ERROR;
78 }
79
80 if ( (_datagroup1 = _MEDdatagroupOuvrir(_meshid,_cstppath)) < 0 ) {
81 MED_ERR_(_ret,MED_ERR_DOESNTEXIST,MED_ERR_COMPUTINGSTEP,_cstppath);
82 SSCRUTE(meshname);goto ERROR;
83 }
84
85 /*Lit l'attribut MED_NOM_NDT pour lecture */
86 if ( _MEDattrEntierLire(_datagroup1,MED_NOM_NDT,numdt) < 0) {
87 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
88 SSCRUTE(meshname);SSCRUTE(_cstppath);SSCRUTE(MED_NOM_NDT);
89 ISCRUTE(*numdt);goto ERROR;
90 }
91
92
93 /*Lit l'attribut MED_NOM_PDT pour lecture */
94 if ( _MEDattrFloatLire(_datagroup1,MED_NOM_PDT,dt) < 0) {
95 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
96 SSCRUTE(meshname);SSCRUTE(_cstppath);SSCRUTE(MED_NOM_PDT);
97 RSCRUTE(*dt);goto ERROR;
98 }
99
100 /*Lit l'attribut MED_NOM_NOR pour lecture */
101 if ( _MEDattrEntierLire(_datagroup1,MED_NOM_NOR,numit) < 0) {
102 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
103 SSCRUTE(meshname);SSCRUTE(_cstppath);SSCRUTE(MED_NOM_NOR);
104 ISCRUTE(*numit); goto ERROR;
105 }
106
107 _ret = 0;
108 ERROR:
109
110 if (_meshid>0) if (_MEDdatagroupFermer(_meshid) < 0) {
111 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,meshname);
112 ISCRUTE_id(_meshid);
113 }
114
115 if (_datagroup1>0) if (_MEDdatagroupFermer(_datagroup1) < 0) {
116 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_cstppath);
117 ISCRUTE_id(_datagroup1);
118 }
119
120 va_end(params);
121 *fret = _ret;
122 return;
123 }
124