From: David Wells Date: Fri, 28 Aug 2020 13:30:52 +0000 (-0400) Subject: Use std::array in BoundingBox::get_neighbor_type(). X-Git-Tag: v9.3.0-rc1~1161^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F10855%2Fhead;p=dealii.git Use std::array in BoundingBox::get_neighbor_type(). The std::vectors are of fixed length so we might as well. --- 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