src/INTERPOLATION/MEDMEM_InterpolationHighLevelObjects.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_INTERPOLATION_HIGHLEVEL_OBJECTS_HXX
00021 #define MEDMEM_INTERPOLATION_HIGHLEVEL_OBJECTS_HXX
00022 
00023 #include "MEDMEM_Connectivity.hxx"
00024 #include "MEDMEM_WrapperConnectivity.hxx"
00025 #include "MEDMEM_dTree.hxx"
00026 #include "MEDMEM_WrapperNodes.hxx"
00027 #include "MEDMEM_WrapperMesh.hxx"
00028 #include "MEDMEM_WrapperCells.hxx"
00029 #include "MEDMEM_Mapping.hxx"
00030 #include "MEDMEM_WrapperField.hxx"
00031 #include "MEDMEM_InterpolationTools.hxx"
00032 
00033 #define _CALCUL_HYBRIDE_ Calcul_Hybride<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>
00034 
00040 
00041 template <int DIMENSION> class Meta_Wrapper;
00042 
00043 /*********************************************************/
00044 /*                                                       */
00045 /*                    Meta_dTree                         */
00046 /*                                                       */
00047 /*********************************************************/
00048 
00049 template <int DIMENSION> class Meta_dTree : public dTree<Wrapper_Noeud<DIMENSION>,Wrapper_Nuage_Noeud<DIMENSION>,DIMENSION>
00050 {
00051 protected : 
00052      // PATCH
00053      Wrapper_Nuage_Noeud<DIMENSION> * noeuds;
00054      // FIN PATCH
00055 public :
00056      // PATCH
00057      Meta_dTree():noeuds(NULL) {}
00058      ~Meta_dTree() {if (noeuds) delete noeuds;}
00059      Meta_dTree(int nbr_noeuds,double *coord):dTree<Wrapper_Noeud<DIMENSION>,Wrapper_Nuage_Noeud<DIMENSION>,DIMENSION>(noeuds=new Wrapper_Nuage_Noeud<DIMENSION>(nbr_noeuds,coord)) {}
00060      inline int trouve_plus_proche_point_bourrin(double *node);
00061      // FIN PATCH
00062      inline int trouve_plus_proche_point(double * node);
00063 };
00064 
00065 /*********************************************************/
00066 /*                                                       */
00067 /*                 Meta_Nuage_Maille                     */
00068 /*                                                       */
00069 /*********************************************************/
00070 
00071 
00072 class Meta_Nuage_Maille : public Wrapper_Nuage_Maille<Wrapper_Med_Connectivity>
00073 {
00074 protected :
00075      Wrapper_Med_Connectivity * connectivite_med;
00076 public :
00077      Meta_Nuage_Maille(MEDMEM::CONNECTIVITY * connmed); 
00078      Meta_Nuage_Maille():connectivite_med(NULL) {}
00079      ~Meta_Nuage_Maille() {if (connectivite_med) delete connectivite_med;}
00080 };
00081 
00082 /*********************************************************/
00083 /*                                                       */
00084 /*                    Meta_Maillage                      */
00085 /*                                                       */
00086 /*********************************************************/
00087 
00088 
00089 typedef Wrapper_Maillage<Meta_Nuage_Maille> Meta_Maillage;
00090 
00091 /*********************************************************/
00092 /*                                                       */
00093 /*                    Meta_Mapping                       */
00094 /*                                                       */
00095 /*********************************************************/
00096 
00097 template <int DIMENSION> class Meta_Mapping : public Mapping<Meta_Maillage,Meta_Nuage_Maille,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,DIMENSION>
00098 {
00099 public :
00100      Meta_Mapping(Meta_Wrapper<DIMENSION> * MW):Mapping<Meta_Maillage,Meta_Nuage_Maille,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,DIMENSION>(MW->Get_Maillage(),MW->Get_Nuage_Noeuds(),NULL) {}
00101      Meta_Mapping(Meta_Wrapper<DIMENSION> * MW,Meta_Wrapper<DIMENSION> * TWB):Mapping<Meta_Maillage,Meta_Nuage_Maille,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,DIMENSION>(MW->Get_Maillage(),MW->Get_Nuage_Noeuds(),TWB->Get_Nuage_Noeuds()) {}
00102      // PATCH
00103      inline void Cree_Mapping(Meta_Wrapper<DIMENSION> * MWB, int flag_convexe) {Mapping<Meta_Maillage,Meta_Nuage_Maille,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,DIMENSION>::Cree_Mapping(MWB->Get_Nuage_Noeuds(),flag_convexe);} 
00104      inline void Cree_Mapping(int flag_convexe) {Mapping<Meta_Maillage,Meta_Nuage_Maille,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,DIMENSION>::Cree_Mapping(flag_convexe);} 
00105      inline vector<int> & Get_Mapping() {return Mapping<Meta_Maillage,Meta_Nuage_Maille,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,DIMENSION>::Get_Mapping();} 
00106      //FIN PATCH    
00107      inline int Trouve_Maille_Contenant_Noeud(double * node,int num_maille, int flag_convexe=0);
00108 };
00109 
00110 /*********************************************************/
00111 /*                                                       */
00112 /*                    Meta_Wrapper                       */
00113 /*                                                       */
00114 /*********************************************************/
00115 
00116 
00117 template <int DIMENSION> class Meta_Wrapper
00118 {
00119 protected :
00120      Wrapper_Nuage_Noeud<DIMENSION> * noeuds   ;
00121      Meta_Nuage_Maille              * mailles  ;
00122      Meta_Maillage                  * maillage ;
00123      Wrapper_MED_Field              * champ    ;
00124      
00125      void init( ){noeuds=NULL;mailles=NULL;maillage=NULL;champ=NULL;}
00126 public :
00127      Meta_Wrapper():noeuds(NULL),mailles(NULL),maillage(NULL),champ(NULL){}
00128      ~Meta_Wrapper();
00129      inline void Construit_Wrapper_Nuage_Noeud  (     int nn, double * nodes     );
00130      inline void Construit_Wrapper_Nuage_Maille (     MEDMEM::CONNECTIVITY * connmed     );
00131      inline void Construit_Wrapper_Maillage     (            void                );
00132      inline void Construit_Wrapper_Champ        ( const MEDMEM::FIELD<double> * medfield );
00133      Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, int flag_maillage=1);
00134      Meta_Wrapper(int nn,double *nodes);
00135      // defaultly, the connectivity (neighbouhood and so like) is built, 
00136      // Set flag_mesh to 0 if you don't want these informations to be built
00137      Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, const MEDMEM::FIELD<double> * c,int flag_mesh=1);
00138      // fonctions d'acces sures
00139      inline Wrapper_Nuage_Noeud<DIMENSION> * Get_Nuage_Noeuds  ( void );
00140      inline Meta_Nuage_Maille              * Get_Nuage_Mailles ( void );
00141      inline Meta_Maillage                  * Get_Maillage      ( void );
00142      inline Wrapper_MED_Field              * Get_Champ         ( void );
00143      inline void Change_Champ           ( const MEDMEM::FIELD<double> * medfield );
00144 };
00145 
00146 /*********************************************************/
00147 /*                                                       */
00148 /*           Meta_Calcul_Interpolation_Hybride           */
00149 /*                                                       */
00150 /*********************************************************/
00151 
00152 template <int DIMENSION> class Meta_Calcul_Interpolation_Hybride : public Calcul_Hybride<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>
00153 {
00154 public :
00155      Meta_Calcul_Interpolation_Hybride(Meta_Wrapper<DIMENSION> * MW):Calcul_Hybride<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(MW->Get_Nuage_Noeuds(),MW->Get_Nuage_Mailles(),MW->Get_Champ()) {}
00156      Valeur<double> operator() (Wrapper_Noeud<DIMENSION> & node, int num_maille){return Calcul_Hybride<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>::operator()(node,num_maille);}
00157      Valeur<double> operator() (double * node, int num_maille) 
00158           {
00159           static Wrapper_Noeud<DIMENSION> tmp;
00160           tmp.positionne(node);
00161           return Calcul_Hybride<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(tmp,num_maille);
00162           }
00163 };
00164 
00165 /*********************************************************/
00166 /*                                                       */
00167 /*         Meta_Calcul_Interpolation_Hybride_P1          */
00168 /*                                                       */
00169 /*********************************************************/
00170 
00171 template <int DIMENSION> class Meta_Calcul_Interpolation_Hybride_P1 : public Calcul_Hybride<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>
00172 {
00173 public :
00174      Meta_Calcul_Interpolation_Hybride_P1(Meta_Wrapper<DIMENSION> * MW)
00175           {
00176           
00177           Wrapper_Nuage_Noeud<DIMENSION> * nn = MW->Get_Nuage_Noeuds();
00178           Meta_Nuage_Maille *              nm = MW->Get_Nuage_Mailles();
00179           Wrapper_MED_Field *              c  = MW->Get_Champ();
00180           
00181           _CALCUL_HYBRIDE_::mailles=nm;
00182           
00183           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_TRIA3  ]=new Calcul_Interpolation_Tria3  <Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(nn,nm,c);
00184           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_QUAD4  ]=new Calcul_Interpolation_Quad4  <Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(nn,nm,c);
00185           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_TETRA4 ]=new Calcul_Interpolation_Tetra4 <Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(nn,nm,c);
00186           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_HEXA8  ]=new Calcul_Interpolation_Hexa8  <Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(nn,nm,c);
00187           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_PENTA6 ]=new Calcul_Interpolation_Penta6 <Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(nn,nm,c);
00188           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_PYRA5  ]=new Calcul_Interpolation_Pyra5  <Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(nn,nm,c);
00189           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_TRIA6  ]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_TRIA3  ];
00190           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_QUAD8  ]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_QUAD4  ];
00191           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_TETRA10]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_TETRA4 ];
00192           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_HEXA20 ]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_HEXA8  ];
00193           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_PENTA15]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_PENTA6 ];
00194           _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_PYRA13 ]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_PYRA5  ];
00195           }
00196      Valeur<double> operator() (Wrapper_Noeud<DIMENSION> & node, int num_maille){return Calcul_Hybride<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>::operator()(node,num_maille);}
00197      Valeur<double> operator() (double * node, int num_maille) 
00198           {
00199           static Wrapper_Noeud<DIMENSION> tmp;
00200           tmp.positionne(node);
00201           return Calcul_Hybride<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(tmp,num_maille);
00202           }
00203 };
00204 
00205 /*********************************************************/
00206 /*                                                       */
00207 /*              Meta_Calcul_Interpolation_P0             */
00208 /*                                                       */
00209 /*********************************************************/
00210 
00211 template <int DIMENSION> class Meta_Calcul_Interpolation_P0 : public Calcul_Interpolation_P0<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>
00212 {
00213 public : 
00214      Meta_Calcul_Interpolation_P0(Meta_Wrapper<DIMENSION> * MW):Calcul_Interpolation_P0<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(MW->Get_Nuage_Noeuds(),MW->Get_Nuage_Mailles(),MW->Get_Champ()) {}
00215      Valeur<double> operator() (Wrapper_Noeud<DIMENSION> & node, int num_maille){return Calcul_Interpolation_P0<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>::operator()(node,num_maille);}
00216      Valeur<double> operator() (double * node, int num_maille) 
00217           {
00218           static Wrapper_Noeud<DIMENSION> tmp;
00219           tmp.positionne(node);
00220           return Calcul_Interpolation_P0<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(tmp,num_maille);
00221           }
00222 };
00223 
00224 /*********************************************************/
00225 /*                                                       */
00226 /*                   Meta_Interpolateur                  */
00227 /*                                                       */
00228 /*********************************************************/
00229 
00230 template <class FONCTEUR, int DIMENSION> class Meta_Interpolateur
00231 {
00232 protected :
00233      FONCTEUR * fct;
00234      Meta_Mapping<DIMENSION> * mapping;
00235      Meta_Wrapper<DIMENSION> * fromWrapper;
00236 public : 
00237      Meta_Interpolateur():fct(NULL),mapping(NULL),fromWrapper(NULL) {}
00238      Meta_Interpolateur(Meta_Mapping<DIMENSION> * map, Meta_Wrapper<DIMENSION> * mw):mapping(map),fromWrapper(mw),fct(new FONCTEUR(mw)){}
00239      ~Meta_Interpolateur() {if (fct) delete fct;}
00240      Wrapper_MED_Field Perform_Interpolation(Wrapper_Nuage_Noeud<DIMENSION> * toNodes)
00241           {
00242           int i;
00243           
00244           int ni=0;
00245           int ne=0;
00246           
00247           int nbr_composantes = fromWrapper->Get_Champ()->Get_Nbr_Composantes();
00248           int nbr_valeurs     = toNodes->SIZE();
00249   
00250           double * valeurs=new double[nbr_valeurs*nbr_composantes];
00251           
00252           Wrapper_MED_Field resultat(nbr_valeurs,nbr_composantes,valeurs);
00253           
00254           int nlpp,nmc;
00255           
00256           for (i=0;i<nbr_valeurs;i++) 
00257                {
00258                //cout<<"Interpolation du noeud "<<i<<flush;
00259                nmc = (*mapping)[i];
00260                //cout<<" | mappé dans la maille "<<nmc<<flush;
00261                //cout<<" | coordonnées = "<<flush<<(*toNodes)[i]<<flush;
00262                if (nmc>=0) 
00263                     {
00264                     //cout<<" | valeurs qui va etre assignée = "<<flush<<(*fct)((*toNodes)[i],nmc)<<flush;
00265                     resultat[i]=(*fct)((*toNodes)[i],nmc);
00266                     ni++;
00267                     }
00268                else 
00269                     {
00270                     nlpp = mapping->Get_Noeud_Le_Plus_Proche(i);
00271                     //cout<<" | et dont le point le plus proche a pour numéro : "<<nlpp<<flush;
00272                     //cout<<" | valeurs qui va etre assignée = "<<(*fromWrapper->Get_Champ())[nlpp]<<flush;
00273                     if (nlpp!=UNDEFINED) 
00274                          {
00275                          resultat[i]=(*fromWrapper->Get_Champ())[nlpp];
00276                          ne++;
00277                          }
00278                     else
00279                          {
00280                          cerr<<"Meta_Interpolateur : Le noeud "<<i+1<<" n'a ni maille contenante, ni point le plus proche"<<flush;
00281                          exit(-1);
00282                          }
00283                     }
00284                //cout<<" | => OK ! "<<endl;
00285                }
00286           
00287           cout<<"Résultat de l'interpolation : "<<endl;
00288           cout<<"Nombre de noeuds intérieurs = "<<ni<<endl;
00289           cout<<"Nombre de noeuds extérieurs = "<<ne<<endl;
00290                
00291           return resultat;
00292           
00293           }
00294 };
00295 
00296 
00297 
00303 
00304 /*********************************************************/
00305 /*                                                       */
00306 /*                    Meta_dTree                         */
00307 /*                                                       */
00308 /*********************************************************/
00309 
00310 template <int DIMENSION> inline int Meta_dTree<DIMENSION>::trouve_plus_proche_point(double *node)
00311      {
00312      static Wrapper_Noeud<DIMENSION> nodetmp;
00313      nodetmp.positionne(node);
00314      return dTree<Wrapper_Noeud<DIMENSION>,Wrapper_Nuage_Noeud<DIMENSION>,DIMENSION>::trouve_plus_proche_point(Wrapper_Noeud<DIMENSION>(nodetmp));
00315      }
00316 // PATCH
00317 template <int DIMENSION> inline int Meta_dTree<DIMENSION>::trouve_plus_proche_point_bourrin(double *node)
00318      {
00319      static Wrapper_Noeud<DIMENSION> nodetmp;
00320      nodetmp.positionne(node);
00321      return dTree<Wrapper_Noeud<DIMENSION>,Wrapper_Nuage_Noeud<DIMENSION>,DIMENSION>::trouve_plus_proche_point_bourrin(Wrapper_Noeud<DIMENSION>(nodetmp));
00322      }
00323 /*********************************************************/
00324 /*                                                       */
00325 /*                 Meta_Nuage_Maille                     */
00326 /*                                                       */
00327 /*********************************************************/
00328 
00329 inline Meta_Nuage_Maille::Meta_Nuage_Maille(MEDMEM::CONNECTIVITY * conmed):Wrapper_Nuage_Maille<Wrapper_Med_Connectivity>(connectivite_med=new Wrapper_Med_Connectivity(conmed))
00330      {
00331      }
00332 
00333 /*********************************************************/
00334 /*                                                       */
00335 /*                    Meta_Mapping                       */
00336 /*                                                       */
00337 /*********************************************************/
00338 
00339 template <int DIMENSION> inline int Meta_Mapping<DIMENSION>::Trouve_Maille_Contenant_Noeud(double * node,int num_maille,int flag_convexe)
00340      {
00341      int interdit=num_maille;
00342      int max_loop=100;
00343      int nme=0;
00344      static Wrapper_Noeud<DIMENSION> nodetmp;
00345      nodetmp.positionne(node);
00346      return Mapping<Meta_Maillage,Meta_Nuage_Maille,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,DIMENSION>::Trouve_Maille_Contenant_Point_Mth_Co(nodetmp,num_maille,interdit,max_loop,nme,flag_convexe);
00347      }
00348 
00349 /*********************************************************/
00350 /*                                                       */
00351 /*                    Meta_Wrapper                       */
00352 /*                                                       */
00353 /*********************************************************/
00354 
00355 template <int DIMENSION>      Meta_Wrapper<DIMENSION>::~Meta_Wrapper()
00356      {
00357      if ( noeuds   ) delete  noeuds   ;
00358      if ( mailles  ) delete  mailles  ;
00359      if ( maillage ) delete  maillage ;
00360      if ( champ    ) delete  champ    ;
00361      }
00362 template <int DIMENSION>      inline void Meta_Wrapper<DIMENSION>::Construit_Wrapper_Nuage_Noeud  ( int nn, double * nodes )  
00363      {
00364      if (nodes) noeuds=new Wrapper_Nuage_Noeud<DIMENSION>(nn,nodes); 
00365      else
00366           {
00367           cerr<<"Meta_Wrapper : Nuage MED_FULL_INTERLACE vide passé en argument au constructeur"<<endl;
00368           exit(-1);
00369           }
00370      }
00371 template <int DIMENSION>      inline void Meta_Wrapper<DIMENSION>::Construit_Wrapper_Nuage_Maille ( MEDMEM::CONNECTIVITY * connmed )  
00372      { 
00373      if (connmed) mailles=new Meta_Nuage_Maille(connmed);              
00374      else
00375           {
00376           cerr<<"Meta_Wrapper : CONNECTIVITY vide passée en argument au constructeur"<<endl;
00377           exit(-1);
00378           }
00379      }
00380 template <int DIMENSION>      inline void Meta_Wrapper<DIMENSION>::Construit_Wrapper_Maillage     (         void           )  
00381      { 
00382      if (mailles==NULL)  
00383           {
00384           cerr<<"Meta_Wrapper : Le nuage de maille n'a pas été initialisé !"<<endl;
00385           exit(-1);
00386           }
00387      if (noeuds==NULL)   
00388           {
00389           cerr<<"Meta_Wrapper : Le nuage de noeuds n'a pas été initialisé !"<<endl;
00390           exit(-1);
00391           }
00392      maillage=new Meta_Maillage(mailles,noeuds->SIZE());
00393      }
00394 template <int DIMENSION>      inline void Meta_Wrapper<DIMENSION>::Construit_Wrapper_Champ        ( const MEDMEM::FIELD<double> * medfield )
00395      {
00396      if (medfield) champ=new Wrapper_MED_Field(medfield);
00397      else
00398           {
00399           cerr<<"Meta_Wrapper : FIELD MED vide passé en argument au constructeur"<<endl;
00400           exit(-1);
00401           }
00402      }
00403 template <int DIMENSION>      inline void Meta_Wrapper<DIMENSION>::Change_Champ           ( const MEDMEM::FIELD<double> * medfield )
00404      {
00405      if (medfield) 
00406           {
00407           if (champ) delete champ;
00408           champ=new Wrapper_MED_Field(medfield);
00409           }
00410      else
00411           {
00412           cerr<<"Meta_Wrapper : FIELD MED vide passé en argument Change_Champ"<<endl;
00413           exit(-1);
00414           }
00415      }
00416 template <int DIMENSION>      Meta_Wrapper<DIMENSION>::Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, int flag_maillage)
00417      {
00418      init();
00419      Construit_Wrapper_Nuage_Noeud(nn,nodes);
00420      Construit_Wrapper_Nuage_Maille(connmed);
00421      if (flag_maillage) Construit_Wrapper_Maillage();
00422      }
00423 template <int DIMENSION>      Meta_Wrapper<DIMENSION>::Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, const MEDMEM::FIELD<double> * c,int flag_maillage)
00424      {
00425      init();
00426      Construit_Wrapper_Nuage_Noeud(nn,nodes);
00427      Construit_Wrapper_Nuage_Maille(connmed);
00428      if (flag_maillage) Construit_Wrapper_Maillage();
00429      Construit_Wrapper_Champ(c);
00430      }
00431 template <int DIMENSION>      Meta_Wrapper<DIMENSION>::Meta_Wrapper(int nn,double *nodes)
00432      {
00433      init();
00434      Construit_Wrapper_Nuage_Noeud(nn,nodes);
00435      }              
00436 template <int DIMENSION>      inline Wrapper_Nuage_Noeud<DIMENSION> * Meta_Wrapper<DIMENSION>::Get_Nuage_Noeuds  ( void ) 
00437      {
00438      if (noeuds) return noeuds; 
00439      else
00440           {
00441           cerr<<"Meta_Wrapper : Nuage noeuds demandé alors qu'il n'est pas construit !"<<endl;
00442           exit(-1);
00443           }
00444      }
00445 template <int DIMENSION>      inline Meta_Nuage_Maille              * Meta_Wrapper<DIMENSION>::Get_Nuage_Mailles ( void ) 
00446      { 
00447      if (mailles) return mailles  ; 
00448      else
00449           {
00450           cerr<<"Meta_Wrapper : Nuage mailles demandé alors qu'il n'est pas construit !"<<endl;
00451           exit(-1);
00452           }
00453      }
00454 template <int DIMENSION>      inline Meta_Maillage                  * Meta_Wrapper<DIMENSION>::Get_Maillage      ( void ) 
00455      { 
00456      if (maillage) return maillage ; 
00457      else
00458           {
00459           cerr<<"Meta_Wrapper : Connectivitée maillage demandée alors qu'elle n'est pas construite !"<<endl;
00460           exit(-1);
00461           }
00462      }
00463 
00464 template <int DIMENSION> inline Wrapper_MED_Field              * Meta_Wrapper<DIMENSION>::Get_Champ         ( void )
00465      {
00466      if (champ) return champ;
00467      else
00468           {
00469           cerr<<"Meta_Wrapper : Champ demandé alors qu'il n'est pas construit !"<<endl;
00470           exit(-1);
00471           }
00472      }
00473 
00474 #endif