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