]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Warning hunting
authorageay <ageay>
Tue, 29 Oct 2013 16:07:05 +0000 (16:07 +0000)
committerageay <ageay>
Tue, 29 Oct 2013 16:07:05 +0000 (16:07 +0000)
src/MEDCoupling/MEDCouplingMemArray.txx
src/MEDCoupling/MEDCouplingMesh.cxx
src/MEDCoupling/MEDCouplingMultiFields.cxx
src/ParaMEDMEM/DisjointDEC.cxx
src/ParaMEDMEM/ElementLocator.cxx
src/ParaMEDMEM/InterpolationMatrix.cxx
src/ParaMEDMEM/MPIAccessDEC.cxx
src/ParaMEDMEM/OverlapElementLocator.cxx

index 96160edb7719f5b8e4c1b264db47a291672c1828..3171c1672ac415a4cbc6b21f0f78d2079ffc9ac8 100644 (file)
@@ -133,8 +133,7 @@ namespace ParaMEDMEM
   template<class T>
   void MemArray<T>::pack() const
   {
-    if(_nb_of_elem>=0)
-      (const_cast<MemArray<T> * >(this))->reserve(_nb_of_elem);
+    (const_cast<MemArray<T> * >(this))->reserve(_nb_of_elem);
   }
 
   template<class T>
