Skip to content

Commit

Permalink
Suggestion by @roigcarlo
Browse files Browse the repository at this point in the history
  • Loading branch information
loumalouomega committed Dec 20, 2023
1 parent 6aea813 commit f638046
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions kratos/utilities/search_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,6 @@ class SearchUtilities

// Auxiliary variables
std::size_t counter = 0;
array_1d<double, 3> coordinates;
unsigned int i_coord;

// If distributed
Expand All @@ -717,11 +716,11 @@ class SearchUtilities
continue; // Skip if not local
}
}
noalias(coordinates) = it_point->Coordinates();
const auto& r_coordinates = it_point->Coordinates();
GetId(send_points_ids, it_point, counter, initial_id);
send_points_ranks[counter] = rank;
for (i_coord = 0; i_coord < 3; ++i_coord) {
send_points_coordinates[3 * counter + i_coord] = coordinates[i_coord];
send_points_coordinates[3 * counter + i_coord] = r_coordinates[i_coord];
}
++counter;
}
Expand Down Expand Up @@ -756,14 +755,14 @@ class SearchUtilities
} else { // Serial
// Assign values
for (auto it_point = itPointBegin ; it_point != itPointEnd ; ++it_point) {
noalias(coordinates) = it_point->Coordinates();
const auto& r_coordinates = it_point->Coordinates();
if constexpr (std::is_same<TPointIteratorType, ModelPart::NodeIterator>::value || std::is_same<TPointIteratorType, ModelPart::NodeConstantIterator>::value) {
rAllPointsIds[counter] = it_point->Id();
} else {
rAllPointsIds[counter] = initial_id + counter;
}
for (i_coord = 0; i_coord < 3; ++i_coord) {
rAllPointsCoordinates[3 * counter + i_coord] = coordinates[i_coord];
rAllPointsCoordinates[3 * counter + i_coord] = r_coordinates[i_coord];
}
++counter;
}
Expand Down Expand Up @@ -813,7 +812,6 @@ class SearchUtilities

// Some definitions
IndexType i_coord = 0;
array_1d<double, 3> coordinates;

// If distributed
if (rDataCommunicator.IsDistributed()) {
Expand Down Expand Up @@ -865,9 +863,9 @@ class SearchUtilities
for (IndexType i_point = 0 ; i_point < total_number_of_points; ++i_point) {
auto it_point = itPointBegin + i_point;
if (PointIsInsideBoundingBox(rBoundingBox, *it_point, ThresholdBoundingBox)) {
noalias(coordinates) = it_point->Coordinates();
const auto& r_coordinates = it_point->Coordinates();
for (i_coord = 0; i_coord < 3; ++i_coord) {
rSearchInfo.PointCoordinates.push_back(coordinates[i_coord]);
rSearchInfo.PointCoordinates.push_back(r_coordinates[i_coord]);
}
rSearchInfo.Indexes.push_back(all_points_ids[i_point]);
rSearchInfo.Ranks.push_back({0});
Expand Down

0 comments on commit f638046

Please sign in to comment.