00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <med.h>
00020 #include <med_config.h>
00021 #include <med_outils.h>
00022
00023 #include <string.h>
00024 #include <stdlib.h>
00025 void
00026 _MEDequivalenceCorrespondenceRd30(int dummy, ...) {
00027
00028 med_idt _root=0,_eqid=0,_meshid=0,_cstpid=0,_datagroup2=0;
00029 med_idt _dataset=0;
00030 med_err _ret=-1;
00031 char _path[MED_TAILLE_EQS+2*MED_NAME_SIZE+2]=MED_EQS;
00032 char _computationstepname[2*MED_MAX_PARA+1]="";
00033 char _datagroupname2[2*MED_TAILLE_NOM_ENTITE+2]="";
00034 char _geotypename [MED_TAILLE_NOM_ENTITE+1]="";
00035 med_sorting_type _sortingtype=0;
00036 med_filter _filter = MED_FILTER_INIT;
00037 med_geometry_type _geotype=MED_NONE;
00038 med_int _nentity=0;
00039
00040 MED_VARGS_DECL(const, med_idt , , fid );
00041 MED_VARGS_DECL(const, char * , const , meshname );
00042 MED_VARGS_DECL(const, char * , const , equivname );
00043 MED_VARGS_DECL(const, med_int , , numdt );
00044 MED_VARGS_DECL(const, med_int , , numit );
00045 MED_VARGS_DECL(const, med_entity_type , , entitype );
00046 MED_VARGS_DECL(const, med_geometry_type , , geotype );
00047 MED_VARGS_DECL(, med_int *, const , correspondence );
00048 MED_VARGS_DECL(, med_err * ,, fret );
00049
00050 va_list params;
00051 va_start(params,dummy);
00052
00053 MED_VARGS_DEF(const, med_idt , , fid );
00054 MED_VARGS_DEF(const, char * , const , meshname );
00055 MED_VARGS_DEF(const, char * , const , equivname );
00056 MED_VARGS_DEF(const, med_int , , numdt );
00057 MED_VARGS_DEF(const, med_int , , numit );
00058 MED_VARGS_DEF(const, med_entity_type , , entitype );
00059 MED_VARGS_DEF(const, med_geometry_type , , geotype );
00060 MED_VARGS_DEF(, med_int *, const , correspondence );
00061 MED_VARGS_DEF(, med_err * ,, fret );
00062 if ( entitype == MED_NODE_ELEMENT ) _geotype=MED_NODE ;
00063
00064 if ( (geotype / 100 ) > 2 ) {
00065 MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_GEOMETRIC,MED_ERR_EQUIVALENCE_MSG);
00066 SSCRUTE(equivname);ISCRUTE_int(geotype);
00067 goto ERROR;
00068 }
00069
00070 if ( entitype != MED_NODE ) _geotype=geotype ;
00071
00072
00073
00074
00075
00076 _MEDmodeErreurVerrouiller();
00077
00078
00079
00080
00081
00082 if ((_root = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00083 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
00084 goto ERROR;
00085 }
00086
00087
00088
00089
00090 if ((_meshid = _MEDdatagroupOuvrir(_root,meshname)) < 0) {
00091 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,meshname);
00092 SSCRUTE(_path);goto ERROR;
00093 }
00094
00095 strcat(_path,meshname);
00096
00097
00098
00099
00100 if ((_eqid = _MEDdatagroupOuvrir(_meshid,equivname)) < 0) {
00101 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,equivname);
00102 SSCRUTE(_path);goto ERROR;
00103 }
00104
00105 strcat(_path,"/");
00106 strcat(_path,equivname);
00107
00108 if ( MEDmeshSortingTypeRd(fid,meshname,&_sortingtype) < 0 ) {
00109 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API," MEDmeshSortingTypeRd");
00110 SSCRUTE(meshname);ISCRUTE_int(_sortingtype);goto ERROR;
00111 }
00112
00113 _MEDgetComputationStepName(_sortingtype,numdt,numit,_computationstepname);
00114
00115 if ((_cstpid = _MEDdatagroupOuvrir(_eqid,_computationstepname)) < 0) {
00116 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_computationstepname);
00117 SSCRUTE(_path);goto ERROR;
00118 }
00119
00120
00121
00122
00123
00124 if (_MEDgetEntityTypeName(_datagroupname2,entitype) < 0) {
00125 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00126 ISCRUTE_int(entitype);SSCRUTE(equivname);goto ERROR;
00127 }
00128 if ( entitype != MED_NODE ) {
00129 if ( _MEDgetInternalGeometryTypeName(_geotypename,geotype) < 0) {
00130 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
00131 ISCRUTE_int(geotype);SSCRUTE(equivname);goto ERROR;
00132 }
00133 strcat(_datagroupname2,".");
00134 strcat(_datagroupname2,_geotypename);
00135 }
00136
00137 if ( (_datagroup2 = _MEDdatagroupOuvrir(_cstpid,_datagroupname2)) < 0) {
00138 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_datagroupname2);
00139 SSCRUTE(_path);SSCRUTE(equivname);goto ERROR;
00140 }
00141
00142
00143 if ((_dataset = _MEDdatasetOuvrir(_datagroup2,MED_NOM_COR)) < 0) {
00144 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,MED_NOM_COR);
00145 SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);SSCRUTE(_datagroupname2);
00146 goto ERROR;
00147 }
00148
00149 if ( _MEDattrEntierLire(_dataset,MED_NOM_NBR,&_nentity) < 0) {
00150 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_EQUIVALENCE_MSG);
00151 SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);SSCRUTE(_datagroupname2);
00152 SSCRUTE(MED_NOM_NBR);ISCRUTE(_nentity);goto ERROR;
00153 }
00154
00155 if ( MEDfilterEntityCr(fid, _nentity, 1, 2, MED_ALL_CONSTITUENT,
00156 MED_NO_INTERLACE,MED_UNDEF_PFLMODE,
00157 MED_NO_PROFILE, MED_UNDEF_SIZE, NULL, &_filter) < 0 ) {
00158 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG);
00159 goto ERROR;
00160 }
00161
00162 if ( _MEDdatasetRd(_datagroup2,MED_NOM_COR,MED_INTERNAL_INT,&_filter, (unsigned char *) correspondence) < 0) {
00163 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_DATASET,MED_NOM_COR);
00164 SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00165 goto ERROR;
00166 }
00167
00168 if ( MEDfilterClose(&_filter) < 0 ) {
00169 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_EQUIVALENCE_MSG);
00170 SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00171 goto ERROR;
00172 }
00173
00174 _ret=0;
00175 ERROR:
00176
00177 if (_dataset>0) if (_MEDdatasetFermer(_dataset) < 0) {
00178 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COR);
00179 ISCRUTE_id(_dataset);
00180 }
00181
00182 if (_datagroup2>0) if (_MEDdatagroupFermer(_datagroup2) < 0) {
00183 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
00184 ISCRUTE_id(_datagroup2);SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00185 }
00186
00187 if (_cstpid>0) if (_MEDdatagroupFermer(_cstpid) < 0) {
00188 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_computationstepname);
00189 ISCRUTE_id(_cstpid);SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00190 }
00191
00192 if (_eqid>0) if (_MEDdatagroupFermer(_eqid) < 0) {
00193 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,equivname);
00194 ISCRUTE_id(_eqid);SSCRUTE(_path);
00195 }
00196
00197 if (_meshid>0) if (_MEDdatagroupFermer(_meshid) < 0) {
00198 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,meshname);
00199 ISCRUTE_id(_eqid);
00200 }
00201
00202 if (_root>0) if (_MEDdatagroupFermer(_root) < 0) {
00203 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_EQS);
00204 ISCRUTE_id(_eqid);
00205 }
00206
00207 va_end(params);
00208 *fret = _ret;
00209
00210 return;
00211 }