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 #include <stdlib.h>
00024
00047 med_err MEDmeshElementRd(const med_idt fid,
00048 const char * const meshname,
00049 const med_int numdt,
00050 const med_int numit,
00051 const med_entity_type entitype,
00052 const med_geometry_type geotype,
00053 const med_connectivity_mode cmode,
00054 const med_switch_mode switchmode,
00055 med_int * const connectivity,
00056 med_bool * const withelementname,
00057 char * const elementname,
00058 med_bool * const withelementnumber,
00059 med_int * const elementnumber,
00060 med_bool * const withfamnumber,
00061 med_int * const famnumber) {
00062
00063 med_err _ret = -1;
00064 med_bool _chgt=MED_FALSE, _trsf=MED_FALSE;
00065
00066 *withelementname =MED_FALSE;
00067 *withelementnumber =MED_FALSE;
00068 *withfamnumber =MED_FALSE;
00069
00070 if ( (_ret = MEDmeshElementConnectivityRd(fid,
00071 meshname,
00072 numdt,
00073 numit,
00074 entitype,
00075 geotype,
00076 cmode,
00077 switchmode,
00078 connectivity) ) < 0 ) {
00079 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshElementConnectivityRd");
00080 goto ERROR;
00081 }
00082
00083
00084 if ( MEDmeshnEntity(fid, meshname, numdt, numit,
00085 entitype,geotype,MED_NAME, cmode,
00086 &_chgt, &_trsf) > 0) {
00087 *withelementname=MED_TRUE;
00088 }
00089
00090 if ( *withelementname )
00091 if ( (_ret = MEDmeshEntityNameRd(fid,
00092 meshname,
00093 numdt,
00094 numit,
00095 entitype,
00096 geotype,
00097 elementname) ) < 0 ) {
00098 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityNameRd");
00099 goto ERROR;
00100 }
00101
00102 if ( MEDmeshnEntity(fid, meshname, numdt, numit,
00103 entitype,geotype,MED_NUMBER, cmode,
00104 &_chgt, &_trsf) > 0) {
00105 *withelementnumber=MED_TRUE;
00106 }
00107
00108
00109 if ( *withelementnumber )
00110 if ( (_ret = MEDmeshEntityNumberRd(fid,
00111 meshname,
00112 numdt,
00113 numit,
00114 entitype,
00115 geotype,
00116 elementnumber) ) < 0 ) {
00117 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityNumberRd");
00118 goto ERROR;
00119 }
00120
00121 if ( MEDmeshnEntity(fid, meshname, numdt, numit,
00122 entitype,geotype,MED_FAMILY_NUMBER, cmode,
00123 &_chgt, &_trsf) > 0) {
00124 *withfamnumber=MED_TRUE;
00125 }
00126
00127 if (*withfamnumber)
00128 if ( (_ret = MEDmeshEntityFamilyNumberRd(fid,
00129 meshname,
00130 numdt,
00131 numit,
00132 entitype,
00133 geotype,
00134 famnumber) ) < 0 ) {
00135 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityFamilyNumberRd");
00136 goto ERROR;
00137 }
00138
00139 _ret = 0;
00140 ERROR:
00141 return _ret;
00142 }