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