From: secher Date: Wed, 11 Mar 2009 13:56:01 +0000 (+0000) Subject: improve algorithm X-Git-Tag: V5_1_main_FINAL~425 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ab7e95e9a0ebd0a5264bf9d1e90281c8800df406;p=tools%2Fmedcoupling.git improve algorithm --- diff --git a/src/ParaMEDMEM/InterpolationMatrix.cxx b/src/ParaMEDMEM/InterpolationMatrix.cxx index e4605258c..162251141 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.cxx +++ b/src/ParaMEDMEM/InterpolationMatrix.cxx @@ -182,9 +182,7 @@ namespace ParaMEDMEM double surf = target_triangle_surf->getIJ(iter->first,0); //locating the (iproc, itriangle) pair in the list of columns - vector >::iterator iter2 = - find(_col_offsets.begin(), _col_offsets.end(), - make_pair(iproc_distant,iter->first)); + map,int >::iterator iter2 = _col_offsets.find(make_pair(iproc_distant,iter->first)); int col_id; if (iter2 == _col_offsets.end()) @@ -192,15 +190,15 @@ namespace ParaMEDMEM //(iproc, itriangle) is not registered in the list //of distant elements - _col_offsets.push_back(make_pair(iproc_distant,iter->first)); - col_id =_col_offsets.size(); + col_id =_col_offsets.size()+1; + _col_offsets.insert(make_pair(make_pair(iproc_distant,iter->first),col_id)); _mapping.addElementFromSource(iproc_distant, distant_elems[iter->first]); _target_volume.push_back(surf); } else { - col_id = iter2 - _col_offsets.begin() + 1; + col_id = iter2->second; } //the non zero coefficient is stored diff --git a/src/ParaMEDMEM/InterpolationMatrix.hxx b/src/ParaMEDMEM/InterpolationMatrix.hxx index c0c6984a8..1c8906984 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.hxx +++ b/src/ParaMEDMEM/InterpolationMatrix.hxx @@ -51,7 +51,7 @@ namespace ParaMEDMEM static MEDCouplingFieldDouble *getSupportUnstructuredVolumes(MEDCouplingUMesh *field); private: std::vector _row_offsets; - std::vector > _col_offsets; + std::map, int > _col_offsets; MEDCouplingUMesh *_source_support; MxN_Mapping _mapping;