]> SALOME platform Git repositories - modules/med.git/blob - src/INTERPOLATION/test_MEDMEM_InterpolationSansRecopieMaillage.cxx
Salome HOME
updating the main trunk with the CEA debug devellopment from the branch
[modules/med.git] / src / INTERPOLATION / test_MEDMEM_InterpolationSansRecopieMaillage.cxx
1 #include "MEDMEM_Exception.hxx"
2 #include "MEDMEM_define.hxx"
3
4 #include "MEDMEM_Med.hxx"
5 #include "MEDMEM_Field.hxx"
6 #include "MEDMEM_Mesh.hxx"
7 #include "MEDMEM_Interpolation.hxx"
8
9 #include <deque>
10
11 #include "stdio.h"
12
13 #ifdef _DEBUG_
14 #include "LocalTraceCollector.hxx"
15 #endif /* ifdef _DEBUG_*/
16
17 using namespace MEDMEM;
18 using namespace MED_EN;
19
20 main () {
21 #ifdef _DEBUG_
22   LocalTraceCollector::instance();
23 #endif /* ifdef _DEBUG_*/
24
25   const char * fromFileName   = "ResultatSyrthes.med";
26   const char * toFileName     = "MaillageAster.med";
27 //  const char * resultFileName = "ResultatInterpolation.med";
28
29   const char * fromFieldName  = "THERDEP_TEMP____________________";
30
31   const char * fromMeshName   = "MA";
32   const char * toMeshName     = "MAILLAGE_IDEAS";
33
34   try {
35     
36     string flag="================[MAIN MESSAGES]================> ";
37     
38     cout<<flag<<"Lecture de la structure MED               : "<<flush; MED             fromMED     (MED_DRIVER,fromFileName)                                   ; cout<<"OK !"<<endl;
39     
40     // Utilisation completement débile, on ne devrait pas avoir a faire l'appel suivant
41     fromMED.updateSupport();
42
43     cout<<flag<<"Lecture du Maillage Source                : "<<flush; MESH            fromMesh    (MED_DRIVER,fromFileName,fromMeshName)                      ; cout<<"OK !"<<endl;
44     cout<<flag<<"Lecture du Mailllage Cible                : "<<flush; MESH            toMesh      (MED_DRIVER,toFileName,toMeshName)                          ; cout<<"OK !"<<endl;
45     cout<<flag<<"Lecture des pas de temps                  : "<<flush; deque<DT_IT_> pasDeTemps=fromMED.getFieldIteration (fromFieldName)                      ; cout<<"OK !"<<endl;
46     cout<<flag<<"Lecture du FIELD_ au premier pas de temps : "<<flush; FIELD_ * fromField_ = fromMED.getField(fromFieldName,pasDeTemps[0].dt,pasDeTemps[0].it) ; cout<<"OK !"<<endl;
47     cout<<flag<<"Transtypage en FIELD                      : "<<flush; FIELD<double> * fromField = dynamic_cast<FIELD<double> *>(fromField_)                   ; cout<<"OK !"<<endl;
48
49     // Utilisation completement débile, on ne devrait pas avoir a faire l'appel suivant
50     fromField->getSupport()->getMesh()->read();
51         
52     cout<<flag<<"Lecture des valeurs du FIELD              : "<<flush; fromField->read()                                                                       ; cout<<"OK !"<<endl;   
53     cout<<flag<<"Préparation de l'interpolation            : "<<flush; INTERPOLATION<3> myInter (*fromField,toMesh)                                            ; cout<<"OK !"<<endl;            
54     cout<<flag<<"Interpolation effective                   : "<<flush; FIELD<double>   * toField = myInter.interpolate(1,1)                                    ; cout<<"OK !"<<endl;    
55     cout<<flag<<"Creation du driver d'écriture             : "<<flush; toField->addDriver(MED_DRIVER,toFileName,toField->getName())                            ; cout<<"OK !"<<endl;
56 //    cout<<flag<<"Creation du driver d'écriture Field       : "<<flush; toField->addDriver(MED_DRIVER,resultFileName,toField->getName())                        ; cout<<"OK !"<<endl;
57     cout<<flag<<"Ecriture du Field résultat                : "<<flush; toField->write()                                                                        ; cout<<"OK !"<<endl;
58 //    cout<<flag<<"Creation du driver d'écriture Mesh        : "<<flush; toMesh.addDriver(MED_DRIVER,resultFileName,toMesh.getName())                            ; cout<<"OK !"<<endl;
59 //    cout<<flag<<"Ecriture du Mesh résultat                 : "<<flush; toMesh.write(1)                                                                         ; cout<<"OK !"<<endl;
60
61   } catch (MEDEXCEPTION& ex){
62     MESSAGE(ex.what()) ;
63   }
64 }