Back to index

salome-med  6.5.0
MEDnEntites.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.hxx"
00020 
00021 namespace med_2_1{
00022 
00023 med_int
00024 MEDnEntites(med_idt fid,char *maa,med_entite_maillage typ_ent, 
00025             med_connectivite typ_con)
00026 {
00027   med_int total = 0;
00028   int i;  
00029   med_geometrie_element typ_mai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2, 
00030                                                     MED_SEG3,MED_TRIA3,
00031                                                     MED_TRIA6,MED_QUAD4,
00032                                                     MED_QUAD8,MED_TETRA4,
00033                                                     MED_TETRA10,MED_HEXA8,
00034                                                     MED_HEXA20,MED_PENTA6,
00035                                                     MED_PENTA15,MED_PYRA5,
00036                                                     MED_PYRA13};
00037   med_geometrie_element typ_fac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
00038                                                     MED_QUAD4,MED_QUAD8};
00039   med_geometrie_element typ_are[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};  
00040 
00041   switch (typ_ent)
00042   {
00043      case MED_MAILLE :
00044         for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
00045           total += MEDnEntMaa(fid,maa,MED_CONN,MED_MAILLE,typ_mai[i],typ_con);
00046         break;
00047 
00048      case MED_FACE :
00049         for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
00050           total += MEDnEntMaa(fid,maa,MED_CONN,MED_FACE,typ_fac[i],typ_con);
00051         break;
00052 
00053      case MED_ARETE :
00054         for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
00055           total += MEDnEntMaa(fid,maa,MED_CONN,MED_ARETE,typ_are[i],typ_con);
00056         break;
00057 
00058      case MED_NOEUD :
00059         total = MEDnEntMaa(fid,maa,MED_COOR,MED_NOEUD,(med_geometrie_element)0,(med_connectivite)0);
00060         break;
00061 
00062      default :
00063         total = -1;
00064   }
00065 
00066   return total;
00067 }
00068 
00069 }