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 // pour gestion timings
18 #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;}
19 #define TIMORIZE(procedure,t) {double t0,t1;t0=CPUtime();procedure;t1=CPUtime();t=t1-t0;}
26 return ((double)buf.tms_utime+(double)buf.tms_stime)/(long) sysconf(_SC_CLK_TCK);
29 return ((double) clock())/CLOCKS_PER_SEC;
34 #include "MEDMEM_WrapperCells.hxx"
39 int * liste = new int [taille] ;
42 for (i=0;i<taille;i++) liste[i]=i;
44 Wrapper_Maille_Tria3 Tria3 ;Tria3 .positionne(liste);cout<<"Tria3 "<<endl;Tria3 .export_connectivite();
45 Wrapper_Maille_Tria6 Tria6 ;Tria6 .positionne(liste);cout<<"Tria6 "<<endl;Tria6 .export_connectivite();
46 Wrapper_Maille_Quad4 Quad4 ;Quad4 .positionne(liste);cout<<"Quad4 "<<endl;Quad4 .export_connectivite();
47 Wrapper_Maille_Quad8 Quad8 ;Quad8 .positionne(liste);cout<<"Quad8 "<<endl;Quad8 .export_connectivite();
48 Wrapper_Maille_Tetra4 Tetra4 ;Tetra4 .positionne(liste);cout<<"Tetra4 "<<endl;Tetra4 .export_connectivite();
49 Wrapper_Maille_Tetra10 Tetra10;Tetra10.positionne(liste);cout<<"Tetra10"<<endl;Tetra10.export_connectivite();
50 Wrapper_Maille_Hexa8 Hexa8 ;Hexa8 .positionne(liste);cout<<"Hexa8 "<<endl;Hexa8 .export_connectivite();
51 Wrapper_Maille_Hexa20 Hexa20 ;Hexa20 .positionne(liste);cout<<"Hexa20 "<<endl;Hexa20 .export_connectivite();
52 Wrapper_Maille_Pyra5 Pyra5 ;Pyra5 .positionne(liste);cout<<"Pyra5 "<<endl;Pyra5 .export_connectivite();
53 Wrapper_Maille_Pyra13 Pyra13 ;Pyra13 .positionne(liste);cout<<"Pyra13 "<<endl;Pyra13 .export_connectivite();
54 Wrapper_Maille_Penta6 Penta6 ;Penta6 .positionne(liste);cout<<"Penta6 "<<endl;Penta6 .export_connectivite();
55 Wrapper_Maille_Penta15 Penta15;Penta15.positionne(liste);cout<<"Penta15"<<endl;Penta15.export_connectivite();
59 const char * fromFileName = "ResultatSyrthes.med";
60 const char * toFileName = "MaillageAster.med";
61 const char * resultFileName = "ResultatInterpolation.med";
63 const char * fromFieldName = "THERDEP_TEMP____________________";
65 const char * fromMeshName = "MA";
66 const char * toMeshName = "MAILLAGE_IDEAS";
71 string flag="================[MAIN MESSAGES]================> ";
73 cout<<flag<<"Lecture de la structure MED : "<<flush;
74 MED fromMED (MED_DRIVER,fromFileName);
77 // Utilisation completement débile, on ne devrait pas avoir a faire l'appel suivant
78 fromMED.updateSupport();
80 cout<<flag<<"Lecture du Mailllage Cible : "<<flush;
81 MESH toMesh (MED_DRIVER,toFileName,toMeshName);
84 cout<<flag<<"Lecture des pas de temps : "<<flush;
85 deque<DT_IT_> pasDeTemps=fromMED.getFieldIteration (fromFieldName);
88 deque<DT_IT_>::const_iterator currentStep;
90 INTERPOLATION<3> * myInter ;
91 FIELD<double> * toField ;
92 int flagNewMapping = 1;
94 for (currentStep=pasDeTemps.begin();currentStep!=pasDeTemps.end();currentStep++)
96 cout<<flag<<"Traitement du Step ( "<<flush<<(*currentStep).dt<<" ; "<<(*currentStep).it<<" ) : "<<endl;
98 cout<<flag<<"Lecture du FIELD_ "<<flush;
99 FIELD_ * fromField_ = fromMED.getField(fromFieldName,(*currentStep).dt,(*currentStep).it);
102 cout<<flag<<"Transtypage en FIELD : "<<flush;
103 FIELD<double> * fromField = dynamic_cast<FIELD<double> *>(fromField_);
106 if (currentStep==pasDeTemps.begin())
108 //Utilisation completement débile, on ne devrait pas avoir a faire l'appel suivant
109 RUN(fromField->getSupport()->getMesh()->read());
112 cout<<flag<<"Lecture des valeurs du FIELD : "<<flush;
113 RUN(fromField->read());
116 if (currentStep==pasDeTemps.begin())
118 cout<<flag<<"Préparation de l'interpolation pour le premier pas de temps : "<<flush;
119 RUN(myInter = new INTERPOLATION<3>(*fromField,toMesh));
121 cout<<flag<<"Interpolation effective du premier pas de temps : "<<flush;
122 RUN(toField = myInter->interpolate(1,1));
127 cout<<flag<<"Interpolation nextStep : "<<flush;
128 RUN(toField = myInter->interpolateNextStep(*fromField,flagNewMapping));
132 cout<<flag<<"Creation du driver d'écriture Field : "<<flush;
133 toField->addDriver(MED_DRIVER,resultFileName,toField->getName());
136 cout<<flag<<"Ecriture du Field résultat : "<<flush;
140 if (flagNewMapping==1)
142 cout<<flag<<"Creation du driver d'écriture Mesh : "<<flush;
143 handle = toMesh.addDriver(MED_DRIVER,resultFileName,toMesh.getName()) ;
146 cout<<flag<<"Ecriture du Mesh résultat : "<<flush;
147 toMesh.write(handle);
152 } catch (MEDEXCEPTION& ex){