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 #include <string.h>
00023
00024 #include <2.3.6/med23v30.h>
00025 #include <2.3.6/med23v30_proto.h>
00026 #include "2.3.6/med23v30_misc.h"
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 med_err _MEDfieldComputingStepCheck236(med_idt fid, const char * const fieldname,
00049 med_size * const ncpst,
00050 med_bool checkmultiplemesh, med_bool * const multiplemesh,
00051 med_bool checkmeshname, med_bool * const samedefaultmeshname)
00052 {
00053 med_err _ret=-1,_err=0;
00054 med_idt _cstpid=0;
00055 char _ent_geo [2*MED_TAILLE_NOM_ENTITE+2]="";
00056 char _path [(MED_TAILLE_CHA+MED_TAILLE_NOM+1)+
00057 (2*MED_TAILLE_NOM_ENTITE+1)+1+(2*MED_MAX_PARA)+1]=MED_CHA;
00058 int _pathlen=0;
00059 med_size _i=0,_n=0;
00060 med_size _prevnseq=0,_nseq =0;
00061 med_string_itdatas _itdatas;
00062
00063
00064
00065
00066 strcat(_path,fieldname);
00067
00068
00069
00070
00071 if ((_err=_MEDnObjects(fid,_path,&_n)) <0)
00072 if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
00073 MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,MED_NOM_ENT "." MED_NOM_GEO);
00074 goto ERROR;
00075 }
00076
00077 _pathlen = strlen(_path);
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 if (checkmeshname) _MEDcheckAttributeStringInit(&_itdatas,MED_NOM_MAI,MED_TAILLE_NOM);
00093
00094 for (_i=0; _i <_n; ++_i ) {
00095
00096
00097
00098
00099 if ( _MEDobjectGetName(fid, _path ,_i, _ent_geo) < 0 ) {
00100 MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);
00101 SSCRUTE(_path); goto ERROR;
00102 }
00103
00104
00105 strcpy(&_path[_pathlen],"/");
00106 strcat(_path,_ent_geo);
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117 if ( _prevnseq != _nseq ) {
00118 MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_ent_geo);
00119 ISCRUTE_size(_prevnseq);ISCRUTE_size(_nseq);ISCRUTE_size(_i);
00120 goto ERROR;
00121 }
00122
00123
00124
00125
00126 if ((_err=_MEDnObjects(fid,_path,&_nseq)) <0)
00127 if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
00128 MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_ent_geo);
00129 goto ERROR;
00130 }
00131
00132 _prevnseq = _nseq;
00133
00134 if (checkmeshname || checkmultiplemesh) {
00135 if ((_cstpid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00136 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
00137 goto ERROR;
00138 }
00139 }
00140
00141 if (checkmeshname) {
00142
00143
00144
00145
00146 if (_MEDiterate(_cstpid, _MEDcheckAttributeStringFunc, &_itdatas ) < 0) {
00147 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ATTRIBUTE,MED_ERR_VALUE_MSG);
00148 SSCRUTE(_itdatas.attvalprec); SSCRUTE(_itdatas.attval); goto ERROR;
00149 }
00150 }
00151
00152
00153
00154
00155
00156 if (checkmultiplemesh) {
00157 if (_MEDiterate(_cstpid, _MEDchecknSublinkFunc, multiplemesh ) < 0) {
00158 MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,MED_ERR_NBR_MSG MED_ERR_MESH_MSG);
00159 SSCRUTE(_path);goto ERROR;
00160 }
00161 }
00162
00163 if (_cstpid>0) if (_MEDdatagroupFermer(_cstpid) < 0) {
00164 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00165 ISCRUTE_id(_cstpid);
00166 }
00167
00168 _path[_pathlen]='\0';
00169 }
00170
00171 if (checkmeshname) _MEDcheckAttributeStringFin(&_itdatas);
00172
00173 *ncpst = _nseq;
00174
00175 _ret = 0;
00176
00177 ERROR:
00178
00179 return _ret;
00180
00181 }