@@ -337,8 +336,6 @@ namespace ParaMEDMEM
   void MemArray<T>::alloc(std::size_t nbOfElements)
   {
     destroy();
-    if(nbOfElements<0)
-      throw INTERP_KERNEL::Exception("MemArray::alloc : request for negative length of data !");
     _nb_of_elem=nbOfElements;
     _nb_of_elem_alloc=nbOfElements;
     _pointer.setInternal((T*)malloc(_nb_of_elem_alloc*sizeof(T)));
@@ -382,8 +379,6 @@ namespace ParaMEDMEM
   template<class T>
   void MemArray<T>::reAlloc(std::size_t newNbOfElements)
   {
-    if(newNbOfElements<0)
-      throw INTERP_KERNEL::Exception("MemArray::reAlloc : request for negative length of data !");
     if(_nb_of_elem==newNbOfElements)
       return ;
     T *pointer=(T*)malloc(newNbOfElements*sizeof(T));
index 85186951af7cf2995b12332a538db0ab7c46fb0c..4aae2aa584dbf839003236c034effd85c513489b 100644 (file)
@@ -37,7 +37,7 @@ MEDCouplingMesh::MEDCouplingMesh():_time(0.),_iteration(-1),_order(-1)
 {
 }
 
-MEDCouplingMesh::MEDCouplingMesh(const MEDCouplingMesh& other):_name(other._name),_description(other._description),
+MEDCouplingMesh::MEDCouplingMesh(const MEDCouplingMesh& other):RefCountObject(other),_name(other._name),_description(other._description),
                                                                _time(other._time),_iteration(other._iteration),
                                                                _order(other._order),_time_unit(other._time_unit)
 {
index 5fe85bf7a19bc744d350625825065f05eae84f49..5980367e153646caaf8bc967e7adc99470af74c5 100644 (file)
@@ -323,7 +323,7 @@ MEDCouplingMultiFields::MEDCouplingMultiFields(const std::vector<MEDCouplingFiel
 /*!
  * Performs deepCpy.
  */
-MEDCouplingMultiFields::MEDCouplingMultiFields(const MEDCouplingMultiFields& other)
+MEDCouplingMultiFields::MEDCouplingMultiFields(const MEDCouplingMultiFields& other):RefCountObject(other)
 {
   std::size_t sz=other._fs.size();
   _fs.resize(sz);
index c825b31f80803d8ba3a9325cef95b41b42f7e618..a50c0d414e0500f27587f70d3d7a3b0828707393 100644 (file)
@@ -245,7 +245,7 @@ namespace ParaMEDMEM
       local_group=_target_group;
     else
       throw INTERP_KERNEL::Exception("Invalid procgroup for field attachment to DEC");
-    ParaMESH *paramesh=new ParaMESH((MEDCouplingPointSet *)field->getMesh(),*local_group,field->getMesh()->getName());
+    ParaMESH *paramesh=new ParaMESH(static_cast<MEDCouplingPointSet *>(const_cast<MEDCouplingMesh *>(field->getMesh())),*local_group,field->getMesh()->getName());
     ParaFIELD *tmp=new ParaFIELD(field, paramesh, *local_group);
     tmp->setOwnSupport(true);
     attachLocalField(tmp,true);
@@ -275,11 +275,12 @@ namespace ParaMEDMEM
     const ICoCo::TrioField* triofield=dynamic_cast<const ICoCo::TrioField*> (field);
     if (triofield !=0)
       {
+        /* Strange part of code localgroup not used !
         ProcessorGroup* localgroup;
         if (_source_group->containsMyRank())
           localgroup=_source_group;
         else
-          localgroup=_target_group;
+        localgroup=_target_group;*/
         delete _icoco_field;
         
         _icoco_field=new ICoCo::MEDField(*const_cast<ICoCo::TrioField* >(triofield));
index 52dab4385d45bda508d6c787a99895809cacaca2..ba9ff36277a866fa4c9722729ca3dbdb59e8c42f 100644 (file)
@@ -307,7 +307,7 @@ namespace ParaMEDMEM
     distant_mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
     //
     distant_ids_recv=new int[tinyInfoDistant.back()];
-    comm_interface.sendRecv((void *)distant_ids_send->getConstPointer(),tinyInfoLocal.back(), MPI_INT,
+    comm_interface.sendRecv(const_cast<void *>(reinterpret_cast<const void *>(distant_ids_send->getConstPointer())),tinyInfoLocal.back(), MPI_INT,
                             iprocdistant_in_union, 1113,
                             distant_ids_recv,tinyInfoDistant.back(), MPI_INT,
                             iprocdistant_in_union,1113,
@@ -352,8 +352,8 @@ namespace ParaMEDMEM
         const vector<double>& valued=partialSumRelToDistantIds[procId];
         int lgth=eltIds.size();
         comm.send(&lgth,1,MPI_INT,*iter,1114,*_comm);
-        comm.send((void *)&eltIds[0],lgth,MPI_INT,*iter,1115,*_comm);
-        comm.send((void *)&valued[0],lgth,MPI_DOUBLE,*iter,1116,*_comm);
+        comm.send(const_cast<void *>(reinterpret_cast<const void *>(&eltIds[0])),lgth,MPI_INT,*iter,1115,*_comm);
+        comm.send(const_cast<void *>(reinterpret_cast<const void *>(&valued[0])),lgth,MPI_DOUBLE,*iter,1116,*_comm);
       }
   }
 
@@ -384,7 +384,7 @@ namespace ParaMEDMEM
         const vector<int>& eltIds=distantLocEltIds[procId];
         int lgth=eltIds.size();
         comm.send(&lgth,1,MPI_INT,*iter,1121,*_comm);
-        comm.send((void *)&eltIds[0],lgth,MPI_INT,*iter,1122,*_comm);
+        comm.send(const_cast<void *>(reinterpret_cast<const void *>(&eltIds[0])),lgth,MPI_INT,*iter,1122,*_comm);
       }
   }
 
@@ -436,8 +436,8 @@ namespace ParaMEDMEM
     for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
       {
         comm.send(&lgth,1,MPI_INT,*iter,1124,*_comm);
-        comm.send((void*)&distantGlobIds[0],lgth,MPI_INT,*iter,1125,*_comm);
-        comm.send((void*)&sum[0],lgth,MPI_DOUBLE,*iter,1126,*_comm);
+        comm.send(const_cast<void *>(reinterpret_cast<const void *>(&distantGlobIds[0])),lgth,MPI_INT,*iter,1125,*_comm);
+        comm.send(const_cast<void *>(reinterpret_cast<const void *>(&sum[0])),lgth,MPI_DOUBLE,*iter,1126,*_comm);
       }
   }
 
@@ -451,8 +451,8 @@ namespace ParaMEDMEM
     int lgth=distantGlobIds.size();
     for(vector<int>::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++)
       {
-        comm.send(&lgth,1,MPI_INT,*iter,1128,*_comm);
-        comm.send((void*)&distantGlobIds[0],lgth,MPI_INT,*iter,1129,*_comm);
+        comm.send(const_cast<void *>(reinterpret_cast<const void *>(&lgth)),1,MPI_INT,*iter,1128,*_comm);
+        comm.send(const_cast<void *>(reinterpret_cast<const void *>(&distantGlobIds[0])),lgth,MPI_INT,*iter,1129,*_comm);
       }
   }
   
@@ -679,8 +679,8 @@ namespace ParaMEDMEM
       {
         const std::vector<int>& vals=_ids_per_working_proc3[procId];
         int size=vals.size();
-        comm.send((void *)&size,1,MPI_INT,*iter,1130,*_comm);
-        comm.send((void *)&vals[0],size,MPI_INT,*iter,1131,*_comm);
+        comm.send(const_cast<void *>(reinterpret_cast<const void *>(&size)),1,MPI_INT,*iter,1130,*_comm);
+        comm.send(const_cast<void *>(reinterpret_cast<const void *>(&vals[0])),size,MPI_INT,*iter,1131,*_comm);
       }
   }
 
index b57b091f70e26828cb7e962381d9fee18720f815..dd96381ba65cc7c473b263351471afe708e0687f 100644 (file)
@@ -110,7 +110,6 @@ namespace ParaMEDMEM
     interpMethod+=srcMeth;
     //creating the interpolator structure
     vector<map<int,double> > surfaces;
-    int colSize=0;
     //computation of the intersection volumes between source and target elements
     MEDCouplingUMesh *distant_supportC=dynamic_cast<MEDCouplingUMesh *>(&distant_support);
     MEDCouplingUMesh *source_supportC=dynamic_cast<MEDCouplingUMesh *>(_source_support);
@@ -120,19 +119,19 @@ namespace ParaMEDMEM
           {
             MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(source_supportC);
             INTERP_KERNEL::Interpolation2D interpolation(*this);
-            colSize=interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str());
           }
         else if(source_supportC->getMeshDimension()==3 && source_supportC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(source_supportC);
             INTERP_KERNEL::Interpolation3D interpolation(*this);
-            colSize=interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str());
           }
         else if(source_supportC->getMeshDimension()==2 && source_supportC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,2> source_mesh_wrapper(source_supportC);
             INTERP_KERNEL::Interpolation3DSurf interpolation(*this);
-            colSize=interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str());
           }
         else
           throw INTERP_KERNEL::Exception("No para interpolation available for the given mesh and space dimension of source mesh to -1D targetMesh");
