_MEDfield23nValue236.c

Aller à la documentation de ce fichier.
00001 /*  This file is part of MED.
00002  *
00003  *  COPYRIGHT (C) 1999 - 2011  EDF R&D, CEA/DEN
00004  *  MED is free software: you can redistribute it and/or modify
00005  *  it under the terms of the GNU Lesser General Public License as published by
00006  *  the Free Software Foundation, either version 3 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  MED is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Lesser General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Lesser General Public License
00015  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 
00019 #include <med.h>
00020 #include <med_config.h>
00021 #include <string.h>
00022 #include <stdlib.h>
00023 #include <med_outils.h>
00024 
00025 #include <2.3.6/med23v30.h>
00026 #include <2.3.6/med23v30_proto.h>
00027 #include "2.3.6/med23v30_misc.h"
00028 
00029 #include "med_versioned.h"
00030 
00031 void
00032 _MEDfield23nValue236(int dummy, ...)
00033 {
00034   va_list params;
00035   va_start(params,dummy);
00036 
00037   const med_idt           fid                        = va_arg(params,const med_idt            );
00038   const char * const      fieldname                  = va_arg(params,const char * const       );
00039   const med_int           numdt                      = va_arg(params,const med_int            );
00040   const med_int           numit                      = va_arg(params,const med_int            );
00041   const med_entity_type   entitytype                 = va_arg(params,const med_entity_type    );
00042   const med_geometry_type geotype                    = va_arg(params,const med_geometry_type  );
00043   const char * const      meshname                   = va_arg(params,const char * const       );
00044         char * const      profilename                = va_arg(params,char * const             );
00045   const int               profileit                  = va_arg(params,const int                );
00046   const med_storage_mode  storagemode                = va_arg(params,const med_storage_mode   );
00047         med_int * const   profilesize                = va_arg(params,med_int * const          );
00048         char * const      localizationname           = va_arg(params,char * const             );
00049         med_int * const   nbofintegrationpoint       = va_arg(params,med_int * const          );
00050         med_int *         fret                       = va_arg(params,        med_int *);
00051 
00052   med_int               _ret                 =-1;
00053   med_int               _nbofprofile         = 0;
00054   med_int               _n                   = 0;
00055   med_int               _profilearraysize    = 0,_nbofvaluesperentity=0;
00056   med_int               _nbofintegrationpoint= 0;
00057   med_bool              _anyprofile          = MED_FALSE;
00058   med_geometrie_element _locgeotype          = 0;
00059   med_int               _intlocgeotype       = 0;
00060   med_int               _nbofvaluesperentityfromloc=0;
00061   int                   _dummy                     =0;
00062   char     _localizationname  [MED_TAILLE_NOM+1]                 = "";
00063   char     _tmpprofilename    [MED_NAME_SIZE+1]                  = "", *_profilename=0;
00064   char     _path              [MED_TAILLE_GAUSS+MED_TAILLE_NOM+1]= MED_GAUSS;
00065   char     _geotype           [MED_TAILLE_NOM_ENTITE+1]          = "";
00066   int      _meshit =-1;
00067 
00068   /*
00069    * On inhibe le gestionnaire d'erreur HDF 5
00070    */
00071   _MEDmodeErreurVerrouiller();
00072 
00073   NOFINALBLANK(fieldname,ERROR);
00074 
00075   if ( profileit != 1 ) {
00076     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_PARAMETER,MED_ERR_VALUE_MSG);
00077     ISCRUTE_int(profileit);goto ERROR;
00078   }
00079 
00080   /*
00081    * Cette appel n'effectue pas l'appel à _MEDfieldComputingStepCheck236
00082    */
00083   _MEDfield23nProfile236(_dummy,fid,fieldname,numdt,numit,entitytype,geotype,
00084                          _meshit,meshname,_tmpprofilename,_localizationname,&_nbofprofile );
00085 
00086   if ( _nbofprofile  < 0 ) {
00087     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDfieldnProfile236");
00088     goto ERROR;
00089   }
00090 
00091   /* REM: MEDnVal prend en compte le nombre de points de Gauss, ce qui n'est pas le cas
00092      de MEDfieldnValue */
00093   if ( (_n = MEDnVal(fid, (char *) fieldname,entitytype,geotype,
00094                      numdt,numit,(char *) meshname,(med_mode_profil) storagemode) ) < 0 ) {
00095     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDnVal");
00096     goto ERROR;
00097   }
00098 
00099   /*
00100    * Lecture de la taille du profil (eventuellement MED_ALLENTITIES_PROFILE)
00101    */
00102 
00103   /* REM:  (profileit < 0 ) signifie que l'on nous a fourni <profilename> */
00104   if ( profileit < 0 ) {
00105       if ( !strlen(profilename)) {
00106         _profilename = MED_NOPFL;
00107       }  else {
00108         if ( strcmp(_tmpprofilename,profilename) ) {
00109           MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_PARAMETER,profilename);
00110           SSCRUTE(_tmpprofilename); goto ERROR;
00111         }
00112         _profilename=profilename;
00113         _anyprofile=MED_TRUE;
00114       }
00115   } else {
00116     strncpy(profilename,_tmpprofilename,MED_TAILLE_NOM+1);
00117     profilename[MED_TAILLE_NOM]='\0';
00118     _profilename=profilename;
00119     if ( strlen(profilename)) _anyprofile=MED_TRUE;
00120   }
00121 
00122   if ( _anyprofile ) {
00123     if ( (_profilearraysize=MEDprofileSizeByName(fid, _profilename)) < 0)  {
00124       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_FIELD_MSG);
00125       SSCRUTE(fieldname); SSCRUTE(_profilename);
00126       SSCRUTE("MEDprofileSizeByName");goto ERROR;
00127     }
00128   }
00129 
00130   /*
00131    * Lecture du nombre de points d'intégration.
00132    */
00133 
00134   strncpy(localizationname,_localizationname,MED_TAILLE_NOM+1);
00135   localizationname[MED_TAILLE_NOM]='\0';
00136 
00137   /* Vérification de la cohérence du  nombre de valeurs pas entité */
00138   if (entitytype == MED_NODE_ELEMENT ) {
00139     if ( strlen( _localizationname) ) {
00140         MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_PARAMETER,_localizationname);
00141         SSCRUTE(MED_NO_LOCALIZATION);ISCRUTE_int(entitytype);goto ERROR;
00142     }
00143     _nbofvaluesperentityfromloc = geotype % 100;
00144   } else if (! strcmp(_localizationname,MED_GAUSS_ELNO)) {
00145     /* Les points de Gauss sont définis sur les noeuds de l'element (mot cle) */
00146     /* le nombre de points de Gauss est egal au nombre de noeuds de l'element */
00147     _nbofvaluesperentityfromloc = geotype % 100;
00148   } else if ( strlen(_localizationname) ) {
00149 
00150     strcat(_path,_localizationname);
00151 
00152     if ( _MEDattributeNumRdByName(fid, _path, MED_NOM_NBR,MED_INTERNAL_INT,(unsigned char *) &_nbofvaluesperentityfromloc) < 0 ) {
00153       MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE, MED_ERR_NAME_MSG );
00154       SSCRUTE(MED_NOM_NBR);SSCRUTE(_path); ISCRUTE(_nbofvaluesperentityfromloc);goto ERROR;
00155     }
00156 
00157     if ( _MEDattributeNumRdByName(fid, _path, MED_NOM_GEO, MED_INTERNAL_INT,(unsigned char *) &_intlocgeotype) < 0 ) {
00158       MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE, MED_ERR_NAME_MSG );
00159       SSCRUTE(MED_NOM_GEO);SSCRUTE(_path); ISCRUTE(_intlocgeotype);goto ERROR;
00160     }
00161 
00162     _locgeotype = (med_geometry_type) _intlocgeotype;
00163 
00164     if ( _locgeotype != geotype ) {
00165       MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
00166       SSCRUTE(_localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE_int(_locgeotype);ISCRUTE_int(geotype);goto ERROR;
00167     }
00168 
00169   } else {
00170     _nbofvaluesperentityfromloc = 1;
00171   }
00172 
00173   /* Pour effectuer la vérification suivante (incohérence dans le fichier suite à une 
00174      maj de la localisation ou du champ  sans prise en compte d'un nombre de points d'intégration différent),
00175      il faudrait lire l'attribut MED_NOM_NGA sur le maillage par défaut du champ*/
00176   /* Pour celà il faut soit developper une nouvelle routine soit utiliser MEDpasdetempsInfo mais qui
00177      est itérative*/
00178 /*   if ( _nbofvaluesperentityfromloc != _nbofvaluesperentity ) { */
00179 /*     MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG); */
00180 /*     SSCRUTE(_localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE(_nbofvaluesperentityfromloc); */
00181 /*     ISCRUTE(_nbofvaluesperentity);goto ERROR; */
00182 /*   } */
00183 
00184   *nbofintegrationpoint = _nbofvaluesperentityfromloc;
00185 
00186   _n/=_nbofvaluesperentityfromloc;
00187 
00188   /*Rectification de la valeur 2.3.6 qui prend en compte le nombre de points d'intégration*/
00189   if (_anyprofile)
00190     *profilesize=_profilearraysize;
00191   else
00192     *profilesize=_n;
00193 
00194 
00195   _ret = _n;
00196  ERROR:
00197 
00198   va_end(params);
00199   *fret = _ret;
00200 
00201   return;
00202 }

Généré le Mon May 16 17:10:22 2011 pour MED fichier par  doxygen 1.6.1