Aller à la documentation de ce fichier.
29 int main (
int argc,
char **argv) {
31 const char meshname[
MED_NAME_SIZE+1] =
"2D unstructured mesh";
44 med_int *triaconnectivity = NULL;
46 med_int *quadconnectivity = NULL;
62 MESSAGE(
"ERROR : open file in READ ONLY ACCESS mode ...");
72 if (
MEDmeshInfoByName(fid, meshname, &spacedim, &meshdim, &meshtype, meshdescription,
73 dtunit, &sortingtype, &nstep, &axistype, axisname, unitname) < 0) {
74 MESSAGE(
"ERROR : mesh info ...");
81 &geotransformation)) < 0) {
82 MESSAGE(
"ERROR : number of nodes ...");
94 &geotransformation)) < 0) {
95 MESSAGE(
"ERROR : number of MED_TRIA3 ...");
102 &geotransformation)) < 0) {
103 MESSAGE(
"ERROR : number of MED_QUAD4 ...");
109 MESSAGE(
"ERROR : memory allocation ...");
115 MESSAGE(
"ERROR : nodes coordinates ...");
123 if ((triaconnectivity = (
med_int *) malloc(
sizeof(
med_int)*ntria3*3)) == NULL) {
124 MESSAGE(
"ERROR : memory allocation ...");
129 MESSAGE(
"ERROR : MED_TRIA3 connectivity ...");
130 free(triaconnectivity);
133 free(triaconnectivity);
135 if ((quadconnectivity = (
med_int *) malloc(
sizeof(
med_int)*nquad4*4)) == NULL) {
136 MESSAGE(
"ERROR : memory allocation ...");
141 MESSAGE(
"ERROR : MED_QUAD4 connectivity ...");
142 free(quadconnectivity);
145 free(quadconnectivity);
150 if ((nfamily =
MEDnFamily(fid,meshname)) < 0) {
151 MESSAGE(
"ERROR : read number of family ...");
155 for (i=0; i<nfamily ; i++) {
158 MESSAGE(
"ERROR : read number of group in a family ...");
163 if ((groupname = (
char*) malloc(
sizeof(
char)*
MED_LNAME_SIZE*ngroup+1)) == NULL) {
164 MESSAGE(
"ERROR : memory allocation ...");
168 if (
MEDfamilyInfo(fid, meshname, i+1, familyname, &familynumber, groupname) < 0) {
169 MESSAGE(
"ERROR : family info ...");
183 &coordinatechangement, &geotransformation)) < 0) {
184 MESSAGE(
"ERROR : check family numbers nodes ...");
188 if ((familynumbers = (
med_int *) malloc(
sizeof(
med_int)*nnodes)) == NULL) {
189 MESSAGE(
"ERROR : memory allocation ...");
193 if (nfamilynumber > 0) {
197 MESSAGE(
"ERROR : read family numbers nodes ...");
201 for (i=0; i<nnodes; i++) *(familynumbers+i) = 0;
203 for (i=0; i<nnodes; i++) {
204 printf(
IFORMAT, *(familynumbers+i));
218 &coordinatechangement, &geotransformation)) < 0) {
219 MESSAGE(
"ERROR : check family number tria3 ...")
223 if ((familynumbers = (
med_int *) malloc(
sizeof(
med_int)*ntria3)) == NULL) {
224 MESSAGE(
"ERROR : memory allocation ...");
228 if (nfamilynumber > 0) {
231 MESSAGE(
"ERROR : read family numbers tria3 ...");
234 for (i=0; i<ntria3; i++) *(familynumbers+i) = 0;
236 free (familynumbers);
240 &coordinatechangement, &geotransformation)) < 0) {
241 MESSAGE(
"ERROR : check family number quad4 ...");
245 if ((familynumbers = (
med_int *) malloc(
sizeof(
med_int)*nquad4)) == NULL) {
246 MESSAGE(
"ERROR : memory allocation ...");
250 if (nfamilynumber > 0) {
253 MESSAGE(
"ERROR : read family numbers quad4 ...");
257 for (i=0; i<nquad4; i++) *(familynumbers+i) = 0;
259 free (familynumbers);
MEDC_EXPORT med_int MEDmeshnEntity(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, const med_data_type datatype, const med_connectivity_mode cmode, med_bool *const changement, med_bool *const transformation)
Cette routine permet de lire le nombre d'entités dans un maillage pour une étape de calcul donnée.
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
MEDC_EXPORT med_int MEDnFamilyGroup(const med_idt fid, const char *const meshname, const int famit)
Cette routine permet de lire le nombre de groupe dans une famille.
MEDC_EXPORT med_err MEDmeshElementConnectivityRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, const med_connectivity_mode cmode, const med_switch_mode switchmode, med_int *const connectivity)
Cette routine permet de lire dans un maillage le tableau des connectivités pour un type géométrique d...
MEDC_EXPORT med_err MEDmeshNodeCoordinateRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_switch_mode switchmode, med_float *const coordinates)
Cette routine permet de lire dans un maillage le tableau des coordonnées des noeuds,...
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
MEDC_EXPORT med_int MEDnFamily(const med_idt fid, const char *const meshname)
Cette routine permet de lire le nombre de famille dans un maillage.
MEDC_EXPORT med_err MEDmeshInfoByName(const med_idt fid, const char *const meshname, med_int *const spacedim, med_int *const meshdim, med_mesh_type *const meshtype, char *const description, char *const dtunit, med_sorting_type *const sortingtype, med_int *const nstep, med_axis_type *const axistype, char *const axisname, char *const axisunit)
Cette routine permet de lire les informations relatives à un maillage en précisant son nom.
MEDC_EXPORT med_err MEDfamilyInfo(const med_idt fid, const char *const meshname, const int famit, char *const familyname, med_int *const familynumber, char *const groupname)
Cette routine permet de lire les informations relatives à une famille d'un maillage.
int main(int argc, char **argv)
MEDC_EXPORT med_err MEDmeshEntityFamilyNumberRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, med_int *const number)
Cette routine permet la lecture des numéros de famille d'un type d'entité d'un maillage.