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"
14 #include "LocalTraceCollector.hxx"
15 #endif /* ifdef _DEBUG_*/
17 using namespace MEDMEM;
18 using namespace MED_EN;
22 LocalTraceCollector::instance();
23 #endif /* ifdef _DEBUG_*/
25 const char * fromFileName = "ResultatSyrthes.med";
26 const char * toFileName = "MaillageAster.med";
27 // const char * resultFileName = "ResultatInterpolation.med";
29 const char * fromFieldName = "THERDEP_TEMP____________________";
31 const char * fromMeshName = "MA";
32 const char * toMeshName = "MAILLAGE_IDEAS";
36 string flag="================[MAIN MESSAGES]================> ";
38 cout<<flag<<"Lecture de la structure MED : "<<flush; MED fromMED (MED_DRIVER,fromFileName) ; cout<<"OK !"<<endl;
40 // Utilisation completement débile, on ne devrait pas avoir a faire l'appel suivant
41 fromMED.updateSupport();
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;
49 // Utilisation completement débile, on ne devrait pas avoir a faire l'appel suivant
50 fromField->getSupport()->getMesh()->read();
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;
61 } catch (MEDEXCEPTION& ex){