MEDnChampRef.c
Aller à la documentation de ce fichier.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #include <med.h>
00019 #include "med_config.h"
00020 #include "med_outils.h"
00021 #include <string.h>
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033  
00034 
00035 
00036 med_int MEDnChampRef(med_idt fid, char * cha, med_entite_maillage type_ent, 
00037                      med_geometrie_element type_geo,
00038                      med_int numdt, med_int numo)
00039 
00040 {
00041   char chemin[(MED_TAILLE_CHA+MED_TAILLE_NOM+1)+(2*MED_TAILLE_NOM_ENTITE+2)+2*MED_MAX_PARA+1];
00042   int n1;
00043   char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2];
00044   char nomdatagroup2[2*MED_MAX_PARA+1];
00045   char tmp1         [MED_TAILLE_NOM_ENTITE+1];
00046 
00047   
00048 
00049 
00050   _MEDmodeErreurVerrouiller();
00051 if (MEDcheckVersion(fid) < 0) return -1;
00052 
00053 
00054   
00055 
00056 
00057   strcpy(chemin,MED_CHA);
00058   strcat(chemin,cha);
00059   strcat(chemin,"/");
00060 
00061   
00062 
00063 
00064 
00065   if ( _MEDnomEntite(nomdatagroup1,type_ent ) < 0) {
00066     MESSAGE("L'entité demandée n'est pas une entité <med_entite_maillage> : ");
00067     SSCRUTE(chemin); ISCRUTE(type_ent); return -1;
00068   };
00069   if ((type_ent != MED_NOEUD)) {
00070     if ( _MEDnomGeometrie30(tmp1,type_geo) < 0) {
00071       MESSAGE("Le type géométrique demandé n'est pas un <med_geometrie_element> : ");
00072       SSCRUTE(chemin); ISCRUTE(type_geo); return -1;
00073     };
00074     strcat(nomdatagroup1,".");
00075     strcat(nomdatagroup1,tmp1);
00076   }
00077   strcat(chemin,nomdatagroup1);
00078   strcat(chemin,"/");
00079 
00080   
00081   
00082 
00083 
00084 
00085   sprintf(nomdatagroup2,"%*li%*li",MED_MAX_PARA,(long ) numdt,MED_MAX_PARA,(long ) numo);
00086   strcat(chemin,nomdatagroup2);
00087   
00088   n1 = 0;
00089   if ( _MEDnObjets(fid,chemin,&n1) < 0 ) {
00090     MESSAGE("Impossible d'itérer dans le groupe : ");
00091     SSCRUTE(chemin); return -1;
00092   };
00093 
00094   return (med_int) n1;
00095 
00096 }