src/INTERPOLATION/MEDMEM_WrapperConnectivity.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00002 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00003 // 
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public
00006 // License as published by the Free Software Foundation; either 
00007 // version 2.1 of the License.
00008 // 
00009 // This library 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 GNU 
00012 // Lesser General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Lesser General Public  
00015 // License along with this library; if not, write to the Free Software 
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00017 //
00018 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00019 //
00020 #ifndef MEDMEM_WRAPPER_CONNECTIVITY_HXX
00021 #define MEDMEM_WRAPPER_CONNECTIVITY_HXX
00022 
00023 #include "MEDMEM_Connectivity.hxx"
00024 
00025 #include <vector>
00026 
00032 
00033 /*********************************************************/
00034 /*                                                       */
00035 /*               Wrapper_Med_Connectivity                */
00036 /*                                                       */
00037 /*********************************************************/
00038 
00039 // obligé de faire de la recopie car MED n'utilise pas la numérotation standart C
00040 
00041 class Wrapper_Med_Connectivity
00042 {
00043 protected :
00044      int * mailles;
00045      int nbr_mailles;
00046      vector<int> types;
00047      vector< int* > premier_pointeur;
00048      
00049 public :  
00050      ~Wrapper_Med_Connectivity() {if (mailles) delete [] mailles;}
00051      Wrapper_Med_Connectivity():mailles(NULL) {}
00052      Wrapper_Med_Connectivity(MEDMEM::CONNECTIVITY * maillesmed)
00053           {
00054           const int * tab_sommets_mailles=maillesmed->getConnectivity(MED_EN::MED_NODAL, MED_EN::MED_CELL, MED_EN::MED_ALL_ELEMENTS);
00055           const int * med_connectivite=maillesmed->getConnectivityIndex(MED_EN::MED_FULL_INTERLACE,MED_EN::MED_CELL);
00056           const int * med_index=maillesmed->getValueIndex(MED_EN::MED_FULL_INTERLACE);
00057           nbr_mailles=maillesmed->getNumberOf(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS);
00058           int size=med_index[nbr_mailles]-med_index[0];
00059           types.resize(nbr_mailles);
00060           premier_pointeur.resize(nbr_mailles);
00061           mailles=new int[size];
00062           int i;
00063           for (i=0;i<size;i++) 
00064                {
00065                mailles[i]=tab_sommets_mailles[i]-1;
00066                }
00067           for (i=0;i<nbr_mailles;i++)
00068                {
00069                types[i]=maillesmed->getElementType(MED_EN::MED_CELL,i+1); // A VERIFIER : le +1
00070                premier_pointeur[i]=&mailles[med_index[i]-1]; // A VERIFIER : la formule
00071                }
00072           }
00073      // Méthodes de la politique
00074      inline int SIZE() {return nbr_mailles;}
00075      inline int DONNE_TYPE_MAILLE(int i) {return types[i];}
00076      inline int * DONNE_PREMIER_POINTEUR(int i) {return premier_pointeur[i];}
00077 };
00078 
00079 
00080 #endif