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
20 #include <med.h>
21 #include <med_config.h>
22 #include <med_outils.h>
23 #include <string.h>
24 #include <stdlib.h>
25
26 void
_MEDequivalenceCorrespondenceSize30(int dummy,...)27 _MEDequivalenceCorrespondenceSize30(int dummy, ...) {
28
29
30 med_err _ret=-1;
31 med_idt _eqid=0,_datagroup1=0,_dataset=0;
32 char _path[MED_EQUIVALENCE_GRP_SIZE+2*MED_NAME_SIZE+2+2*MED_MAX_PARA+1+2*MED_TAILLE_NOM_ENTITE+2]=MED_EQUIVALENCE_GRP;
33 char _datagroupname1[2*MED_TAILLE_NOM_ENTITE+2]="";
34 char _cstpname[2*MED_MAX_PARA+1]="";
35 med_size _nequivarray=0;
36 med_sorting_type _sortingtype=0;
37 med_int _intentitype;
38 med_int _intgeotype;
39 char _geotypename [MED_TAILLE_NOM_ENTITE+1]="";
40
41
42 MED_VARGS_DECL(const, med_idt , , fid );
43 MED_VARGS_DECL(const, char * , const , meshname );
44 MED_VARGS_DECL(const, char * , const , equivname );
45 MED_VARGS_DECL(const, med_int , , numdt );
46 MED_VARGS_DECL(const, med_int , , numit );
47 MED_VARGS_DECL(const, med_entity_type , , entitype );
48 MED_VARGS_DECL(const, med_geometry_type , , geotype );
49 MED_VARGS_DECL(, med_int *, const , nentity );
50 MED_VARGS_DECL(, med_err * ,, fret );
51
52 va_list params;
53 va_start(params,dummy);
54
55 MED_VARGS_DEF(const, med_idt , , fid );
56 MED_VARGS_DEF(const, char * , const , meshname );
57 MED_VARGS_DEF(const, char * , const , equivname );
58 MED_VARGS_DEF(const, med_int , , numdt );
59 MED_VARGS_DEF(const, med_int , , numit );
60 MED_VARGS_DEF(const, med_entity_type , , entitype );
61 MED_VARGS_DEF(const, med_geometry_type , , geotype );
62 MED_VARGS_DEF(, med_int *, const , nentity );
63 MED_VARGS_DEF(, med_err * ,, fret );
64
65 /*
66 * On inhibe le gestionnaire d'erreur
67 */
68
69 _MEDmodeErreurVerrouiller();
70
71
72 if ( MEDmeshSortingTypeRd(fid,meshname,&_sortingtype) < 0 ) {
73 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API," MEDmeshSortingTypeRd");
74 SSCRUTE(meshname);ISCRUTE_int(_sortingtype);goto ERROR;
75 }
76
77 strcat( _path, meshname);
78 strcat( _path, "/");
79 strcat( _path, equivname);
80 strcat( _path, "/");
81 _MEDgetComputationStepName(_sortingtype,numdt,numit,&_path[strlen(_path)]);
82 strcat( _path, "/");
83
84 /*
85 * Construction du nom de datagroup <entitype>[.<geotype>]
86 */
87 if (_MEDgetEntityTypeName(&_path[strlen(_path)],entitype) < 0) {
88 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
89 ISCRUTE_int(entitype);SSCRUTE(equivname);goto ERROR;
90 }
91 if ( entitype != MED_NODE ) {
92 if ( _MEDgetInternalGeometryTypeName(0,_geotypename,geotype) < 0) {
93 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
94 ISCRUTE_int(geotype);SSCRUTE(equivname);goto ERROR;
95 }
96 strcat(_path,".");
97 strcat(_path,_geotypename);
98 }
99
100 if ( (_datagroup1 = _MEDdatagroupOuvrir(fid,_path)) < 0 ) {
101 *nentity=0;
102 goto SORTIE;
103 }
104
105 if ((_dataset = _MEDdatasetOuvrir(_datagroup1,MED_NOM_COR)) < 0) {
106 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,MED_NOM_COR);
107 SSCRUTE(_path);
108 goto ERROR;
109 }
110
111 if ( _MEDattrEntierLire(_dataset,MED_NOM_NBR,nentity) < 0) {
112 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_EQUIVALENCE_MSG);
113 SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(*nentity);
114 goto ERROR;
115 }
116
117 SORTIE:
118 _ret = 0;
119 ERROR:
120
121 if (_dataset>0) if (_MEDdatasetFermer(_dataset) < 0) {
122 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COR);
123 ISCRUTE_id(_dataset);
124 }
125
126 if (_datagroup1>0) if (_MEDdatagroupFermer(_datagroup1) < 0) {
127 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
128 ISCRUTE_id(_datagroup1);
129 }
130
131
132 va_end(params);
133 *fret = _ret;
134 return;
135 }
136