From 2b23b0734a1cc323ffaa38f90afbbf18c2037b73 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 19 Aug 2022 14:53:09 +0200 Subject: [PATCH] Remove useless usage of dynamic allocation into BoundingBox class --- src/INTERP_KERNEL/BoundingBox.cxx | 17 +---------------- src/INTERP_KERNEL/BoundingBox.hxx | 4 ++-- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/INTERP_KERNEL/BoundingBox.cxx b/src/INTERP_KERNEL/BoundingBox.cxx index ab192e4f6..db5fd0918 100644 --- a/src/INTERP_KERNEL/BoundingBox.cxx +++ b/src/INTERP_KERNEL/BoundingBox.cxx @@ -36,10 +36,7 @@ namespace INTERP_KERNEL * */ BoundingBox::BoundingBox(const double** pts, const unsigned numPts) - :_coords(new double[6]) { - assert(numPts > 0); - // initialize with first two points const double *pt0(pts[0]); @@ -63,11 +60,8 @@ namespace INTERP_KERNEL * @param box1 the first box * @param box2 the second box */ - BoundingBox::BoundingBox(const BoundingBox& box1, const BoundingBox& box2) - : _coords(new double[6]) + BoundingBox::BoundingBox(const BoundingBox& box1, const BoundingBox& box2) { - assert(_coords != 0); - for(BoxCoord c = XMIN ; c <= ZMIN ; c = BoxCoord(c + 1)) { _coords[c] = std::min(box1._coords[c], box2._coords[c]); @@ -77,15 +71,6 @@ namespace INTERP_KERNEL assert(isValid()); } - /** - * Destructor - * - */ - BoundingBox::~BoundingBox() - { - delete [] _coords; - } - /** * Determines if the intersection with a given box is empty * diff --git a/src/INTERP_KERNEL/BoundingBox.hxx b/src/INTERP_KERNEL/BoundingBox.hxx index d453e8a62..52641ccf3 100644 --- a/src/INTERP_KERNEL/BoundingBox.hxx +++ b/src/INTERP_KERNEL/BoundingBox.hxx @@ -41,7 +41,7 @@ namespace INTERP_KERNEL BoundingBox(const BoundingBox& box1, const BoundingBox& box2); - ~BoundingBox(); + ~BoundingBox() { } bool isDisjointWith(const BoundingBox& box) const; @@ -67,7 +67,7 @@ namespace INTERP_KERNEL /// Vector containing the coordinates of the box /// interlaced in the order XMIN, YMIN, ZMIN, XMAX, YMAX, ZMAX - double* _coords; + double _coords[6]; }; -- 2.39.2