]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
untabify
authoreap <eap@opencascade.com>
Thu, 10 Dec 2009 14:55:37 +0000 (14:55 +0000)
committereap <eap@opencascade.com>
Thu, 10 Dec 2009 14:55:37 +0000 (14:55 +0000)
src/ParaMEDMEM/ICoCoMEDField.cxx
src/ParaMEDMEM/ICoCoTrioField.cxx
src/ParaMEDMEM/ICoCoTrioField.hxx
src/ParaMEDMEM/MEDLoader/MEDLoader.cxx
src/RENUMBER/testRenumbering.py

index d855417d95d29cce922c7a4c3a26e3f08e86f40c..4370b59257e21ee07cc88e5db057db8500b43b55 100644 (file)
@@ -91,11 +91,11 @@ namespace ICoCo
     int* conn=new int[triofield._nodes_per_elem];
     for (int i=0; i<triofield._nb_elems;i++)
       {
-       for(int j=0;j<triofield._nodes_per_elem;j++)
-         {
-           conn[j]=(triofield._connectivity)[i*triofield._nodes_per_elem+j];
-         }
-       _local_mesh->insertNextCell(elemtype,triofield._nodes_per_elem,conn);
+        for(int j=0;j<triofield._nodes_per_elem;j++)
+          {
+            conn[j]=(triofield._connectivity)[i*triofield._nodes_per_elem+j];
+          }
+        _local_mesh->insertNextCell(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);
index 02f5d4c33f9eb087b65d3ea2f19c27d3c74fb1c8..1827a4481a792fd497c1083c5649180edcec87bb 100644 (file)
@@ -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<<endl;
     }
   
@@ -71,7 +71,7 @@ void TrioField::save(ostream& os) const{
   for (int i=0;i<_nbnodes;i++) 
     {
       for (int j=0;j<_space_dim;j++)
-       os <<" "<< _coords[i*_space_dim+j] ;
+        os <<" "<< _coords[i*_space_dim+j] ;
       os  << endl;
     }
   
@@ -82,11 +82,11 @@ void TrioField::save(ostream& os) const{
     {
       os <<1<<endl;
       for (int i=0;i<nb_values();i++) 
-       {
-         for (int j=0;j<_nb_field_components;j++)
-           os <<" "<< _field[i*_nb_field_components+j];
-         os << endl;
-       }
+        {
+          for (int j=0;j<_nb_field_components;j++)
+            os <<" "<< _field[i*_nb_field_components+j];
+          os << endl;
+        }
     }
   else
     {
@@ -115,7 +115,7 @@ void TrioField::restore(istream& in) {
   for (int i=0;i<_nb_elems;i++) 
     {
       for (int j=0;j<_nodes_per_elem;j++)
-       in>>_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<nb_values();i++) 
-       {
-         for (int j=0;j<_nb_field_components;j++)
-           in>> _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));
index d615392602e74fdc80e64a2ac87d990f64882019..c08321c694f35094c0e6732f191cdfb21e08619c 100644 (file)
 #include <ICoCoField.hxx>
 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:
index da1c1d01ad31be0163f9650740c6c27af9332500..453ad73f6016e897cfafe041402dda67a85c294c 100644 (file)
@@ -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<ngro;j++)
-         {
-           std::string cur=buildStringFromFortran(gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
-           if(std::find(ret.begin(),ret.end(),cur)==ret.end())
-             ret.push_back(cur);
-         }
+        for(int j=0;j<ngro;j++)
+          {
+            std::string cur=buildStringFromFortran(gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+            if(std::find(ret.begin(),ret.end(),cur)==ret.end())
+              ret.push_back(cur);
+          }
         delete [] attdes;
         delete [] gro;
         delete [] attide;
@@ -452,8 +452,8 @@ namespace MEDLoader
         char *gro=new char[MED_TAILLE_LNOM*ngro+1];
         MEDfamInfo(fid,(char *)meshName,i+1,nomfam,&numfam,attide,attval,attdes,&natt,gro,&ngro);
         std::string cur=buildStringFromFortran(nomfam,sizeof(nomfam));
-       if(std::find(fams.begin(),fams.end(),cur)!=fams.end())
-         ret.push_back(numfam);
+        if(std::find(fams.begin(),fams.end(),cur)!=fams.end())
+          ret.push_back(numfam);
         delete [] attdes;
         delete [] gro;
         delete [] attide;
@@ -480,15 +480,15 @@ namespace MEDLoader
         char *gro=new char[MED_TAILLE_LNOM*ngro+1];
         MEDfamInfo(fid,(char *)meshName,i+1,nomfam,&numfam,attide,attval,attdes,&natt,gro,&ngro);
         std::string cur=buildStringFromFortran(nomfam,sizeof(nomfam));
-       for(int j=0;j<ngro;j++)
-         {
-           std::string cur=buildStringFromFortran(gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
-           if(std::find(grps.begin(),grps.end(),cur)!=grps.end())
-             {
-               ret.push_back(numfam);
-               break;
-             }
-         }
+        for(int j=0;j<ngro;j++)
+          {
+            std::string cur=buildStringFromFortran(gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+            if(std::find(grps.begin(),grps.end(),cur)!=grps.end())
+              {
+                ret.push_back(numfam);
+                break;
+              }
+          }
         delete [] attdes;
         delete [] gro;
         delete [] attide;
@@ -637,9 +637,9 @@ namespace MEDLoader
     unsigned ret=0;
     for(typename std::list<T>::const_iterator iter=conn.begin();iter!=conn.end();iter++)
       {
-       unsigned curDim=INTERP_KERNEL::CellModel::getCellModel((*iter).getType()).getDimension();
-       if(ret<curDim)
-         ret=curDim;
+        unsigned curDim=INTERP_KERNEL::CellModel::getCellModel((*iter).getType()).getDimension();
+        if(ret<curDim)
+          ret=curDim;
       }
     return ret;
   }
@@ -649,14 +649,14 @@ namespace MEDLoader
   {
     for(typename std::list<T>::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<MEDLoader::MEDConnOfOneElemType>& medConnFrmt,
-                                                      DataArrayInt* &conn,
-                                                      DataArrayInt* &connIndex,
-                                                      const std::vector<int>& familiesToKeep)
+                                                       DataArrayInt* &conn,
+                                                       DataArrayInt* &connIndex,
+                                                       const std::vector<int>& familiesToKeep)
   {
     bool keepAll=familiesToKeep.empty();
     if(medConnFrmt.empty())
       {
-       conn=0;
-       connIndex=0;
-       return ;
+        conn=0;
+        connIndex=0;
+        return ;
       }
     std::list<MEDLoader::MEDConnOfOneElemType>::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<int>::const_iterator iter2=familiesToKeep.begin();iter2!=familiesToKeep.end();iter2++)
+        else
+          for(std::vector<int>::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<int>::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<int>::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<nbOfElem;i++)
       {
-       int delta=connIdxPtr[1]-connIdxPtr[0];
-       if(*connPtr==type)
-         {
-           conn4MEDFile.insert(conn4MEDFile.end(),connPtr+1,connPtr+delta);
-           ret++;
+        int delta=connIdxPtr[1]-connIdxPtr[0];
+        if(*connPtr==type)
+          {
+            conn4MEDFile.insert(conn4MEDFile.end(),connPtr+1,connPtr+delta);
+            ret++;
           }
-       connIdxPtr++;
-       connPtr+=delta;
+        connIdxPtr++;
+        connPtr+=delta;
       }
     std::transform(conn4MEDFile.begin(),conn4MEDFile.end(),conn4MEDFile.begin(),std::bind2nd(std::plus<int>(),1));
     return ret;
@@ -858,14 +858,14 @@ namespace MEDLoader
     for(int i=0;i<nbOfElem;i++)
       {
         int delta=connIdxPtr[1]-connIdxPtr[0];
-       if(*connPtr==INTERP_KERNEL::NORM_POLYGON)
-         {
-           conn4MEDFile.insert(conn4MEDFile.end(),connPtr+1,connPtr+delta);
+        if(*connPtr==INTERP_KERNEL::NORM_POLYGON)
+          {
+            conn4MEDFile.insert(conn4MEDFile.end(),connPtr+1,connPtr+delta);
             connIndex4MEDFile.push_back(connIndex4MEDFile.back()+delta-1);
-           ret++;
+            ret++;
           }
         connIdxPtr++;
-       connPtr+=delta;
+        connPtr+=delta;
       }
     std::transform(conn4MEDFile.begin(),conn4MEDFile.end(),conn4MEDFile.begin(),std::bind2nd(std::plus<int>(),1));
     return ret;
index 2d7697cd709c59efd0cdb74dab37b9d02bf07b7b..4e67112b1a924ab4b9b3fe819e00f3ba1b728ee6 100755 (executable)
@@ -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"