Back to index

salome-med  6.5.0
MEDbodyFittedLire.cxx
Go to the documentation of this file.
00001 /*************************************************************************
00002 * COPYRIGHT (C) 1999 - 2002  EDF R&D
00003 * THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
00004 * IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE 
00005 * AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
00006 * EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00007 *  
00008 * THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
00009 * WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
00010 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
00011 * LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
00012 *
00013 * YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
00014 * ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
00015 * INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
00016 *
00017 *************************************************************************/
00018 
00019 #include "med_outils.hxx"
00020 #include "med.hxx"
00021 
00022 #include <cstring>
00023 
00024 namespace med_2_1{
00025 
00026 med_err 
00027 MEDbodyFittedLire(med_idt fid, char *maa, med_int mdim, med_float *coo, med_mode_switch mode_coo,
00028                   med_repere *repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds )
00029 {
00030     med_idt maaid, noeid, dataset;
00031     char    chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
00032     med_int type_rep_int;
00033 
00034     /* On inhibe le gestionnaire d'erreur */
00035     _MEDmodeErreurVerrouiller();
00036 
00037     /* Si le maillage n'existe pas => erreur */
00038     strcpy(chemin, MED_MAA);
00039     strcat(chemin, maa);
00040     maaid = _MEDdatagroupOuvrir(fid, chemin);
00041     if (maaid < 0) return(-1);
00042 
00043     /* Si le Data Group "NOE" n'existe pas => erreur */
00044     noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
00045     if (noeid < 0) return(-1);
00046 
00047     /* Lecture du Data Set "BOF" */
00048     if (_MEDdatasetNumLire(noeid, MED_NOM_BOF, MED_REEL64, mode_coo, mdim, MED_ALL, MED_NOPF, 0, 1, (unsigned char*)coo) < 0) {
00049         return(-1);
00050     };
00051 
00052     /* On re-ouvre le Data Set "BOF" pour y lire des attributs */
00053     dataset = _MEDdatasetOuvrir(noeid, MED_NOM_BOF);
00054     if (dataset < 0) return(-1);
00055 
00056     /* L'attribut "REP" */
00057     if (_MEDattrEntierLire(dataset, MED_NOM_REP, &type_rep_int) < 0) {
00058         return(-1);
00059     } else {
00060         *repere = (med_repere)type_rep_int;
00061     };
00062 
00063     /* Attribut "NOM" */
00064     if (_MEDattrStringLire(dataset, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo) < 0) {
00065         return(-1);
00066     };
00067 
00068     /* Attribut "UNI" */
00069     if (_MEDattrStringLire(dataset, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo) < 0) {
00070         return(-1);
00071     };
00072 
00073     /* lecture des numeros de familles */
00074     if (MEDfamLire(fid, maa, fam, nnoeuds, MED_NOEUD, MED_POINT1) < 0) {
00075         return(-1);
00076     };
00077 
00078     /* On ferme tout */
00079     if (_MEDdatasetFermer(dataset) < 0) {
00080         return(-1);
00081     };
00082     if (_MEDdatagroupFermer(noeid) < 0) {
00083         return(-1);
00084     };
00085     if (_MEDdatagroupFermer(maaid) < 0) {
00086         return(-1);
00087     };
00088     return(0);
00089 }
00090 
00091 }