Salome HOME
b816efe928cc8667db85de84717d853c0de47f01
[modules/med.git] / src / INTERPOLATION / MEDMEM_InterpolationHighLevelObjects.hxx
1 #ifndef MEDMEM_INTERPOLATION_HIGHLEVEL_OBJECTS_HXX
2 #define MEDMEM_INTERPOLATION_HIGHLEVEL_OBJECTS_HXX
3
4 #include "MEDMEM_Connectivity.hxx"
5 #include "MEDMEM_WrapperConnectivity.hxx"
6 #include "MEDMEM_dTree.hxx"
7 #include "MEDMEM_WrapperNodes.hxx"
8 #include "MEDMEM_WrapperMesh.hxx"
9 #include "MEDMEM_WrapperCells.hxx"
10 #include "MEDMEM_Mapping.hxx"
11 #include "MEDMEM_WrapperField.hxx"
12 #include "MEDMEM_InterpolationTools.hxx"
13
14 #define _CALCUL_HYBRIDE_ Calcul_Hybride<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>
15
16 //////////////////////////////////////////////////////////////////
17 ///                                                            ///
18 ///                        DECLARATIONS                        ///
19 ///                                                            ///
20 //////////////////////////////////////////////////////////////////
21
22 template <int DIMENSION> class Meta_Wrapper;
23
24 /*********************************************************/
25 /*                                                       */
26 /*                    Meta_dTree                         */
27 /*                                                       */
28 /*********************************************************/
29
30 template <int DIMENSION> class Meta_dTree : public dTree<Wrapper_Noeud<DIMENSION>,Wrapper_Nuage_Noeud<DIMENSION>,DIMENSION>
31 {
32 protected : 
33         // PATCH
34         Wrapper_Nuage_Noeud<DIMENSION> * noeuds;
35         // FIN PATCH
36 public :
37         // PATCH
38         Meta_dTree():noeuds(NULL) {}
39         ~Meta_dTree() {if (noeuds) delete noeuds;}
40         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)) {}
41         inline int trouve_plus_proche_point_bourrin(double *node);
42         // FIN PATCH
43         inline int trouve_plus_proche_point(double * node);
44 };
45
46 /*********************************************************/
47 /*                                                       */
48 /*                 Meta_Nuage_Maille                     */
49 /*                                                       */
50 /*********************************************************/
51
52
53 class Meta_Nuage_Maille : public Wrapper_Nuage_Maille<Wrapper_Med_Connectivity>
54 {
55 protected :
56         Wrapper_Med_Connectivity * connectivite_med;
57 public :
58         Meta_Nuage_Maille(MEDMEM::CONNECTIVITY * connmed); 
59         Meta_Nuage_Maille():connectivite_med(NULL) {}
60         ~Meta_Nuage_Maille() {if (connectivite_med) delete connectivite_med;}
61 };
62
63 /*********************************************************/
64 /*                                                       */
65 /*                    Meta_Maillage                      */
66 /*                                                       */
67 /*********************************************************/
68
69
70 typedef Wrapper_Maillage<Meta_Nuage_Maille> Meta_Maillage;
71
72 /*********************************************************/
73 /*                                                       */
74 /*                    Meta_Mapping                       */
75 /*                                                       */
76 /*********************************************************/
77
78 template <int DIMENSION> class Meta_Mapping : public Mapping<Meta_Maillage,Meta_Nuage_Maille,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,DIMENSION>
79 {
80 public :
81         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) {}
82         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()) {}
83         // PATCH
84         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);} 
85         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);} 
86         inline vector<int> & Get_Mapping() {return Mapping<Meta_Maillage,Meta_Nuage_Maille,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,DIMENSION>::Get_Mapping();} 
87         //FIN PATCH     
88         inline int Trouve_Maille_Contenant_Noeud(double * node,int num_maille, int flag_convexe=0);
89 };
90
91 /*********************************************************/
92 /*                                                       */
93 /*                    Meta_Wrapper                       */
94 /*                                                       */
95 /*********************************************************/
96
97
98 template <int DIMENSION> class Meta_Wrapper
99 {
100 protected :
101         Wrapper_Nuage_Noeud<DIMENSION> * noeuds   ;
102         Meta_Nuage_Maille              * mailles  ;
103         Meta_Maillage                  * maillage ;
104         Wrapper_MED_Field              * champ    ;
105         
106         void init( ){noeuds=NULL;mailles=NULL;maillage=NULL;champ=NULL;}
107 public :
108         Meta_Wrapper():noeuds(NULL),mailles(NULL),maillage(NULL),champ(NULL){}
109         ~Meta_Wrapper();
110         inline void Construit_Wrapper_Nuage_Noeud  (     int nn, double * nodes     );
111         inline void Construit_Wrapper_Nuage_Maille (     MEDMEM::CONNECTIVITY * connmed     );
112         inline void Construit_Wrapper_Maillage     (            void                );
113         inline void Construit_Wrapper_Champ        ( const MEDMEM::FIELD<double> * medfield );
114         Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, int flag_maillage=1);
115         Meta_Wrapper(int nn,double *nodes);
116         // defaultly, the connectivity (neighbouhood and so like) is built, 
117         // Set flag_mesh to 0 if you don't want these informations to be built
118         Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, const MEDMEM::FIELD<double> * c,int flag_mesh=1);
119         // fonctions d'acces sures
120         inline Wrapper_Nuage_Noeud<DIMENSION> * Get_Nuage_Noeuds  ( void );
121         inline Meta_Nuage_Maille              * Get_Nuage_Mailles ( void );
122         inline Meta_Maillage                  * Get_Maillage      ( void );
123         inline Wrapper_MED_Field              * Get_Champ         ( void );
124         inline void Change_Champ           ( const MEDMEM::FIELD<double> * medfield );
125 };
126
127 /*********************************************************/
128 /*                                                       */
129 /*           Meta_Calcul_Interpolation_Hybride           */
130 /*                                                       */
131 /*********************************************************/
132
133 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>
134 {
135 public :
136         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()) {}
137         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);}
138         Valeur<double> operator() (double * node, int num_maille) 
139                 {
140                 static Wrapper_Noeud<DIMENSION> tmp;
141                 tmp.positionne(node);
142                 return Calcul_Hybride<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(tmp,num_maille);
143                 }
144 };
145
146 /*********************************************************/
147 /*                                                       */
148 /*         Meta_Calcul_Interpolation_Hybride_P1          */
149 /*                                                       */
150 /*********************************************************/
151
152 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>
153 {
154 public :
155         Meta_Calcul_Interpolation_Hybride_P1(Meta_Wrapper<DIMENSION> * MW)
156                 {
157                 
158                 Wrapper_Nuage_Noeud<DIMENSION> * nn = MW->Get_Nuage_Noeuds();
159                 Meta_Nuage_Maille *              nm = MW->Get_Nuage_Mailles();
160                 Wrapper_MED_Field *              c  = MW->Get_Champ();
161                 
162                 _CALCUL_HYBRIDE_::mailles=nm;
163                 
164                 _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);
165                 _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);
166                 _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);
167                 _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);
168                 _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);
169                 _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);
170                 _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_TRIA6  ]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_TRIA3  ];
171                 _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_QUAD8  ]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_QUAD4  ];
172                 _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_TETRA10]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_TETRA4 ];
173                 _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_HEXA20 ]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_HEXA8  ];
174                 _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_PENTA15]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_PENTA6 ];
175                 _CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_PYRA13 ]=_CALCUL_HYBRIDE_::fonctions[ MED_EN::MED_PYRA5  ];
176                 }
177         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);}
178         Valeur<double> operator() (double * node, int num_maille) 
179                 {
180                 static Wrapper_Noeud<DIMENSION> tmp;
181                 tmp.positionne(node);
182                 return Calcul_Hybride<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(tmp,num_maille);
183                 }
184 };
185
186 /*********************************************************/
187 /*                                                       */
188 /*              Meta_Calcul_Interpolation_P0             */
189 /*                                                       */
190 /*********************************************************/
191
192 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>
193 {
194 public : 
195         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()) {}
196         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);}
197         Valeur<double> operator() (double * node, int num_maille) 
198                 {
199                 static Wrapper_Noeud<DIMENSION> tmp;
200                 tmp.positionne(node);
201                 return Calcul_Interpolation_P0<Wrapper_MED_Field,Valeur<double>,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,Meta_Nuage_Maille>(tmp,num_maille);
202                 }
203 };
204
205 /*********************************************************/
206 /*                                                       */
207 /*                   Meta_Interpolateur                  */
208 /*                                                       */
209 /*********************************************************/
210
211 template <class FONCTEUR, int DIMENSION> class Meta_Interpolateur
212 {
213 protected :
214         FONCTEUR * fct;
215         Meta_Mapping<DIMENSION> * mapping;
216         Meta_Wrapper<DIMENSION> * fromWrapper;
217 public : 
218         Meta_Interpolateur():fct(NULL),mapping(NULL),fromWrapper(NULL) {}
219         Meta_Interpolateur(Meta_Mapping<DIMENSION> * map, Meta_Wrapper<DIMENSION> * mw):mapping(map),fromWrapper(mw),fct(new FONCTEUR(mw)){}
220         ~Meta_Interpolateur() {if (fct) delete fct;}
221         Wrapper_MED_Field Perform_Interpolation(Wrapper_Nuage_Noeud<DIMENSION> * toNodes)
222                 {
223                 int i;
224                 
225                 int ni=0;
226                 int ne=0;
227                 
228                 int nbr_composantes = fromWrapper->Get_Champ()->Get_Nbr_Composantes();
229                 int nbr_valeurs     = toNodes->SIZE();
230   
231                 double * valeurs=new double[nbr_valeurs*nbr_composantes];
232                 
233                 Wrapper_MED_Field resultat(nbr_valeurs,nbr_composantes,valeurs);
234                 
235                 int nlpp,nmc;
236                 
237                 for (i=0;i<nbr_valeurs;i++) 
238                         {
239                         //cout<<"Interpolation du noeud "<<i<<flush;
240                         nmc = (*mapping)[i];
241                         //cout<<" | mappé dans la maille "<<nmc<<flush;
242                         //cout<<" | coordonnées = "<<flush<<(*toNodes)[i]<<flush;
243                         if (nmc>=0) 
244                                 {
245                                 //cout<<" | valeurs qui va etre assignée = "<<flush<<(*fct)((*toNodes)[i],nmc)<<flush;
246                                 resultat[i]=(*fct)((*toNodes)[i],nmc);
247                                 ni++;
248                                 }
249                         else 
250                                 {
251                                 nlpp = mapping->Get_Noeud_Le_Plus_Proche(i);
252                                 //cout<<" | et dont le point le plus proche a pour numéro : "<<nlpp<<flush;
253                                 //cout<<" | valeurs qui va etre assignée = "<<(*fromWrapper->Get_Champ())[nlpp]<<flush;
254                                 if (nlpp!=UNDEFINED) 
255                                         {
256                                         resultat[i]=(*fromWrapper->Get_Champ())[nlpp];
257                                         ne++;
258                                         }
259                                 else
260                                         {
261                                         cerr<<"Meta_Interpolateur : Le noeud "<<i+1<<" n'a ni maille contenante, ni point le plus proche"<<flush;
262                                         exit(-1);
263                                         }
264                                 }
265                         //cout<<" | => OK ! "<<endl;
266                         }
267                 
268                 cout<<"Résultat de l'interpolation : "<<endl;
269                 cout<<"Nombre de noeuds intérieurs = "<<ni<<endl;
270                 cout<<"Nombre de noeuds extérieurs = "<<ne<<endl;
271                         
272                 return resultat;
273                 
274                 }
275 };
276
277
278
279 //////////////////////////////////////////////////////////////////
280 ///                                                            ///
281 ///                            CODE                            ///
282 ///                                                            ///
283 //////////////////////////////////////////////////////////////////
284
285 /*********************************************************/
286 /*                                                       */
287 /*                    Meta_dTree                         */
288 /*                                                       */
289 /*********************************************************/
290
291 template <int DIMENSION> inline int Meta_dTree<DIMENSION>::trouve_plus_proche_point(double *node)
292         {
293         static Wrapper_Noeud<DIMENSION> nodetmp;
294         nodetmp.positionne(node);
295         return dTree<Wrapper_Noeud<DIMENSION>,Wrapper_Nuage_Noeud<DIMENSION>,DIMENSION>::trouve_plus_proche_point(Wrapper_Noeud<DIMENSION>(nodetmp));
296         }
297 // PATCH
298 template <int DIMENSION> inline int Meta_dTree<DIMENSION>::trouve_plus_proche_point_bourrin(double *node)
299         {
300         static Wrapper_Noeud<DIMENSION> nodetmp;
301         nodetmp.positionne(node);
302         return dTree<Wrapper_Noeud<DIMENSION>,Wrapper_Nuage_Noeud<DIMENSION>,DIMENSION>::trouve_plus_proche_point_bourrin(Wrapper_Noeud<DIMENSION>(nodetmp));
303         }
304 /*********************************************************/
305 /*                                                       */
306 /*                 Meta_Nuage_Maille                     */
307 /*                                                       */
308 /*********************************************************/
309
310 inline Meta_Nuage_Maille::Meta_Nuage_Maille(MEDMEM::CONNECTIVITY * conmed):Wrapper_Nuage_Maille<Wrapper_Med_Connectivity>(connectivite_med=new Wrapper_Med_Connectivity(conmed))
311         {
312         }
313
314 /*********************************************************/
315 /*                                                       */
316 /*                    Meta_Mapping                       */
317 /*                                                       */
318 /*********************************************************/
319
320 template <int DIMENSION> inline int Meta_Mapping<DIMENSION>::Trouve_Maille_Contenant_Noeud(double * node,int num_maille,int flag_convexe)
321         {
322         int interdit=num_maille;
323         int max_loop=100;
324         int nme=0;
325         static Wrapper_Noeud<DIMENSION> nodetmp;
326         nodetmp.positionne(node);
327         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);
328         }
329
330 /*********************************************************/
331 /*                                                       */
332 /*                    Meta_Wrapper                       */
333 /*                                                       */
334 /*********************************************************/
335
336 template <int DIMENSION>        Meta_Wrapper<DIMENSION>::~Meta_Wrapper()
337         {
338         if ( noeuds   ) delete  noeuds   ;
339         if ( mailles  ) delete  mailles  ;
340         if ( maillage ) delete  maillage ;
341         if ( champ    ) delete  champ    ;
342         }
343 template <int DIMENSION>        inline void Meta_Wrapper<DIMENSION>::Construit_Wrapper_Nuage_Noeud  ( int nn, double * nodes )  
344         {
345         if (nodes) noeuds=new Wrapper_Nuage_Noeud<DIMENSION>(nn,nodes); 
346         else
347                 {
348                 cerr<<"Meta_Wrapper : Nuage MED_FULL_INTERLACE vide passé en argument au constructeur"<<endl;
349                 exit(-1);
350                 }
351         }
352 template <int DIMENSION>        inline void Meta_Wrapper<DIMENSION>::Construit_Wrapper_Nuage_Maille ( MEDMEM::CONNECTIVITY * connmed )  
353         { 
354         if (connmed) mailles=new Meta_Nuage_Maille(connmed);              
355         else
356                 {
357                 cerr<<"Meta_Wrapper : CONNECTIVITY vide passée en argument au constructeur"<<endl;
358                 exit(-1);
359                 }
360         }
361 template <int DIMENSION>        inline void Meta_Wrapper<DIMENSION>::Construit_Wrapper_Maillage     (         void           )  
362         { 
363         if (mailles==NULL)      
364                 {
365                 cerr<<"Meta_Wrapper : Le nuage de maille n'a pas été initialisé !"<<endl;
366                 exit(-1);
367                 }
368         if (noeuds==NULL)       
369                 {
370                 cerr<<"Meta_Wrapper : Le nuage de noeuds n'a pas été initialisé !"<<endl;
371                 exit(-1);
372                 }
373         maillage=new Meta_Maillage(mailles,noeuds->SIZE());
374         }
375 template <int DIMENSION>        inline void Meta_Wrapper<DIMENSION>::Construit_Wrapper_Champ        ( const MEDMEM::FIELD<double> * medfield )
376         {
377         if (medfield) champ=new Wrapper_MED_Field(medfield);
378         else
379                 {
380                 cerr<<"Meta_Wrapper : FIELD MED vide passé en argument au constructeur"<<endl;
381                 exit(-1);
382                 }
383         }
384 template <int DIMENSION>        inline void Meta_Wrapper<DIMENSION>::Change_Champ           ( const MEDMEM::FIELD<double> * medfield )
385         {
386         if (medfield) 
387                 {
388                 if (champ) delete champ;
389                 champ=new Wrapper_MED_Field(medfield);
390                 }
391         else
392                 {
393                 cerr<<"Meta_Wrapper : FIELD MED vide passé en argument Change_Champ"<<endl;
394                 exit(-1);
395                 }
396         }
397 template <int DIMENSION>        Meta_Wrapper<DIMENSION>::Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, int flag_maillage)
398         {
399         init();
400         Construit_Wrapper_Nuage_Noeud(nn,nodes);
401         Construit_Wrapper_Nuage_Maille(connmed);
402         if (flag_maillage) Construit_Wrapper_Maillage();
403         }
404 template <int DIMENSION>        Meta_Wrapper<DIMENSION>::Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, const MEDMEM::FIELD<double> * c,int flag_maillage)
405         {
406         init();
407         Construit_Wrapper_Nuage_Noeud(nn,nodes);
408         Construit_Wrapper_Nuage_Maille(connmed);
409         if (flag_maillage) Construit_Wrapper_Maillage();
410         Construit_Wrapper_Champ(c);
411         }
412 template <int DIMENSION>        Meta_Wrapper<DIMENSION>::Meta_Wrapper(int nn,double *nodes)
413         {
414         init();
415         Construit_Wrapper_Nuage_Noeud(nn,nodes);
416         }                       
417 template <int DIMENSION>        inline Wrapper_Nuage_Noeud<DIMENSION> * Meta_Wrapper<DIMENSION>::Get_Nuage_Noeuds  ( void ) 
418         {
419         if (noeuds) return noeuds; 
420         else
421                 {
422                 cerr<<"Meta_Wrapper : Nuage noeuds demandé alors qu'il n'est pas construit !"<<endl;
423                 exit(-1);
424                 }
425         }
426 template <int DIMENSION>        inline Meta_Nuage_Maille              * Meta_Wrapper<DIMENSION>::Get_Nuage_Mailles ( void ) 
427         { 
428         if (mailles) return mailles  ; 
429         else
430                 {
431                 cerr<<"Meta_Wrapper : Nuage mailles demandé alors qu'il n'est pas construit !"<<endl;
432                 exit(-1);
433                 }
434         }
435 template <int DIMENSION>        inline Meta_Maillage                  * Meta_Wrapper<DIMENSION>::Get_Maillage      ( void ) 
436         { 
437         if (maillage) return maillage ; 
438         else
439                 {
440                 cerr<<"Meta_Wrapper : Connectivitée maillage demandée alors qu'elle n'est pas construite !"<<endl;
441                 exit(-1);
442                 }
443         }
444
445 template <int DIMENSION>        inline Wrapper_MED_Field              * Meta_Wrapper<DIMENSION>::Get_Champ         ( void )
446         {
447         if (champ) return champ;
448         else
449                 {
450                 cerr<<"Meta_Wrapper : Champ demandé alors qu'il n'est pas construit !"<<endl;
451                 exit(-1);
452                 }
453         }
454
455 #endif