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;
20 // pour gestion timings
23 #define RUN(procedure) {double t0,t1;cout<<"# =============> TEMPS D'EXECUTION A PARTIR D'ICI "<<endl<<#procedure<<endl;t0=CPUtime();procedure;t1=CPUtime();cout<<"# ================> TEMPS D'EXECUTION : "<<t1-t0<<endl;}
24 #define TIMORIZE(procedure,t) {double t0,t1;t0=CPUtime();procedure;t1=CPUtime();t=t1-t0;}
31 return ((double)buf.tms_utime+(double)buf.tms_stime)/(long) sysconf(_SC_CLK_TCK);
34 return ((double) clock())/CLOCKS_PER_SEC;
39 #include "MEDMEM_WrapperCells.hxx"
43 LocalTraceCollector::instance();
44 #endif /* ifdef _DEBUG_*/
48 int * liste = new int [taille] ;
51 for (i=0;i<taille;i++) liste[i]=i;
53 Wrapper_Maille_Tria3 Tria3 ;Tria3 .positionne(liste);cout<<"Tria3 "<<endl;Tria3 .export_connectivite();
54 Wrapper_Maille_Tria6 Tria6 ;Tria6 .positionne(liste);cout<<"Tria6 "<<endl;Tria6 .export_connectivite();
55 Wrapper_Maille_Quad4 Quad4 ;Quad4 .positionne(liste);cout<<"Quad4 "<<endl;Quad4 .export_connectivite();
56 Wrapper_Maille_Quad8 Quad8 ;Quad8 .positionne(liste);cout<<"Quad8 "<<endl;Quad8 .export_connectivite();
57 Wrapper_Maille_Tetra4 Tetra4 ;Tetra4 .positionne(liste);cout<<"Tetra4 "<<endl;Tetra4 .export_connectivite();
58 Wrapper_Maille_Tetra10 Tetra10;Tetra10.positionne(liste);cout<<"Tetra10"<<endl;Tetra10.export_connectivite();
59 Wrapper_Maille_Hexa8 Hexa8 ;Hexa8 .positionne(liste);cout<<"Hexa8 "<<endl;Hexa8 .export_connectivite();
60 Wrapper_Maille_Hexa20 Hexa20 ;Hexa20 .positionne(liste);cout<<"Hexa20 "<<endl;Hexa20 .export_connectivite();
61 Wrapper_Maille_Pyra5 Pyra5 ;Pyra5 .positionne(liste);cout<<"Pyra5 "<<endl;Pyra5 .export_connectivite();
62 Wrapper_Maille_Pyra13 Pyra13 ;Pyra13 .positionne(liste);cout<<"Pyra13 "<<endl;Pyra13 .export_connectivite();
63 Wrapper_Maille_Penta6 Penta6 ;Penta6 .positionne(liste);cout<<"Penta6 "<<endl;Penta6 .export_connectivite();
64 Wrapper_Maille_Penta15 Penta15;Penta15.positionne(liste);cout<<"Penta15"<<endl;Penta15.export_connectivite();
68 const char * fromFileName = "ResultatSyrthes.med";
69 const char * toFileName = "MaillageAster.med";
70 const char * resultFileName = "ResultatInterpolation.med";
72 const char * fromFieldName = "THERDEP_TEMP____________________";
74 const char * fromMeshName = "MA";
75 const char * toMeshName = "MAILLAGE_IDEAS";
80 string flag="================[MAIN MESSAGES]================> ";
82 cout<<flag<<"Lecture de la structure MED : "<<flush;
83 MED fromMED (MED_DRIVER,fromFileName);
86 // Utilisation completement débile, on ne devrait pas avoir a faire l'appel suivant
87 fromMED.updateSupport();
89 cout<<flag<<"Lecture du Mailllage Cible : "<<flush;
90 MESH toMesh (MED_DRIVER,toFileName,toMeshName);
93 cout<<flag<<"Lecture des pas de temps : "<<flush;
94 deque<DT_IT_> pasDeTemps=fromMED.getFieldIteration (fromFieldName);
97 deque<DT_IT_>::const_iterator currentStep;
99 INTERPOLATION<3> * myInter ;
100 FIELD<double> * toField ;
101 int flagNewMapping = 1;
103 for (currentStep=pasDeTemps.begin();currentStep!=pasDeTemps.end();currentStep++)
105 cout<<flag<<"Traitement du Step ( "<<flush<<(*currentStep).dt<<" ; "<<(*currentStep).it<<" ) : "<<endl;
107 cout<<flag<<"Lecture du FIELD_ "<<flush;
108 FIELD_ * fromField_ = fromMED.getField(fromFieldName,(*currentStep).dt,(*currentStep).it);
111 cout<<flag<<"Transtypage en FIELD : "<<flush;
112 FIELD<double> * fromField = dynamic_cast<FIELD<double> *>(fromField_);
115 if (currentStep==pasDeTemps.begin())
117 //Utilisation completement débile, on ne devrait pas avoir a faire l'appel suivant
118 RUN(fromField->getSupport()->getMesh()->read());
121 cout<<flag<<"Lecture des valeurs du FIELD : "<<flush;
122 RUN(fromField->read());
125 if (currentStep==pasDeTemps.begin())
127 cout<<flag<<"Préparation de l'interpolation pour le premier pas de temps : "<<flush;
128 RUN(myInter = new INTERPOLATION<3>(*fromField,toMesh));
130 cout<<flag<<"Interpolation effective du premier pas de temps : "<<flush;
131 RUN(toField = myInter->interpolate(1,1));
136 cout<<flag<<"Interpolation nextStep : "<<flush;
137 RUN(toField = myInter->interpolateNextStep(*fromField,flagNewMapping));
141 cout<<flag<<"Creation du driver d'écriture Field : "<<flush;
142 toField->addDriver(MED_DRIVER,resultFileName,toField->getName());
145 cout<<flag<<"Ecriture du Field résultat : "<<flush;
149 if (flagNewMapping==1)
151 cout<<flag<<"Creation du driver d'écriture Mesh : "<<flush;
152 handle = toMesh.addDriver(MED_DRIVER,resultFileName,toMesh.getName()) ;
155 cout<<flag<<"Ecriture du Mesh résultat : "<<flush;
156 toMesh.write(handle);
161 } catch (MEDEXCEPTION& ex){