1 #include "MEDMEM_Exception.hxx"
2 #include "MEDMEM_define.hxx"
4 #include "MEDMEM_Med.hxx"
5 #include "MEDMEM_Field.hxx"
6 #include "MEDMEM_Mesh.hxx"
7 #include "MEDMEM_Interpolation.hxx"
15 const char * fromFileName = "ResultatSyrthes.med";
16 const char * toFileName = "MaillageAster.med";
17 // const char * resultFileName = "ResultatInterpolation.med";
19 const char * fromFieldName = "THERDEP_TEMP____________________";
21 const char * fromMeshName = "MA";
22 const char * toMeshName = "MAILLAGE_IDEAS";
26 string flag="================[MAIN MESSAGES]================> ";
28 cout<<flag<<"Lecture de la structure MED : "<<flush; MED fromMED (MED_DRIVER,fromFileName) ; cout<<"OK !"<<endl;
30 // Utilisation completement débile, on ne devrait pas avoir a faire l'appel suivant
31 fromMED.updateSupport();
33 cout<<flag<<"Lecture du Maillage Source : "<<flush; MESH fromMesh (MED_DRIVER,fromFileName,fromMeshName) ; cout<<"OK !"<<endl;
34 cout<<flag<<"Lecture du Mailllage Cible : "<<flush; MESH toMesh (MED_DRIVER,toFileName,toMeshName) ; cout<<"OK !"<<endl;
35 cout<<flag<<"Lecture des pas de temps : "<<flush; deque<DT_IT_> pasDeTemps=fromMED.getFieldIteration (fromFieldName) ; cout<<"OK !"<<endl;
36 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;
37 cout<<flag<<"Transtypage en FIELD : "<<flush; FIELD<double> * fromField = dynamic_cast<FIELD<double> *>(fromField_) ; cout<<"OK !"<<endl;
39 // Utilisation completement débile, on ne devrait pas avoir a faire l'appel suivant
40 fromField->getSupport()->getMesh()->read();
42 cout<<flag<<"Lecture des valeurs du FIELD : "<<flush; fromField->read() ; cout<<"OK !"<<endl;
43 cout<<flag<<"Préparation de l'interpolation : "<<flush; INTERPOLATION<3> myInter (*fromField,toMesh) ; cout<<"OK !"<<endl;
44 cout<<flag<<"Interpolation effective : "<<flush; FIELD<double> * toField = myInter.interpolate(1,1) ; cout<<"OK !"<<endl;
45 cout<<flag<<"Creation du driver d'écriture : "<<flush; toField->addDriver(MED_DRIVER,toFileName,toField->getName()) ; cout<<"OK !"<<endl;
46 // cout<<flag<<"Creation du driver d'écriture Field : "<<flush; toField->addDriver(MED_DRIVER,resultFileName,toField->getName()) ; cout<<"OK !"<<endl;
47 cout<<flag<<"Ecriture du Field résultat : "<<flush; toField->write() ; cout<<"OK !"<<endl;
48 // cout<<flag<<"Creation du driver d'écriture Mesh : "<<flush; toMesh.addDriver(MED_DRIVER,resultFileName,toMesh.getName()) ; cout<<"OK !"<<endl;
49 // cout<<flag<<"Ecriture du Mesh résultat : "<<flush; toMesh.write(1) ; cout<<"OK !"<<endl;
51 } catch (MEDEXCEPTION& ex){