1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef MEDMEM_INTERPOLATION_HIGHLEVEL_OBJECTS_HXX
25 #define MEDMEM_INTERPOLATION_HIGHLEVEL_OBJECTS_HXX
26 #include "MEDMEM_Connectivity.hxx"
27 #include "MEDMEM_WrapperConnectivity.hxx"
28 #include "MEDMEM_dTree.hxx"
29 #include "MEDMEM_WrapperNodes.hxx"
30 #include "MEDMEM_WrapperMesh.hxx"
31 #include "MEDMEM_WrapperCells.hxx"
32 #include "MEDMEM_Mapping.hxx"
36 template <int DIMENSION> class Meta_dTree : public dTree<Wrapper_Noeud<DIMENSION>,Wrapper_Nuage_Noeud<DIMENSION>,DIMENSION>
39 Wrapper_Nuage_Noeud<DIMENSION> * nuagetmp;
41 Meta_dTree(int nn,double * fullinterlace);
42 ~Meta_dTree() {if ((etat==DTREE_RACINE)&&(nuagetmp)) delete nuagetmp;}
43 inline int trouve_plus_proche_point(double *node);
46 class Meta_Nuage_Maille : public Wrapper_Nuage_Maille<Wrapper_Med_Connectivity>
49 Wrapper_Med_Connectivity * connectivite_med;
51 Meta_Nuage_Maille(CONNECTIVITY * connmed);
52 Meta_Nuage_Maille():Wrapper_Nuage_Maille<Wrapper_Med_Connectivity>(connectivite_med=new Wrapper_Med_Connectivity) {}
53 ~Meta_Nuage_Maille() {if (connectivite_med) delete connectivite_med;}
57 typedef Wrapper_Maillage<Meta_Nuage_Maille> Meta_Maillage;
59 template <int DIMENSION> class Meta_Mapping : public Mapping<Meta_Maillage,Meta_Nuage_Maille,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,DIMENSION>
62 Wrapper_Nuage_Noeud<DIMENSION> * wrapping_nuage_source;
63 Wrapper_Nuage_Noeud<DIMENSION> * wrapping_nuage_cible;
65 Meta_Mapping(Meta_Maillage * mb,double * noeudssource,int ns,double * noeudscible,int nc);
66 ~Meta_Mapping() {if (wrapping_nuage_source) delete wrapping_nuage_source;if (wrapping_nuage_cible) delete wrapping_nuage_cible;}
67 inline int Trouve_Maille_Contenant_Noeud(double * node,int num_maille, int flag_convexe=0);
68 double donne_valeur_interpolee_P1(double * node,vector<double> vals);
73 template <int DIMENSION> Meta_dTree<DIMENSION>::Meta_dTree(int nn,double * fullinterlace)
74 :dTree<Wrapper_Noeud<DIMENSION>,Wrapper_Nuage_Noeud<DIMENSION>,DIMENSION>
75 (nuagetmp=new Wrapper_Nuage_Noeud<DIMENSION>(nn,fullinterlace))
79 template <int DIMENSION> inline int Meta_dTree<DIMENSION>::trouve_plus_proche_point(double *node)
81 static Wrapper_Noeud<DIMENSION> nodetmp;
82 nodetmp.positionne(node);
83 return dTree<Wrapper_Noeud<DIMENSION>,Wrapper_Nuage_Noeud<DIMENSION>,DIMENSION>::trouve_plus_proche_point(Wrapper_Noeud<DIMENSION>(nodetmp));
87 Meta_Nuage_Maille::Meta_Nuage_Maille(CONNECTIVITY * conmed):Wrapper_Nuage_Maille<Wrapper_Med_Connectivity>(connectivite_med=new Wrapper_Med_Connectivity(conmed))
92 template <int DIMENSION> Meta_Mapping<DIMENSION>::Meta_Mapping(Meta_Maillage * mb,double * noeudssource,int ns,double * noeudscible,int nc)
93 :Mapping<Meta_Maillage,Meta_Nuage_Maille,Wrapper_Nuage_Noeud<DIMENSION>,Wrapper_Noeud<DIMENSION>,DIMENSION>
95 wrapping_nuage_source=new Wrapper_Nuage_Noeud<DIMENSION>(ns,noeudssource),
96 wrapping_nuage_cible=new Wrapper_Nuage_Noeud<DIMENSION>(nc,noeudscible))
100 template <int DIMENSION> inline int Meta_Mapping<DIMENSION>::Trouve_Maille_Contenant_Noeud(double * node,int num_maille,int flag_convexe)
102 int interdit=num_maille;
105 static Wrapper_Noeud<DIMENSION> nodetmp;
106 nodetmp.positionne(node);
107 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);
109 template <int DIMENSION> double Meta_Mapping<DIMENSION>::donne_valeur_interpolee_P1(double * node,vector<double> vals)
111 int num_maille_contenant=Trouve_Maille_Contenant_Noeud(node,0);
112 double valeur_interpol=0;
113 vector<double> valeurs=CB->Calcule_Coord_Baryc(num_maille_contenant,node);
116 for (i=0;i<valeurs.size();i++)
118 cout<<"Lambda(M):"<<i<<" = "<<valeurs[i]<<endl;
119 num_som=mailles_back->DONNE_SOMMET_MAILLE(num_maille_contenant,i);
120 valeur_interpol+=vals[num_som]*valeurs[i];
123 return valeur_interpol;