]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
End of memory usage optimization
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 22 Aug 2022 07:52:12 +0000 (09:52 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 22 Aug 2022 07:52:12 +0000 (09:52 +0200)
src/INTERP_KERNEL/Interpolation2D3D.txx
src/INTERP_KERNEL/Interpolation3D.txx
src/INTERP_KERNEL/Interpolation3D1D.txx
src/INTERP_KERNEL/InterpolationHelper.txx

index 1412a0001c01eae829558aa21d0cdbc46f17d78b..73960e815d16a269ddea24a09a15fa0e8b3638b0 100755 (executable)
@@ -71,12 +71,8 @@ namespace INTERP_KERNEL
 
     LOG(2, "Target mesh has " << numTargetElems << " elements ");
 
-    std::vector< MeshElement<ConnType> > targetElems(numTargetElems);
     DuplicateFacesType intersectFaces; 
 
-    for(ConnType i = 0 ; i < numTargetElems ; ++i)
-      targetElems[i].assign(i, targetMesh);
-
     std::unique_ptr< Intersector3D<MyMeshType,MyMatrixType> > 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<ConnType> 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;
index 1cebcd47fd3f839b37e2e1ebebb95933cace936e..c93dffcbb551d121ee2c60739f0cc9752d0ed2ae 100755 (executable)
@@ -85,13 +85,6 @@ namespace INTERP_KERNEL
 
     LOG(2, "Target mesh has " << numTargetElems << " elements ");
 
-    std::vector< MeshElement<ConnType> > targetElems(numTargetElems);
-
-    for(ConnType i = 0 ; i < numTargetElems ; ++i)
-    {
-      targetElems[i].assign(i, targetMesh);
-    }
-
     std::unique_ptr<Intersector3D<MyMeshType,MatrixType>> 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<ConnType> trgMeshElem(i, targetMesh);
+
+        const BoundingBox *box = trgMeshElem.getBoundingBox();
 
         // get target bbox in right order
         double targetBox[6];
index 47d6e4505cf30466f9a645b29ac5a2e940aea79c..6a619ee145deaf7e61f05cbae005d405397be0cb 100755 (executable)
@@ -49,11 +49,6 @@ namespace INTERP_KERNEL
 
     LOG(2, "Target mesh has " << numTargetElems << " elements ");
 
-    std::vector< MeshElement<ConnType> > targetElems(numTargetElems);
-
-    for(ConnType i = 0 ; i < numTargetElems ; ++i)
-      targetElems[i].assign(i, targetMesh);
-
     std::unique_ptr< Intersector3D<MyMeshType,MatrixType> > 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<ConnType> trgMeshElem(i, targetMesh);
+        
+        const BoundingBox* box = trgMeshElem.getBoundingBox();
         // get target bbox in right order
         double targetBox[6];
         box->fillInXMinXmaxYminYmaxZminZmaxFormat(targetBox);
index b89ff8a0ec7990b4a1d6cc255d4942c745f65265..4fcde323738dd601741f2c86dc8bd15d08273730 100755 (executable)
@@ -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<ConnType> > 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<double[]> bboxes( new double[nbElts] );
     for(ConnType i = 0; i < numSrcElems ; ++i)
       {
+        MeshElement<ConnType> 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);