@@ -143,19 +142,19 @@ namespace ParaMEDMEM
           {
             MEDCouplingNormalizedUnstructuredMesh<2,2> distant_mesh_wrapper(distant_supportC);
             INTERP_KERNEL::Interpolation2D interpolation(*this);
-            colSize=interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str());
           }
         else if(distant_supportC->getMeshDimension()==3 && distant_supportC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,3> distant_mesh_wrapper(distant_supportC);
             INTERP_KERNEL::Interpolation3D interpolation(*this);
-            colSize=interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str());
           }
         else if(distant_supportC->getMeshDimension()==2 && distant_supportC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,2> distant_mesh_wrapper(distant_supportC);
             INTERP_KERNEL::Interpolation3DSurf interpolation(*this);
-            colSize=interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str());
           }
         else
           throw INTERP_KERNEL::Exception("No para interpolation available for the given mesh and space dimension of distant mesh to -1D sourceMesh");
@@ -167,7 +166,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<3,3> target_wrapper(distant_supportC);
         MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(source_supportC);
         INTERP_KERNEL::Interpolation3D2D interpolator (*this);
-        colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -178,7 +177,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<2,2> target_wrapper(distant_supportC);
         MEDCouplingNormalizedUnstructuredMesh<2,2> source_wrapper(source_supportC);
         INTERP_KERNEL::Interpolation2D1D interpolator (*this);
-        colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -193,7 +192,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<1,1> source_wrapper(source_supportC);
 
         INTERP_KERNEL::Interpolation1D interpolation(*this);
-        colSize=interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -204,7 +203,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<2,1> source_wrapper(source_supportC);
 
         INTERP_KERNEL::Interpolation2DCurve interpolation(*this);
-        colSize=interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -215,7 +214,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<3,2> source_wrapper(source_supportC);
 
         INTERP_KERNEL::Interpolation3DSurf interpolator (*this);
-        colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -226,7 +225,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<2,2> source_wrapper(source_supportC);
 
         INTERP_KERNEL::Interpolation2D interpolator (*this);
-        colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -237,7 +236,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(source_supportC);
 
         INTERP_KERNEL::Interpolation3D interpolator (*this);
-        colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
index e2db247f719cebf1f6f3a20da95b10b71aec7992..d9df4b35aca26eb3d029d408b0fb67d8b99aec54 100644 (file)
@@ -51,7 +51,7 @@ namespace ParaMEDMEM
       {
         procs.insert(i) ;
       }
-    MPIProcessorGroup *mpilg = (MPIProcessorGroup *)&source_group;
+    MPIProcessorGroup *mpilg = static_cast<MPIProcessorGroup *>(const_cast<ProcessorGroup *>(&source_group));
     _MPI_union_group = new ParaMEDMEM::MPIProcessorGroup( union_group->getCommInterface(),procs,mpilg->getWorldComm());
     delete union_group ;
     _my_rank = _MPI_union_group->myRank() ;
index 3d1822d87c715549d2df7688ddc2a030408e0a86..67134c4b82ee9707e7ee64753bfa6e392494ef98 100644 (file)
@@ -334,7 +334,7 @@ namespace ParaMEDMEM
     comInterface.send(v1Local->getPointer(),v1Local->getNbOfElems(),MPI_INT,procId,1142,*comm);
     comInterface.send(v2Local->getPointer(),v2Local->getNbOfElems(),MPI_DOUBLE,procId,1143,*comm);
     //finished for mesh, ids now
-    comInterface.send((int *)idsToSend->getConstPointer(),lgth[1],MPI_INT,procId,1144,*comm);
+    comInterface.send(const_cast<int *>(idsToSend->getConstPointer()),lgth[1],MPI_INT,procId,1144,*comm);
     //
     v1Local->decrRef();
     v2Local->decrRef();