X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEM%2FElementLocator.cxx;h=3c1f9d4264a9e986ccc338d9991dfe60e8352f42;hb=c41e6035d050073ea10040690daae247865b8b74;hp=8e15db02ddf46aa3c13fe9f0e54c15fcada8ce88;hpb=10f37bf6f33a762626d7f1093b2f5450c1688667;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM/ElementLocator.cxx b/src/ParaMEDMEM/ElementLocator.cxx index 8e15db02d..3c1f9d426 100644 --- a/src/ParaMEDMEM/ElementLocator.cxx +++ b/src/ParaMEDMEM/ElementLocator.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -27,7 +27,7 @@ #include "ProcessorGroup.hxx" #include "MPIProcessorGroup.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include "DirectedBoundingBox.hxx" #include @@ -38,7 +38,7 @@ using namespace std; //#define USE_DIRECTED_BB -namespace ParaMEDMEM +namespace MEDCoupling { ElementLocator::ElementLocator(const ParaFIELD& sourceField, const ProcessorGroup& distant_group, @@ -71,14 +71,14 @@ namespace ParaMEDMEM return _local_para_field.getField()->getNature(); } - // ========================================================================== - // Procedure for exchanging mesh between a distant proc and a local processor - // param idistantrank proc id on distant group - // param distant_mesh on return , points to a local reconstruction of - // the distant mesh - // param distant_ids on return, contains a vector defining a correspondence - // between the distant ids and the ids of the local reconstruction - // ========================================================================== + + /*! Procedure for exchanging a mesh between a distant proc and a local processor + \param idistantrank proc id on distant group + \param distant_mesh on return , points to a local reconstruction of + the distant mesh + \param distant_ids on return, contains a vector defining a correspondence + between the distant ids and the ids of the local reconstruction + */ void ElementLocator::exchangeMesh(int idistantrank, MEDCouplingPointSet*& distant_mesh, int*& distant_ids) @@ -88,19 +88,19 @@ namespace ParaMEDMEM if (find(_distant_proc_ids.begin(), _distant_proc_ids.end(),rank)==_distant_proc_ids.end()) return; - vector elems; + MCAuto elems; #ifdef USE_DIRECTED_BB INTERP_KERNEL::DirectedBoundingBox dbb; double* distant_bb = _domain_bounding_boxes+rank*dbb.dataSize(_local_cell_mesh_space_dim); dbb.setData(distant_bb); - _local_cell_mesh->getCellsInBoundingBox(dbb,getBoundingBoxAdjustment(),elems); + elems=_local_cell_mesh->getCellsInBoundingBox(dbb,getBoundingBoxAdjustment()); #else double* distant_bb = _domain_bounding_boxes+rank*2*_local_cell_mesh_space_dim; - _local_cell_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment(),elems); + elems=_local_cell_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment()); #endif DataArrayInt *distant_ids_send; - MEDCouplingPointSet *send_mesh = (MEDCouplingPointSet *)_local_para_field.getField()->buildSubMeshData(&elems[0],&elems[elems.size()],distant_ids_send); + MEDCouplingPointSet *send_mesh = (MEDCouplingPointSet *)_local_para_field.getField()->buildSubMeshData(elems->begin(),elems->end(),distant_ids_send); _exchangeMesh(send_mesh, distant_mesh, idistantrank, distant_ids_send, distant_ids); distant_ids_send->decrRef(); @@ -127,10 +127,10 @@ namespace ParaMEDMEM } - // ====================== - // Compute bounding boxes - // ====================== + /*! + Compute bounding boxes + */ void ElementLocator::_computeBoundingBoxes() { CommInterface comm_interface =_union_group->getCommInterface(); @@ -194,9 +194,10 @@ namespace ParaMEDMEM } - // ============================================= - // Intersect Bounding Box (with a given "irank") - // ============================================= + + /*! + * Intersect local bounding box with a given distant bounding box on "irank" + */ bool ElementLocator::_intersectsBoundingBox(int irank) { #ifdef USE_DIRECTED_BB @@ -208,9 +209,9 @@ namespace ParaMEDMEM double* local_bb = _domain_bounding_boxes+_union_group->myRank()*2*_local_cell_mesh_space_dim; double* distant_bb = _domain_bounding_boxes+irank*2*_local_cell_mesh_space_dim; + const double eps = 1e-12; for (int idim=0; idim < _local_cell_mesh_space_dim; idim++) { - const double eps = 1e-12; bool intersects = (distant_bb[idim*2]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 +354,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 +386,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 +438,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 +453,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 +681,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); } } @@ -694,7 +696,7 @@ namespace ParaMEDMEM CommInterface comm; DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering(); const int *globalIdsC=globalIds->getConstPointer(); - MEDCouplingAutoRefCountObjectPtr candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes(); + MCAuto candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes(); for(int *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++) (*iter1)=globalIdsC[*iter1]; std::set candidatesS(candidates->begin(),candidates->end());