Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for wrapped coordinates #80

Merged
merged 9 commits into from
Feb 13, 2025

Conversation

AuroraPerego
Copy link
Contributor

No description provided.

@@ -37,11 +37,11 @@
}

// use a custom deleter to destroy all objects and deallocate the memory
auto deleter = [size](Allocator* ptr) {
auto deleter = [size](Allocator* pointer) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 13.1 rule Note

MISRA 13.1 rule
for (size_t i = size; i > 0; --i) {
(ptr + i - 1)->~Allocator();
(pointer + i - 1)->~Allocator();

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 18.4 rule Note

MISRA 18.4 rule
for (size_t i = size; i > 0; --i) {
(ptr + i - 1)->~Allocator();
(pointer + i - 1)->~Allocator();

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 10.4 rule Note

MISRA 10.4 rule

ALPAKA_FN_HOST_ACC inline constexpr float normalizeCoordinate(float coord, int dim) const {
const float range = min_max.range(dim);
float remainder = coord - static_cast<int>(coord / range) * range;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 10.4 rule Note

MISRA 10.4 rule
if (remainder >= min_max.max(dim))
remainder -= range;
else if (remainder < min_max.min(dim))
remainder += range;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.7 rule Note

MISRA 15.7 rule
m_view->coords = floatBuffer;
m_view->weights = floatBuffer + m_shape.nPoints * m_shape.nDim;
m_view->weights = floatBuffer + m_info.nPoints * Ndim;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.1 rule Note

MISRA 12.1 rule
m_view->coords = floatBuffer;
m_view->weights = floatBuffer + m_shape.nPoints * m_shape.nDim;
m_view->weights = floatBuffer + m_info.nPoints * Ndim;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 18.4 rule Note

MISRA 18.4 rule
@AuroraPerego AuroraPerego force-pushed the wrappedCoordinates branch 2 times, most recently from f6859f2 to b87767f Compare January 28, 2025 09:56
for (int dim{}; dim != Ndim; ++dim) {
dist_ij_sq += (coords_j[dim] - coords_i[dim]) * (coords_j[dim] - coords_i[dim]);
}
float dist_ij_sq = tiles->distance(coords_i, coords_j);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
int dim) const {
const float range = minmax->range(dim);
float remainder = coord - static_cast<int>(coord / range) * range;
if (remainder >= minmax->max(dim))

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.6 rule Note

MISRA 15.6 rule
float remainder = coord - static_cast<int>(coord / range) * range;
if (remainder >= minmax->max(dim))
remainder -= range;
else if (remainder < minmax->min(dim))

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.6 rule Note

MISRA 15.6 rule
template <typename TAcc>
ALPAKA_FN_ACC inline constexpr int getBin(const TAcc& acc,
float coord,
int dim) const {
int coord_bin{(int)((coord - minmax->min(dim)) / tilesizes[dim])};
int coord_bin;
if (wrapping[dim]) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 14.4 rule Note

MISRA 14.4 rule
dim_sb.push_back_unsafe(getBin(acc, sb_extremes[dim][1], dim));
auto infBin = getBin(acc, sb_extremes[dim][0], dim);
auto supBin = getBin(acc, sb_extremes[dim][1], dim);
if (wrapping[dim] and infBin > supBin)

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.1 rule Note

MISRA 12.1 rule
dim_sb.push_back_unsafe(getBin(acc, sb_extremes[dim][1], dim));
auto infBin = getBin(acc, sb_extremes[dim][0], dim);
auto supBin = getBin(acc, sb_extremes[dim][1], dim);
if (wrapping[dim] and infBin > supBin)

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.6 rule Note

MISRA 15.6 rule
ALPAKA_FN_ACC inline float distance(const float* coord_i, const float* coord_j) {
float dist_sq = 0.f;
for (int dim = 0; dim != Ndim; ++dim) {
if (wrapping[dim])

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 14.4 rule Note

MISRA 14.4 rule
ALPAKA_FN_ACC inline float distance(const float* coord_i, const float* coord_j) {
float dist_sq = 0.f;
for (int dim = 0; dim != Ndim; ++dim) {
if (wrapping[dim])

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.6 rule Note

MISRA 15.6 rule
m_view->coords = floatBuffer;
m_view->weights = floatBuffer + m_shape.nPoints * m_shape.nDim;
m_view->weights = floatBuffer + m_info.nPoints * Ndim;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 18.4 rule Note

MISRA 18.4 rule
m_view->coords = floatBuffer;
m_view->weights = floatBuffer + m_shape.nPoints * m_shape.nDim;
m_view->weights = floatBuffer + m_info.nPoints * Ndim;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.1 rule Note

MISRA 12.1 rule
m_view->clusterIndexes = intBuffer;
m_view->isSeed = intBuffer + m_shape.nPoints;
m_view->isSeed = intBuffer + m_info.nPoints;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 18.4 rule Note

MISRA 18.4 rule
@sbaldu sbaldu self-requested a review February 12, 2025 17:22
Copy link
Collaborator

@sbaldu sbaldu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update to version 2.5.1 please?

@AuroraPerego
Copy link
Contributor Author

Can you update to version 2.5.1 please?

done :)

@sbaldu sbaldu changed the title add support for wrapped coordinates Add support for wrapped coordinates Feb 13, 2025
@sbaldu sbaldu merged commit ca40359 into cms-patatrack:main Feb 13, 2025
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants