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
00026 void _MEDsubdomainCorrespondenceRd30(int dummy, ...) {
00027
00028
00029 med_idt _root=0,_eqid=0,_meshid=0,_cstpid=0,_datagroup2=0;
00030 med_idt _dataset=0;
00031 med_err _ret=-1;
00032 char _path[MED_TAILLE_JNT+2*MED_NAME_SIZE+2]=MED_JNT;
00033 char _computationstepname[2*MED_MAX_PARA+1]="";
00034 char _datagroupname2[4*MED_TAILLE_NOM_ENTITE+4]="";
00035 char _localgeotypename [MED_TAILLE_NOM_ENTITE+1]="";
00036 char _remotegeotypename [MED_TAILLE_NOM_ENTITE+1]="";
00037 med_sorting_type _sortingtype=0;
00038 med_filter _filter = MED_FILTER_INIT;
00039 med_geometry_type _localgeotype=MED_NONE;
00040 med_geometry_type _remotegeotype =MED_NONE;
00041 med_int _nentity=0;
00042
00043 MED_VARGS_DECL(const, med_idt , , fid );
00044 MED_VARGS_DECL(const, char * , const , localmeshname );
00045 MED_VARGS_DECL(const, char * , const , jointname );
00046 MED_VARGS_DECL(const, med_int , , numdt );
00047 MED_VARGS_DECL(const, med_int , , numit );
00048 MED_VARGS_DECL(const, med_entity_type , , localentitype );
00049 MED_VARGS_DECL(const, med_geometry_type , , localgeotype );
00050 MED_VARGS_DECL(const, med_entity_type , , remoteentitype );
00051 MED_VARGS_DECL(const, med_geometry_type , , remotegeotype );
00052 MED_VARGS_DECL(, med_int *, const , correspondence );
00053 MED_VARGS_DECL(, med_err * ,, fret );
00054
00055 va_list params;
00056 va_start(params,dummy);
00057
00058 MED_VARGS_DEF(const, med_idt , , fid );
00059 MED_VARGS_DEF(const, char * , const , localmeshname );
00060 MED_VARGS_DEF(const, char * , const , jointname );
00061 MED_VARGS_DEF(const, med_int , , numdt );
00062 MED_VARGS_DEF(const, med_int , , numit );
00063 MED_VARGS_DEF(const, med_entity_type , , localentitype );
00064 MED_VARGS_DEF(const, med_geometry_type , , localgeotype );
00065 MED_VARGS_DEF(const, med_entity_type , , remoteentitype );
00066 MED_VARGS_DEF(const, med_geometry_type , , remotegeotype );
00067 MED_VARGS_DEF(, med_int *, const , correspondence );
00068 MED_VARGS_DEF(, med_err * ,, fret );
00069 if ( localentitype == MED_NODE_ELEMENT ) _localgeotype=MED_NODE ;
00070
00071 if ( localentitype != MED_NODE ) _localgeotype=localgeotype ;
00072 if ( remoteentitype != MED_NODE ) _remotegeotype=remotegeotype ;
00073
00074
00075
00076
00077 _MEDmodeErreurVerrouiller();
00078
00079
00080
00081
00082
00083 if ((_root = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00084 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
00085 goto ERROR;
00086 }
00087
00088
00089
00090
00091 if ((_meshid = _MEDdatagroupOuvrir(_root,localmeshname)) < 0) {
00092 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,localmeshname);
00093 SSCRUTE(_path);goto ERROR;
00094 }
00095
00096 strcat(_path,localmeshname);
00097
00098
00099
00100
00101 if ((_eqid = _MEDdatagroupOuvrir(_meshid,jointname)) < 0) {
00102 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,jointname);
00103 SSCRUTE(_path);goto ERROR;
00104 }
00105
00106 strcat(_path,"/");
00107 strcat(_path,jointname);
00108
00109 if ( MEDmeshSortingTypeRd(fid,localmeshname,&_sortingtype) < 0 ) {
00110 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API," MEDmeshSortingTypeRd");
00111 SSCRUTE(localmeshname);ISCRUTE_int(_sortingtype);goto ERROR;
00112 }
00113
00114 _MEDgetComputationStepName(_sortingtype,numdt,numit,_computationstepname);
00115
00116 if ((_cstpid = _MEDdatagroupOuvrir(_eqid,_computationstepname)) < 0) {
00117 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_computationstepname);
00118 SSCRUTE(_path);goto ERROR;
00119 }
00120
00121
00122
00123
00124
00125 if (_MEDgetEntityTypeName(_datagroupname2,localentitype) < 0) {
00126 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00127 ISCRUTE_int(localentitype);SSCRUTE(jointname);goto ERROR;
00128 }
00129 if ( localentitype != MED_NODE ) {
00130 if ( _MEDgetInternalGeometryTypeName(_localgeotypename,localgeotype) < 0) {
00131 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
00132 ISCRUTE_int(localgeotype);SSCRUTE(jointname);goto ERROR;
00133 }
00134 strcat(_datagroupname2,".");
00135 strcat(_datagroupname2,_localgeotypename);
00136 }
00137
00138 strcat(_datagroupname2,".");
00139
00140 if (_MEDgetEntityTypeName(&_datagroupname2[strlen(_datagroupname2)],remoteentitype) < 0) {
00141 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00142 ISCRUTE_int(remoteentitype);SSCRUTE(jointname);goto ERROR;
00143 }
00144 if ( remoteentitype != MED_NODE ) {
00145 if ( _MEDgetInternalGeometryTypeName(_remotegeotypename,remotegeotype) < 0) {
00146 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
00147 ISCRUTE_int(remotegeotype);SSCRUTE(jointname);goto ERROR;
00148 }
00149 strcat(_datagroupname2,".");
00150 strcat(_datagroupname2,_remotegeotypename);
00151 }
00152
00153
00154 if ( (_datagroup2 = _MEDdatagroupOuvrir(_cstpid,_datagroupname2)) < 0) {
00155 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_datagroupname2);
00156 SSCRUTE(_path);SSCRUTE(jointname);goto ERROR;
00157 }
00158
00159
00160 if ((_dataset = _MEDdatasetOuvrir(_datagroup2,MED_NOM_COR)) < 0) {
00161 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,MED_NOM_COR);
00162 SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);SSCRUTE(_datagroupname2);
00163 goto ERROR;
00164 }
00165
00166 if ( _MEDattrEntierLire(_dataset,MED_NOM_NBR,&_nentity) < 0) {
00167 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
00168 SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);SSCRUTE(_datagroupname2);
00169 SSCRUTE(MED_NOM_NBR);ISCRUTE(_nentity);goto ERROR;
00170 }
00171
00172 if ( MEDfilterEntityCr(fid, _nentity, 1, 2, MED_ALL_CONSTITUENT,
00173 MED_NO_INTERLACE,MED_UNDEF_PFLMODE,
00174 MED_NO_PROFILE, MED_UNDEF_SIZE, NULL, &_filter) < 0 ) {
00175 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG);
00176 goto ERROR;
00177 }
00178
00179 if ( _MEDdatasetRd(_datagroup2,MED_NOM_COR,MED_INTERNAL_INT,&_filter, (unsigned char *) correspondence) < 0) {
00180 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_DATASET,MED_NOM_COR);
00181 SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00182 goto ERROR;
00183 }
00184
00185 if ( MEDfilterClose(&_filter) < 0 ) {
00186 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_SUBDOMAINJOINT_MSG);
00187 SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00188 goto ERROR;
00189 }
00190
00191 _ret=0;
00192 ERROR:
00193
00194 if (_dataset>0) if (_MEDdatasetFermer(_dataset) < 0) {
00195 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COR);
00196 ISCRUTE_id(_dataset);
00197 }
00198
00199 if (_datagroup2>0) if (_MEDdatagroupFermer(_datagroup2) < 0) {
00200 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
00201 ISCRUTE_id(_datagroup2);SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00202 }
00203
00204 if (_cstpid>0) if (_MEDdatagroupFermer(_cstpid) < 0) {
00205 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_computationstepname);
00206 ISCRUTE_id(_cstpid);SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
00207 }
00208
00209 if (_eqid>0) if (_MEDdatagroupFermer(_eqid) < 0) {
00210 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,jointname);
00211 ISCRUTE_id(_eqid);SSCRUTE(_path);
00212 }
00213
00214 if (_meshid>0) if (_MEDdatagroupFermer(_meshid) < 0) {
00215 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,localmeshname);
00216 ISCRUTE_id(_eqid);
00217 }
00218
00219 if (_root>0) if (_MEDdatagroupFermer(_root) < 0) {
00220 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_JNT);
00221 ISCRUTE_id(_eqid);
00222 }
00223
00224 va_end(params);
00225 *fret = _ret;
00226 return;
00227 }