From: ageay Date: Thu, 21 Oct 2010 06:25:16 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: Step0_WithoutSPLITTER~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=09c4d7773e069af5114b6699bceec57178f22eb7;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/RENUMBER/Makefile.am b/src/RENUMBER/Makefile.am index 397ed5c44..b170b2dd3 100644 --- a/src/RENUMBER/Makefile.am +++ b/src/RENUMBER/Makefile.am @@ -53,7 +53,7 @@ endif librenumber_la_CPPFLAGS= $(MED2_INCLUDES) $(HDF5_INCLUDES) @CXXTMPDPTHFLAGS@ \ $(BOOST_CPPFLAGS) \ - -I$(srcdir)/../MEDMEM -I$(srcdir)/../MEDWrapper/V2_1/Core -I$(srcdir)/../INTERP_KERNEL/Bases + -I$(srcdir)/../MEDMEM -I$(srcdir)/../INTERP_KERNEL/Bases librenumber_la_LDFLAGS= #libmedsplitter_la_LDFLAGS= $(MED2_LIBS) $(HDF5_LIBS) $(STDLIB) \ @@ -73,7 +73,7 @@ if MED_ENABLE_KERNEL endif librenumber_la_LDFLAGS+= $(MED2_LIBS) $(HDF5_LIBS) $(STDLIB) \ - ../MEDMEM/libmedmem.la ../MEDWrapper/V2_1/Core/libmed_V2_1.la ../INTERP_KERNEL/libinterpkernel.la + ../MEDMEM/libmedmem.la ../INTERP_KERNEL/libinterpkernel.la # Executables targets bin_PROGRAMS= renumber diff --git a/src/RENUMBER/RENUMBER_METISRenumbering.cxx b/src/RENUMBER/RENUMBER_METISRenumbering.cxx index e5c3535b9..3a98fdf0c 100644 --- a/src/RENUMBER/RENUMBER_METISRenumbering.cxx +++ b/src/RENUMBER/RENUMBER_METISRenumbering.cxx @@ -17,12 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifdef ENABLE_PARMETIS -// include parmetis.h even if it is not needed here -// to avoid inclusion of c++ definitions within extern "C" -// from metis.h from parmetis.h from mpi.h(openmpi) from mpicxx.h -#include -#endif extern "C" { #include "metis.h" diff --git a/src/RENUMBER/renumbering.cxx b/src/RENUMBER/renumbering.cxx index c06003951..d5ef000c7 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" @@ -40,15 +39,18 @@ using namespace std; using namespace MED_EN; using namespace MED_RENUMBER; +namespace +{ + void computeNeighbour(const MESH* mesh,const medGeometryElement& Type, vector >& neighbour, int& ntot,int& nb_cell) { CONNECTIVITY* conn = (CONNECTIVITY*)mesh->getConnectivityptr(); conn->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,74 +81,8 @@ 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); - - 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; } @@ -187,6 +123,7 @@ void changeFamily(MESH* mesh, const medGeometryElement& Type, const vector& } } } +} // namespace int main (int argc, char** argv) { @@ -213,64 +150,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 +235,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(unsigned 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 ( unsigned 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