From: Anthony Geay Date: Mon, 22 Aug 2022 07:52:12 +0000 (+0200) Subject: End of memory usage optimization X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8e5e8336a49cb4dfb8a158645289616d6dac42ac;p=tools%2Fmedcoupling.git End of memory usage optimization --- diff --git a/src/INTERP_KERNEL/Interpolation2D3D.txx b/src/INTERP_KERNEL/Interpolation2D3D.txx index 1412a0001..73960e815 100755 --- a/src/INTERP_KERNEL/Interpolation2D3D.txx +++ b/src/INTERP_KERNEL/Interpolation2D3D.txx @@ -71,12 +71,8 @@ namespace INTERP_KERNEL LOG(2, "Target mesh has " << numTargetElems << " elements "); - std::vector< MeshElement > targetElems(numTargetElems); DuplicateFacesType intersectFaces; - for(ConnType i = 0 ; i < numTargetElems ; ++i) - targetElems[i].assign(i, targetMesh); - std::unique_ptr< Intersector3D > intersector; std::string methC = InterpolationOptions::filterInterpolationMethod(method); const double dimCaracteristic = CalculateCharacteristicSizeOfMeshes(srcMesh, targetMesh, InterpolationOptions::getPrintLevel()); @@ -109,7 +105,9 @@ namespace INTERP_KERNEL // - calculate intersection by calling intersectCells for(ConnType i = 0; i < numTargetElems; ++i) { - const BoundingBox* box = targetElems[i].getBoundingBox(); + MeshElement trgMeshElem(i, targetMesh); + + const BoundingBox *box = trgMeshElem.getBoundingBox(); // get target bbox in right order double targetBox[6]; @@ -120,8 +118,7 @@ namespace INTERP_KERNEL tree.getIntersectingElems(targetBox, intersectElems); if ( !intersectElems.empty() ) - intersector->intersectCells(i, intersectElems, matrix); - + intersector->intersectCells(i, intersectElems, matrix); } DuplicateFacesType::iterator iter; diff --git a/src/INTERP_KERNEL/Interpolation3D.txx b/src/INTERP_KERNEL/Interpolation3D.txx index 1cebcd47f..c93dffcbb 100755 --- a/src/INTERP_KERNEL/Interpolation3D.txx +++ b/src/INTERP_KERNEL/Interpolation3D.txx @@ -85,13 +85,6 @@ namespace INTERP_KERNEL LOG(2, "Target mesh has " << numTargetElems << " elements "); - std::vector< MeshElement > targetElems(numTargetElems); - - for(ConnType i = 0 ; i < numTargetElems ; ++i) - { - targetElems[i].assign(i, targetMesh); - } - std::unique_ptr> intersector; std::string methC = InterpolationOptions::filterInterpolationMethod(method); if(methC=="P0P0") @@ -307,7 +300,9 @@ namespace INTERP_KERNEL // - calculate intersection by calling intersectCells for(ConnType i = 0; i < numTargetElems; ++i) { - const BoundingBox* box = targetElems[i].getBoundingBox(); + MeshElement trgMeshElem(i, targetMesh); + + const BoundingBox *box = trgMeshElem.getBoundingBox(); // get target bbox in right order double targetBox[6]; diff --git a/src/INTERP_KERNEL/Interpolation3D1D.txx b/src/INTERP_KERNEL/Interpolation3D1D.txx index 47d6e4505..6a619ee14 100755 --- a/src/INTERP_KERNEL/Interpolation3D1D.txx +++ b/src/INTERP_KERNEL/Interpolation3D1D.txx @@ -49,11 +49,6 @@ namespace INTERP_KERNEL LOG(2, "Target mesh has " << numTargetElems << " elements "); - std::vector< MeshElement > targetElems(numTargetElems); - - for(ConnType i = 0 ; i < numTargetElems ; ++i) - targetElems[i].assign(i, targetMesh); - std::unique_ptr< Intersector3D > intersector; std::string methC = InterpolationOptions::filterInterpolationMethod(method); if(methC=="P0P0") @@ -79,7 +74,9 @@ namespace INTERP_KERNEL // - calculate intersection by calling intersectCells for(ConnType i = 0; i < numTargetElems; ++i) { - const BoundingBox* box = targetElems[i].getBoundingBox(); + MeshElement trgMeshElem(i, targetMesh); + + const BoundingBox* box = trgMeshElem.getBoundingBox(); // get target bbox in right order double targetBox[6]; box->fillInXMinXmaxYminYmaxZminZmaxFormat(targetBox); diff --git a/src/INTERP_KERNEL/InterpolationHelper.txx b/src/INTERP_KERNEL/InterpolationHelper.txx index b89ff8a0e..4fcde3237 100755 --- a/src/INTERP_KERNEL/InterpolationHelper.txx +++ b/src/INTERP_KERNEL/InterpolationHelper.txx @@ -40,20 +40,15 @@ namespace INTERP_KERNEL using ConnType = typename MyMeshType::MyConnType; const ConnType numSrcElems = srcMesh.getNumberOfElements(); LOG(2, "Source mesh has " << numSrcElems << " elements"); - std::vector< MeshElement > srcElems(numSrcElems); - - for(ConnType i = 0 ; i < numSrcElems ; ++i) - { - srcElems[i].assign(i,srcMesh); - } // create BBTree structure // - get bounding boxes const ConnType nbElts = 6 * numSrcElems; std::unique_ptr bboxes( new double[nbElts] ); for(ConnType i = 0; i < numSrcElems ; ++i) { + MeshElement srcElem(i,srcMesh); // get source bboxes in right order - const BoundingBox *box = srcElems[i].getBoundingBox(); + const BoundingBox *box( srcElem.getBoundingBox() ); box->fillInXMinXmaxYminYmaxZminZmaxFormat(bboxes.get()+6*i); } bboxAdjuster(bboxes.get(),nbElts);