From: ageay Date: Tue, 29 Oct 2013 16:07:05 +0000 (+0000) Subject: Warning hunting X-Git-Tag: V7_3_1b1~74 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=169c6a89a70a5866050d9f87a58714d27d407c8a;p=tools%2Fmedcoupling.git Warning hunting --- diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx index 96160edb7..3171c1672 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -133,8 +133,7 @@ namespace ParaMEDMEM template void MemArray::pack() const { - if(_nb_of_elem>=0) - (const_cast * >(this))->reserve(_nb_of_elem); + (const_cast * >(this))->reserve(_nb_of_elem); } template @@ -337,8 +336,6 @@ namespace ParaMEDMEM void MemArray::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 void MemArray::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)); diff --git a/src/MEDCoupling/MEDCouplingMesh.cxx b/src/MEDCoupling/MEDCouplingMesh.cxx index 85186951a..4aae2aa58 100644 --- a/src/MEDCoupling/MEDCouplingMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMesh.cxx @@ -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) { diff --git a/src/MEDCoupling/MEDCouplingMultiFields.cxx b/src/MEDCoupling/MEDCouplingMultiFields.cxx index 5fe85bf7a..5980367e1 100644 --- a/src/MEDCoupling/MEDCouplingMultiFields.cxx +++ b/src/MEDCoupling/MEDCouplingMultiFields.cxx @@ -323,7 +323,7 @@ MEDCouplingMultiFields::MEDCouplingMultiFields(const std::vectorgetMesh(),*local_group,field->getMesh()->getName()); + ParaMESH *paramesh=new ParaMESH(static_cast(const_cast(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 (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(triofield)); diff --git a/src/ParaMEDMEM/ElementLocator.cxx b/src/ParaMEDMEM/ElementLocator.cxx index 52dab4385..ba9ff3627 100644 --- a/src/ParaMEDMEM/ElementLocator.cxx +++ b/src/ParaMEDMEM/ElementLocator.cxx @@ -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(reinterpret_cast(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& 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(reinterpret_cast(&eltIds[0])),lgth,MPI_INT,*iter,1115,*_comm); + comm.send(const_cast(reinterpret_cast(&valued[0])),lgth,MPI_DOUBLE,*iter,1116,*_comm); } } @@ -384,7 +384,7 @@ namespace ParaMEDMEM const vector& 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(reinterpret_cast(&eltIds[0])),lgth,MPI_INT,*iter,1122,*_comm); } } @@ -436,8 +436,8 @@ namespace ParaMEDMEM for(vector::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(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_INT,*iter,1125,*_comm); + comm.send(const_cast(reinterpret_cast(&sum[0])),lgth,MPI_DOUBLE,*iter,1126,*_comm); } } @@ -451,8 +451,8 @@ namespace ParaMEDMEM int lgth=distantGlobIds.size(); for(vector::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(reinterpret_cast(&lgth)),1,MPI_INT,*iter,1128,*_comm); + comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_INT,*iter,1129,*_comm); } } @@ -679,8 +679,8 @@ namespace ParaMEDMEM { const std::vector& 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(reinterpret_cast(&size)),1,MPI_INT,*iter,1130,*_comm); + comm.send(const_cast(reinterpret_cast(&vals[0])),size,MPI_INT,*iter,1131,*_comm); } } diff --git a/src/ParaMEDMEM/InterpolationMatrix.cxx b/src/ParaMEDMEM/InterpolationMatrix.cxx index b57b091f7..dd96381ba 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.cxx +++ b/src/ParaMEDMEM/InterpolationMatrix.cxx @@ -110,7 +110,6 @@ namespace ParaMEDMEM interpMethod+=srcMeth; //creating the interpolator structure vector > surfaces; - int colSize=0; //computation of the intersection volumes between source and target elements MEDCouplingUMesh *distant_supportC=dynamic_cast(&distant_support); MEDCouplingUMesh *source_supportC=dynamic_cast(_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(); } diff --git a/src/ParaMEDMEM/MPIAccessDEC.cxx b/src/ParaMEDMEM/MPIAccessDEC.cxx index e2db247f7..d9df4b35a 100644 --- a/src/ParaMEDMEM/MPIAccessDEC.cxx +++ b/src/ParaMEDMEM/MPIAccessDEC.cxx @@ -51,7 +51,7 @@ namespace ParaMEDMEM { procs.insert(i) ; } - MPIProcessorGroup *mpilg = (MPIProcessorGroup *)&source_group; + MPIProcessorGroup *mpilg = static_cast(const_cast(&source_group)); _MPI_union_group = new ParaMEDMEM::MPIProcessorGroup( union_group->getCommInterface(),procs,mpilg->getWorldComm()); delete union_group ; _my_rank = _MPI_union_group->myRank() ; diff --git a/src/ParaMEDMEM/OverlapElementLocator.cxx b/src/ParaMEDMEM/OverlapElementLocator.cxx index 3d1822d87..67134c4b8 100644 --- a/src/ParaMEDMEM/OverlapElementLocator.cxx +++ b/src/ParaMEDMEM/OverlapElementLocator.cxx @@ -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(idsToSend->getConstPointer()),lgth[1],MPI_INT,procId,1144,*comm); // v1Local->decrRef(); v2Local->decrRef();