From b5325a0fd1eea46169998a42e4b5d9cd74140c2e Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 28 Aug 2020 09:30:52 -0400 Subject: [PATCH] Use std::array in BoundingBox::get_neighbor_type(). The std::vectors are of fixed length so we might as well. --- source/base/bounding_box.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/base/bounding_box.cc b/source/base/bounding_box.cc index f4d9ec10e3..4ad11f15eb 100644 --- a/source/base/bounding_box.cc +++ b/source/base/bounding_box.cc @@ -70,12 +70,12 @@ BoundingBox::get_neighbor_type( } else { - std::vector> bbox1; - bbox1.push_back(this->get_boundary_points().first); - bbox1.push_back(this->get_boundary_points().second); - std::vector> bbox2; - bbox2.push_back(other_bbox.get_boundary_points().first); - bbox2.push_back(other_bbox.get_boundary_points().second); + std::array, 2> bbox1; + bbox1[0] = this->get_boundary_points().first; + bbox1[1] = this->get_boundary_points().second; + std::array, 2> bbox2; + bbox2[0] = other_bbox.get_boundary_points().first; + bbox2[1] = other_bbox.get_boundary_points().second; // Step 1: testing if the boxes are close enough to intersect for (unsigned int d = 0; d < spacedim; ++d) @@ -87,12 +87,12 @@ BoundingBox::get_neighbor_type( // The boxes intersect: we need to understand now how they intersect. // We begin by computing the intersection: - std::vector intersect_bbox_min; - std::vector intersect_bbox_max; + std::array intersect_bbox_min; + std::array intersect_bbox_max; for (unsigned int d = 0; d < spacedim; ++d) { - intersect_bbox_min.push_back(std::max(bbox1[0][d], bbox2[0][d])); - intersect_bbox_max.push_back(std::min(bbox1[1][d], bbox2[1][d])); + intersect_bbox_min[d] = std::max(bbox1[0][d], bbox2[0][d]); + intersect_bbox_max[d] = std::min(bbox1[1][d], bbox2[1][d]); } // Finding the intersection's dimension -- 2.39.5