From: eap Date: Thu, 10 Dec 2009 14:55:37 +0000 (+0000) Subject: untabify X-Git-Tag: V5_1_main_FINAL~279 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8b207bd04cd5f76197727416c6704ab0a4fa2f6f;p=tools%2Fmedcoupling.git untabify --- diff --git a/src/ParaMEDMEM/ICoCoMEDField.cxx b/src/ParaMEDMEM/ICoCoMEDField.cxx index d855417d9..4370b5925 100644 --- a/src/ParaMEDMEM/ICoCoMEDField.cxx +++ b/src/ParaMEDMEM/ICoCoMEDField.cxx @@ -91,11 +91,11 @@ namespace ICoCo int* conn=new int[triofield._nodes_per_elem]; for (int i=0; iinsertNextCell(elemtype,triofield._nodes_per_elem,conn); + for(int j=0;jinsertNextCell(elemtype,triofield._nodes_per_elem,conn); } delete[] conn; @@ -109,17 +109,17 @@ namespace ICoCo int nb_case=triofield.nb_values(); if (triofield._type==0) { - _field = new ParaMEDMEM::ParaFIELD(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME,_mesh, *_comp_topology ); - + _field = new ParaMEDMEM::ParaFIELD(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME,_mesh, *_comp_topology ); + } else { - _field = new ParaMEDMEM::ParaFIELD(ParaMEDMEM::ON_NODES,ParaMEDMEM::ONE_TIME,_mesh, *_comp_topology ); - + _field = new ParaMEDMEM::ParaFIELD(ParaMEDMEM::ON_NODES,ParaMEDMEM::ONE_TIME,_mesh, *_comp_topology ); + } if (triofield._field!=0) { - // _field = new ParaMEDMEM::ParaFIELD(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME,_mesh, *_comp_topology ); + // _field = new ParaMEDMEM::ParaFIELD(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME,_mesh, *_comp_topology ); _field->getField()->setNature(ParaMEDMEM::ConservativeVolumic); ParaMEDMEM::DataArrayDouble *fieldArr=_field->getField()->getArray(); _field->getField()->setName(triofield.getName().c_str()); @@ -133,7 +133,7 @@ namespace ICoCo //field on the receiving end else { - // _field = new ParaMEDMEM::ParaFIELD(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME,_mesh, *_comp_topology ); + // _field = new ParaMEDMEM::ParaFIELD(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME,_mesh, *_comp_topology ); _field->getField()->setNature(ParaMEDMEM::ConservativeVolumic); _field->getField()->setName(triofield.getName().c_str()); _field->getField()->setTime(triofield._time1,0,triofield._itnumber); diff --git a/src/ParaMEDMEM/ICoCoTrioField.cxx b/src/ParaMEDMEM/ICoCoTrioField.cxx index 02f5d4c33..1827a4481 100644 --- a/src/ParaMEDMEM/ICoCoTrioField.cxx +++ b/src/ParaMEDMEM/ICoCoTrioField.cxx @@ -63,7 +63,7 @@ void TrioField::save(ostream& os) const{ for (int i=0;i<_nb_elems;i++) { for (int j=0;j<_nodes_per_elem;j++) - os << " "<<_connectivity[i*_nodes_per_elem+j]; + os << " "<<_connectivity[i*_nodes_per_elem+j]; os<>_connectivity[i*_nodes_per_elem+j]; + in>>_connectivity[i*_nodes_per_elem+j]; } if (_coords) @@ -124,7 +124,7 @@ void TrioField::restore(istream& in) { for (int i=0;i<_nbnodes;i++) { for (int j=0;j<_space_dim;j++) - in>> _coords[i*_space_dim+j] ; + in>> _coords[i*_space_dim+j] ; } @@ -136,14 +136,14 @@ void TrioField::restore(istream& in) { if (test) { if (_field) - delete [] _field; + delete [] _field; _field=new double[_nb_field_components*nb_values()]; for (int i=0;i> _field[i*_nb_field_components+j]; - - } + { + for (int j=0;j<_nb_field_components;j++) + in>> _field[i*_nb_field_components+j]; + + } } else { @@ -219,14 +219,14 @@ TrioField& TrioField::operator=(const TrioField& NewField){ _nb_field_components=NewField._nb_field_components; if (!NewField._connectivity) - _connectivity=0; + _connectivity=0; else { _connectivity=new int[_nodes_per_elem*_nb_elems]; memcpy( _connectivity,NewField._connectivity,_nodes_per_elem*_nb_elems*sizeof(int)); } if (!NewField._coords) - _coords=0; + _coords=0; else { _coords=new double[_nbnodes*_space_dim]; memcpy( _coords,NewField._coords,_nbnodes*_space_dim*sizeof(double)); diff --git a/src/ParaMEDMEM/ICoCoTrioField.hxx b/src/ParaMEDMEM/ICoCoTrioField.hxx index d61539260..c08321c69 100644 --- a/src/ParaMEDMEM/ICoCoTrioField.hxx +++ b/src/ParaMEDMEM/ICoCoTrioField.hxx @@ -12,19 +12,19 @@ #include namespace ICoCo { - /*! - \brief structure for coupling Trio codes via the ICoCo interface + /*! + \brief structure for coupling Trio codes via the ICoCo interface - This structure contains all the necessary information - for constructing a ParaMEDMEM::ParaFIELD (with the addition of the MPI - communicator). The ICoCo API specifies two kinds of calls for - the ICoCo::Field : either with the mesh only or with the entire information (mesh and field). - This structure can therefore be left without _time, _nb_field_components, _field - information, which are related to the field values. + This structure contains all the necessary information + for constructing a ParaMEDMEM::ParaFIELD (with the addition of the MPI + communicator). The ICoCo API specifies two kinds of calls for + the ICoCo::Field : either with the mesh only or with the entire information (mesh and field). + This structure can therefore be left without _time, _nb_field_components, _field + information, which are related to the field values. - _coords and _connectivity tables are always owned by the TrioField. + _coords and _connectivity tables are always owned by the TrioField. - */ + */ class TrioField:public Field { public: diff --git a/src/ParaMEDMEM/MEDLoader/MEDLoader.cxx b/src/ParaMEDMEM/MEDLoader/MEDLoader.cxx index da1c1d01a..453ad73f6 100644 --- a/src/ParaMEDMEM/MEDLoader/MEDLoader.cxx +++ b/src/ParaMEDMEM/MEDLoader/MEDLoader.cxx @@ -201,12 +201,12 @@ namespace MEDLoader char *attdes=new char[MED_TAILLE_DESC*natt+1]; char *gro=new char[MED_TAILLE_LNOM*ngro+1]; MEDfamInfo(fid,(char *)meshName,i+1,nomfam,&numfam,attide,attval,attdes,&natt,gro,&ngro); - for(int j=0;j::const_iterator iter=conn.begin();iter!=conn.end();iter++) { - unsigned curDim=INTERP_KERNEL::CellModel::getCellModel((*iter).getType()).getDimension(); - if(ret::iterator iter=conn.begin();iter!=conn.end();) { - unsigned curDim=INTERP_KERNEL::CellModel::getCellModel((*iter).getType()).getDimension(); - if(curDim!=meshDim) - { - (*iter).releaseArray(); - iter=conn.erase(iter); - } - else - iter++; + unsigned curDim=INTERP_KERNEL::CellModel::getCellModel((*iter).getType()).getDimension(); + if(curDim!=meshDim) + { + (*iter).releaseArray(); + iter=conn.erase(iter); + } + else + iter++; } } @@ -719,35 +719,35 @@ namespace MEDLoader }; void tradMEDFileCoreFrmt2MEDCouplingUMesh(const std::list& medConnFrmt, - DataArrayInt* &conn, - DataArrayInt* &connIndex, - const std::vector& familiesToKeep) + DataArrayInt* &conn, + DataArrayInt* &connIndex, + const std::vector& familiesToKeep) { bool keepAll=familiesToKeep.empty(); if(medConnFrmt.empty()) { - conn=0; - connIndex=0; - return ; + conn=0; + connIndex=0; + return ; } std::list::const_iterator iter=medConnFrmt.begin(); int totalNbOfCells=0; int totalNbOfMedConn=0; for(;iter!=medConnFrmt.end();iter++) { - const INTERP_KERNEL::CellModel& cellMod=INTERP_KERNEL::CellModel::getCellModel((*iter).getType()); - if(keepAll) + const INTERP_KERNEL::CellModel& cellMod=INTERP_KERNEL::CellModel::getCellModel((*iter).getType()); + if(keepAll) totalNbOfCells+=(*iter).getLength(); - else - for(std::vector::const_iterator iter2=familiesToKeep.begin();iter2!=familiesToKeep.end();iter2++) + else + for(std::vector::const_iterator iter2=familiesToKeep.begin();iter2!=familiesToKeep.end();iter2++) totalNbOfCells+=std::count((*iter).getFam(),(*iter).getFam()+(*iter).getLength(),*iter2); - if(!cellMod.isDynamic()) - if(keepAll) - totalNbOfMedConn+=(*iter).getLength()*cellMod.getNumberOfNodes(); - else - for(std::vector::const_iterator iter2=familiesToKeep.begin();iter2!=familiesToKeep.end();iter2++) - totalNbOfMedConn+=std::count((*iter).getFam(),(*iter).getFam()+(*iter).getLength(),*iter2)*cellMod.getNumberOfNodes(); - else + if(!cellMod.isDynamic()) + if(keepAll) + totalNbOfMedConn+=(*iter).getLength()*cellMod.getNumberOfNodes(); + else + for(std::vector::const_iterator iter2=familiesToKeep.begin();iter2!=familiesToKeep.end();iter2++) + totalNbOfMedConn+=std::count((*iter).getFam(),(*iter).getFam()+(*iter).getLength(),*iter2)*cellMod.getNumberOfNodes(); + else if(keepAll) totalNbOfMedConn+=(*iter).getConnLength(); else @@ -766,12 +766,12 @@ namespace MEDLoader int *connPtr=conn->getPointer(); for(iter=medConnFrmt.begin();iter!=medConnFrmt.end();iter++) { - INTERP_KERNEL::NormalizedCellType type=(*iter).getType(); - const int *sourceConn=(*iter).getArray(); + INTERP_KERNEL::NormalizedCellType type=(*iter).getType(); + const int *sourceConn=(*iter).getArray(); const int *sourceIndex=(*iter).getIndex(); - const INTERP_KERNEL::CellModel& cellMod=INTERP_KERNEL::CellModel::getCellModel(type); - int nbOfCellsInCurType; - int nbOfNodesIn1Cell=cellMod.getNumberOfNodes(); + const INTERP_KERNEL::CellModel& cellMod=INTERP_KERNEL::CellModel::getCellModel(type); + int nbOfCellsInCurType; + int nbOfNodesIn1Cell=cellMod.getNumberOfNodes(); nbOfCellsInCurType=(*iter).getLength(); bool isDyn=cellMod.isDynamic(); int *tmpConnPtr; @@ -835,14 +835,14 @@ namespace MEDLoader const int *connIdxPtr=connIndex->getPointer(); for(int i=0;i(),1)); return ret; @@ -858,14 +858,14 @@ namespace MEDLoader for(int i=0;i(),1)); return ret; diff --git a/src/RENUMBER/testRenumbering.py b/src/RENUMBER/testRenumbering.py index 2d7697cd7..4e67112b1 100755 --- a/src/RENUMBER/testRenumbering.py +++ b/src/RENUMBER/testRenumbering.py @@ -44,7 +44,7 @@ for i in range(9): f.rmDriver(id) nbcell2dboost=m.getNumberOfElementsWithPoly(MED_CELL,MED_ALL_ELEMENTS) -connectivite=[2,6,13,11,11,13,14,12,6,5,15,13,12,14,10,4,13,15,16,14,5,1,7,15,14,16,9,10,15,7,8,16,16,8,3,9] +connectivite=[2,6,13,11, 11,13,14,12, 6,5,15,13, 12,14,10,4, 13,15,16,14,5,1,7,15,14,16,9,10,15,7,8,16,16,8,3,9] connectivite_index=[1,5,9,13,17,21,25,29,33,37] conn=m.getConnectivity(MED_FULL_INTERLACE,MED_NODAL,MED_CELL,MED_QUAD4) conn_index=m.getConnectivityIndex(MED_NODAL,MED_CELL); @@ -90,14 +90,19 @@ meshname="Mesh_1" print "TEST 2D Boost with polygons" method="BOOST" string_to_execute="'"+dir_renumber+" "+dir_mesh+"/"+filename+" "+meshname+" "+method+" "+dir_mesh+"/out_"+filename+"'" +print string_to_execute eval("os.system("+string_to_execute+")") m = MESH(MED_DRIVER,dir_mesh+"/out_"+filename,meshname) nbcell2dpolyboost=m.getNumberOfElementsWithPoly(MED_CELL,MED_ALL_ELEMENTS) -connectivite=[2,5,9,10,11,10,9,12,5,6,8,9,4,11,12,16,12,9,8,13,6,1,7,8,16,12,13,15,13,8,7,14,15,13,14,3] +connectivite=[11,10,9,12, 15,13,14,3, 6,1,7,8, 4,11,12,16, 2,5,9,10, 5,6,8,9,16,12,13,15,12,9,8,13,13,8,7,14] connectivite_index=[1,5,9,13,17,21,25,29,33,37] conn=m.getPolygonsConnectivity(MED_FULL_INTERLACE,MED_CELL) +print "getNumberOfTypesWithPoly(MED_CELL)", m.getNumberOfTypesWithPoly(MED_CELL) +print "getNumberOfTypes(MED_CELL)", m.getNumberOfTypes(MED_CELL) +print "getNumberOfTypesWithPoly(MED_FACE)", m.getNumberOfTypesWithPoly(MED_FACE) conn_index=m.getPolygonsConnectivityIndex(MED_FULL_INTERLACE,MED_CELL); conn2dpolyboost=(len(conn)==len(connectivite)) +print len(conn), len(connectivite), conn if conn2dpolyboost: for i in range(0,len(connectivite)): conn2dpolyboost=conn2dpolyboost&(conn[i]==connectivite[i]) @@ -106,6 +111,8 @@ if conn_index2dpolyboost: for i in range(0,len(connectivite_index)): conn_index2dpolyboost=conn_index2dpolyboost&(conn_index[i]==connectivite_index[i]) PolyBoost2D=conn2dpolyboost&conn_index2dpolyboost&(nbcell2dpolyboost==9) +print "conn2dpolyboost",conn2dpolyboost,"conn_index2dpolyboost",conn_index2dpolyboost,nbcell2dpolyboost +sys.exit(1) os.remove(dir_mesh+"/out_"+filename) print "TEST 2D Metis with polygons"