MAJ_21_22_localisation_Gauss.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 
00019 
00020 #include "med_config.h"
00021 #include "med_outils.h"
00022 #include <string.h>
00023 
00024 
00025 
00026 
00027 
00028 #include "med21.h"
00029 #include "med_hdfi21.h"
00030 #include "MAJ_21_22.h"
00031 
00032 void MAJ_21_22_localisation_Gauss(med_idt fid,char *nom_modele,med_int ngauss)
00033 {
00034   med_err ret;
00035   med_geometrie_element type;
00036   med_float *refcoo, *gaucoo, *poids;
00037   char nom_type[4];
00038   med_int edim, nsom,n,nlu;
00039   int i;
00040   char nom[MED_TAILLE_NOM+1];
00041 
00042   
00043 
00044   n = MEDnGauss(fid);
00045   if (n > 0)
00046     for (i=1;i<=n;i++) {
00047       ret = MEDgaussInfo(fid,i,nom,&type,&nlu);
00048       if (! strcmp(nom,nom_modele)) return;
00049     }
00050   
00051   
00052   strncpy(nom_type,nom_modele,3);
00053   nom_type[3] = '\0';
00054   if (! strcmp(nom_type,(char *)(MED_NOM_SE2)))
00055     type = MED_SEG2;
00056   if (! strcmp(nom_type,(char *)(MED_NOM_SE3)))
00057     type = MED_SEG3; 
00058   if (! strcmp(nom_type,(char *)(MED_NOM_TR3)))
00059     type = MED_TRIA3; 
00060   if (! strcmp(nom_type,(char *)(MED_NOM_TR6)))
00061     type = MED_TRIA6;
00062   if (! strcmp(nom_type,(char *)(MED_NOM_QU4)))
00063     type = MED_QUAD4; 
00064   if (! strcmp(nom_type,(char *)(MED_NOM_QU8)))
00065     type = MED_QUAD8;
00066   if (! strcmp(nom_type,(char *)(MED_NOM_TE4)))
00067     type = MED_TETRA4; 
00068   if (! strcmp(nom_type,(char *)(MED_NOM_T10)))
00069     type = MED_TETRA10; 
00070     if (! strcmp(nom_type,(char *)(MED_NOM_HE8)))
00071     type = MED_HEXA8; 
00072   if (! strcmp(nom_type,(char *)(MED_NOM_H20)))
00073     type = MED_HEXA20;
00074   if (! strcmp(nom_type,(char *)(MED_NOM_PE6)))
00075     type = MED_PENTA6; 
00076   if (! strcmp(nom_type,(char *)(MED_NOM_P15)))
00077     type = MED_PENTA15;
00078   if (! strcmp(nom_type,(char *)(MED_NOM_PY5)))
00079     type = MED_PYRA5; 
00080   if (! strcmp(nom_type,(char *)(MED_NOM_P13)))
00081     type = MED_PYRA13;
00082 
00083   
00084   edim = type / 100;
00085   nsom = type % 100;
00086 
00087   
00088   refcoo = (med_float*) malloc(sizeof(med_float)*edim*nsom);
00089   EXIT_IF(refcoo == NULL,NULL,NULL);
00090   for (i=0;i<edim*nsom;i++) *(refcoo+i) = 0.;
00091   gaucoo = (med_float*) malloc(sizeof(med_float)*edim*ngauss);
00092   EXIT_IF(gaucoo == NULL,NULL,NULL);
00093   for (i=0;i<edim*ngauss;i++) *(gaucoo+i) = 0.;
00094   poids  = (med_float*) malloc(sizeof(med_float)*ngauss);
00095   EXIT_IF(poids == NULL,NULL,NULL);
00096   for (i=0;i<ngauss;i++) *(poids+i) = 0.;
00097 
00098   
00099   ret = MEDgaussEcr(fid,type,refcoo,MED_FULL_INTERLACE,ngauss,gaucoo,poids,nom_modele);
00100   EXIT_IF(ret < 0,"Ecriture de la localisation des points de Gauss",nom_modele);
00101 
00102   
00103   free(refcoo);
00104   free(gaucoo);
00105   free(poids);
00106 }