From: eap Date: Tue, 7 Sep 2010 08:40:11 +0000 (+0000) Subject: Preparation of MEDMEM for SALOME 6x X-Git-Tag: MED_For_6x_pre_Delivery X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d19082281c8145302a6d8617e9bc9c4c082589f3;p=tools%2Fmedcoupling.git Preparation of MEDMEM for SALOME 6x Use MEDFILEBROWSER instead of MED --- diff --git a/src/RENUMBER/renumbering.cxx b/src/RENUMBER/renumbering.cxx index c06003951..ee9853f99 100644 --- a/src/RENUMBER/renumbering.cxx +++ b/src/RENUMBER/renumbering.cxx @@ -29,8 +29,7 @@ #include "MEDMEM_Connectivity.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_DriversDef.hxx" -#include "MEDMEM_Med.hxx" -#include "MEDMEM_MedMeshDriver22.hxx" +#include "MEDMEM_MedFileBrowser.hxx" #include "RenumberingFactory.hxx" @@ -46,9 +45,9 @@ void computeNeighbour(const MESH* mesh,const medGeometryElement& Type, vector
  • calculateFullDescendingConnectivity(MED_CELL); const int* rev_conn=mesh->getReverseConnectivity(MED_EN::MED_DESCENDING, MED_EN::MED_CELL); const int* rev_conn_index=mesh->getReverseConnectivityIndex(MED_EN::MED_DESCENDING, MED_EN::MED_CELL); - int nb_face= mesh->getNumberOfElementsWithPoly(MED_FACE,MED_ALL_ELEMENTS); - int nb_edge = mesh->getNumberOfElementsWithPoly(MED_EDGE,MED_ALL_ELEMENTS); - nb_cell= mesh->getNumberOfElementsWithPoly(MED_CELL,Type); + int nb_face= mesh->getNumberOfElements(MED_FACE,MED_ALL_ELEMENTS); + int nb_edge = mesh->getNumberOfElements(MED_EDGE,MED_ALL_ELEMENTS); + nb_cell= mesh->getNumberOfElements(MED_CELL,Type); int nb_constituent; if(mesh->getMeshDimension()==2) @@ -79,72 +78,72 @@ void computeNeighbour(const MESH* mesh,const medGeometryElement& Type, vector
  • & iperm) { - if(Type==MED_POLYHEDRA) - { - int *conn_face_index_init=(int*)mesh.getPolyhedronFacesIndex(); - int *conn_index_init=(int*)mesh.getPolyhedronIndex(MED_FULL_INTERLACE); - int *conn_init=(int*)mesh.getPolyhedronConnectivity(MED_FULL_INTERLACE); +// if(Type==MED_POLYHEDRA) +// { +// int *conn_face_index_init=(int*)mesh.getPolyhedronFacesIndex(); +// int *conn_index_init=(int*)mesh.getPolyhedronIndex(MED_FULL_INTERLACE); +// int *conn_init=(int*)mesh.getPolyhedronConnectivity(MED_FULL_INTERLACE); - int *conn_index_renum=new int[nb_cell+1]; - int *conn_face_index_renum=new int[conn_index_init[nb_cell]]; - int *conn_renum=new int[conn_face_index_init[conn_index_init[nb_cell]-1]-1]; +// int *conn_index_renum=new int[nb_cell+1]; +// int *conn_face_index_renum=new int[conn_index_init[nb_cell]]; +// int *conn_renum=new int[conn_face_index_init[conn_index_init[nb_cell]-1]-1]; - int i_cell,i_face,i_conn; - int iter_face=0; - int iter_conn=0; - int i2; - conn_index_renum[0]=1; - conn_face_index_renum[0]=1; - for(i_cell=0;i_cellsetNodal(conn_renum,MED_CELL,Type); + myConnectivity->setNodal(conn_renum,MED_CELL,Type,conn_index_renum); delete[] conn_renum; delete[] conn_index_renum; } @@ -213,64 +212,35 @@ int main (int argc, char** argv) system(s.c_str()); // Reading file structure - const MED med_struct (MED_DRIVER,filename_in); - int nb_mesh, nb_fields; - deque mesh_names,f_names; - nb_mesh=med_struct.getNumberOfMeshes(); - nb_fields=med_struct.getNumberOfFields(); - mesh_names=med_struct.getMeshNames(); - f_names=med_struct.getFieldNames(); - if(nb_mesh!=1) + const MEDFILEBROWSER med_struct (filename_in); + if(med_struct.getNumberOfMeshes()!=1) { cout << "There are many meshes in the file" << endl; return -1; } - if(mesh_names[0].c_str()!=meshname) + if(med_struct.getMeshNames()[0]!=meshname) { cout << "Mesh name does not match" << endl; return -1; } - vector field_names; - vector iternumber; - vector ordernumber; - vector types; - int nb_fields_tot=0; - for (int ifield = 0; ifield < nb_fields; ifield++) - { - deque dtit=med_struct.getFieldIteration(f_names[ifield]); - for (deque::const_iterator iter =dtit.begin(); iter!=dtit.end(); iter++) - { - field_names.push_back(f_names[ifield]); - iternumber.push_back(iter->dt); - ordernumber.push_back(iter->it); - ++nb_fields_tot; - FIELD_* field = med_struct.getField(f_names[ifield],iter->dt,iter->it); - if (dynamic_cast*>(field)) - types.push_back(1); - else - types.push_back(0); - - } - } t_read_st=clock(); // Reading mesh MESH myMesh; myMesh.setName(meshname); - MED_MESH_RDONLY_DRIVER22 *drv22=new MED_MESH_RDONLY_DRIVER22(filename_in,&myMesh); + MED_MESH_RDONLY_DRIVER *drv22=new MED_MESH_RDONLY_DRIVER(filename_in,&myMesh); drv22->desactivateFacesComputation(); int newDrv=myMesh.addDriver(*drv22); delete drv22; myMesh.read(newDrv); - int nb_type=myMesh.getNumberOfTypesWithPoly(MED_CELL); + int nb_type=myMesh.getNumberOfTypes(MED_CELL); if (nb_type!=1) { cout << "Mesh must have only one type of cell" << endl; return -1; } - medGeometryElement *Types = myMesh.getTypesWithPoly(MED_CELL); + const medGeometryElement *Types = myMesh.getTypes(MED_CELL); medGeometryElement Type=Types[0]; - delete[] Types; t_read_mesh=clock(); MESH* workMesh=new MESH(myMesh); @@ -327,33 +297,38 @@ int main (int argc, char** argv) cout << "Computing fields "; cout.flush(); bool exist_type; - for(int ifield=0;ifield field_names = med_struct.getFieldNames(); + for(int ifield=0;ifield myField(MED_DRIVER,filename_in,field_names[ifield],iternumber[ifield],ordernumber[ifield]); - FIELD newField(myField); - const SUPPORT* mySupport=newField.getSupport(); - const medGeometryElement *typesOfSupport = mySupport->getTypes(); - for(int t=0;tgetNumberOfTypes();++t) + VEC_DT_IT_ dtit = med_struct.getFieldIteration( field_names[ifield]); + for ( int i = 0; i < dtit.size(); ++i ) { - if(typesOfSupport[t]==Type) + exist_type=false; + FIELD myField(MED_DRIVER,filename_in,field_names[ifield],dtit[i].dt,dtit[i].it); + FIELD newField(myField); + const SUPPORT* mySupport=newField.getSupport(); + const medGeometryElement *typesOfSupport = mySupport->getTypes(); + for(int t=0;tgetNumberOfTypes();++t) { - exist_type=true; - break; + if(typesOfSupport[t]==Type) + { + exist_type=true; + break; + } } - } - if(exist_type) - { - for(int i=0;igetNumberOfElements(Type);++i) + if(exist_type) { - for(int j=0;jgetNumberOfElements(Type);++i) { - newField.setValueIJ(i+1,j+1,myField.getValueIJ(iperm[i],j+1)); + for(int j=0;j