fix: set tag type to uint8_t#437
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | -1 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull request overview
This PR updates the internal representation of cell tagging flags by making samurai::CellFlag use an 8-bit underlying type and adjusting call sites to cast to std::uint8_t when writing/reading tag bitmasks.
Changes:
- Change
CellFlagtoenum class CellFlag : std::uint8_t. - Update tagging code paths to use
static_cast<std::uint8_t>(CellFlag::...)instead ofstatic_cast<int>(...). - Reformat a small block in
algorithm/utils.hppwhile updating casts.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| include/samurai/cell_flag.hpp | Switch CellFlag underlying type to std::uint8_t. |
| include/samurai/io/from_geometry.hpp | Update tag assignments/bit-tests to use std::uint8_t casts. |
| include/samurai/algorithm/utils.hpp | Update keep-tag propagation to use std::uint8_t casts and minor formatting. |
| include/samurai/algorithm/update.hpp | Update coarsen/keep/refine mask checks to use std::uint8_t casts. |
| include/samurai/algorithm/graduation.hpp | Update refine/keep mask propagation and tag checks to use std::uint8_t casts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| namespace samurai | ||
| { | ||
| enum class CellFlag | ||
| enum class CellFlag : std::uint8_t |
| [&](std::size_t level, const auto& i, const auto& index) | ||
| { | ||
| tag(level, i, index[0], index[1]) = static_cast<int>(CellFlag::keep); | ||
| tag(level, i, index[0], index[1]) = static_cast<std::uint8_t>(CellFlag::keep); |
| #pragma once | ||
|
|
||
| namespace samurai | ||
| { | ||
| enum class CellFlag | ||
| enum class CellFlag : std::uint8_t | ||
| { |
There was a problem hiding this comment.
Pull request overview
This PR reduces the size of the cell tagging bitmask by making samurai::CellFlag explicitly use an 8-bit underlying type (std::uint8_t) and updates key tagging call sites to operate on std::uint8_t values consistently.
Changes:
- Switch
samurai::CellFlagtoenum class CellFlag : std::uint8_t(and include<cstdint>). - Store geometry-import tag fields as
std::uint8_tinstead ofint. - Update adaptation/tagging bitmask reads/writes to cast
CellFlagvalues tostd::uint8_t.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| include/samurai/cell_flag.hpp | Defines CellFlag with std::uint8_t underlying type and adds <cstdint> include. |
| include/samurai/io/from_geometry.hpp | Changes the internal tag scalar field storage to std::uint8_t and updates assignments/bit tests accordingly. |
| include/samurai/algorithm/utils.hpp | Updates CellFlag bitwise OR writes to std::uint8_t (with one remaining static_cast<int>(flag) noted). |
| include/samurai/algorithm/update.hpp | Updates refine/keep/coarsen bitmask checks to use std::uint8_t casts. |
| include/samurai/algorithm/graduation.hpp | Updates refine/keep/coarsen bitmask checks and propagation to use std::uint8_t casts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -123,15 +123,16 @@ namespace samurai | |||
| { | |||
| auto mask = (tag(level, i, j, k) & static_cast<int>(flag)); | |||
🤖 I have created a release *beep* *boop* --- ## [0.30.0](v0.29.2...v0.30.0) (2026-05-04) ### Features * ND projection and prediction operator ([#435](#435)) ([55829ab](55829ab)) ### Bug Fixes * mesh_config in load ([#438](#438)) ([7f43222](7f43222)) * set tag type to `uint8_t` ([#437](#437)) ([44e2ce7](44e2ce7)) ### Performance Improvements * improve tag computation ([#436](#436)) ([b0aadc5](b0aadc5)) * optimizations of local non-linear solvers ([#439](#439)) ([f0eedea](f0eedea)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Description
This PR updates the internal representation of cell tagging flags by making
samurai::CellFlaguse an 8-bit underlying type and adjusting call sites to cast tostd::uint8_twhen writing/reading tag bitmasks.Changes:
CellFlagtoenum class CellFlag : std::uint8_t.static_cast<std::uint8_t>(CellFlag::...)instead ofstatic_cast<int>(...).Code of Conduct
By submitting this PR, you agree to follow our Code of Conduct