# MEDjointTypeCorres.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 #include <med.h>
    00019 #include <med_config.h>
    00020 #include <med_outils.h>
    00021
    00022 #include <string.h>
    00023 #include <stdlib.h>
    00024
    00025 extern int mode_interlace;
    00026
    00027 med_err
    00028 MEDjointTypeCorres(med_idt fid, char *maa, char *jn,int ind,
    00029                     med_entite_maillage *typ_ent_local,   med_geometrie_element *typ_geo_local,
    00030                     med_entite_maillage *typ_ent_distant, med_geometrie_element *typ_geo_distant)
    00031 {
    00032   med_int nent;
    00033
    00034   static med_int geo_ent_local=0,geo_ent_distant=0;
    00035   static int ind_type_courrant=0;
    00036   int ind_type_a_trouver=ind;
    00037
    00038   const med_int nb_geo_ent=1+MED_NBR_GEOMETRIE_MAILLE+MED_NBR_GEOMETRIE_ARETE+MED_NBR_GEOMETRIE_FACE;
    00039
    00040   med_geometrie_element typ_geo_ent[1+MED_NBR_GEOMETRIE_MAILLE+MED_NBR_GEOMETRIE_ARETE+MED_NBR_GEOMETRIE_FACE][2]=
    00041     {
    00042       {MED_NOEUD,0},
    00043       {MED_MAILLE,MED_POINT1   },
    00044       {MED_MAILLE,MED_SEG2     },
    00045       {MED_MAILLE,MED_SEG3     },
    00046       {MED_MAILLE,MED_TRIA3    },
    00047       {MED_MAILLE,MED_TRIA6    },
    00048       {MED_MAILLE,MED_QUAD4    },
    00049       {MED_MAILLE,MED_QUAD8    },
    00050       {MED_MAILLE,MED_TETRA4   },
    00051       {MED_MAILLE,MED_TETRA10  },
    00052       {MED_MAILLE,MED_HEXA8    },
    00053       {MED_MAILLE,MED_HEXA20   },
    00054       {MED_MAILLE,MED_PENTA6   },
    00055       {MED_MAILLE,MED_PENTA15  },
    00056       {MED_MAILLE,MED_PYRA5    },
    00057       {MED_MAILLE,MED_PYRA13   },
    00058       {MED_ARETE ,MED_SEG2     },
    00059       {MED_ARETE ,MED_SEG3     },
    00060       {MED_FACE  ,MED_TRIA3    },
    00061       {MED_FACE  ,MED_TRIA6    },
    00062       {MED_FACE  ,MED_QUAD4    },
    00063       {MED_FACE  ,MED_QUAD8    }
    00064     };
    00065
    00066   if (ind != -1) {
    00067     geo_ent_local=0;geo_ent_distant=0;
    00068     ind_type_courrant=0;
    00069     ind_type_a_trouver=ind;
    00070   }
    00071   else {
    00072     ind_type_a_trouver=ind_type_courrant+1;
    00073   }
    00074
    00075
    00076   /* recherche du type des entites en regard... passage par toutes les combinaisons */
    00077
    00078
    00079   for (;ind_type_courrant!=ind_type_a_trouver && geo_ent_local<nb_geo_ent;geo_ent_local++) {
    00080     *typ_ent_local = typ_geo_ent[geo_ent_local][0];
    00081     *typ_geo_local = typ_geo_ent[geo_ent_local][1];
    00082     geo_ent_distant=0;
    00083     for (;ind_type_courrant!=ind_type_a_trouver && geo_ent_distant<nb_geo_ent;geo_ent_distant++) {
    00084       *typ_ent_distant = typ_geo_ent[geo_ent_distant][0];
    00085       *typ_geo_distant = typ_geo_ent[geo_ent_distant][1];
    00086
    00087       if ( (nent=MEDjointnCorres(fid,maa,jn,*typ_ent_local,*typ_geo_local,
    00088                                 *typ_ent_distant,*typ_geo_distant)
    00089             ) >0 ) {
    00090         ind_type_courrant ++;
    00091       }
    00092     }
    00093   }
    00094
    00095   if (ind_type_courrant!=ind_type_a_trouver) {
    00096     MESSAGE("Can't find attended corresponding type for the given correspondence number.");
    00097     return -1;
    00098   }
    00099
    00100   return 0;
    00101
    00102 }
    00103
    00104
    00105