You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, stdlib does not support the sorting of bitset arrays. Support for sorting arrays of bitsets may allow stdlib to apply to modern numerical simulations.
In recent years, adaptive mesh refinement (AMR) has attracted much attention in fluid simulations. In some research aimed at the efficient implementation of AMR, a bit sequence like 11010010 representing the grid position and refinement level is used as an ID for a grid, and the bitset is used to store IDs.
The IDs represented by bitsets are sorted for load balancing in parallel computations. stdlib has bitsets but cannot perform sorting. This prevents the implementation of AMR using stdlib.
Thus, it is worth supporting sorting arrays of bitsets.
stdlib already implements the assignment operator (=) and comparison operators (>, >=, <, <=) for bitsets. So it is easy to support sorting arrays of bitsets by adding a few lines to stdlib_sorting.fypp and related files:
+#! Derived type bitsets+#:set BITSET_KINDS = ["bitset_64", "bitset_large"]++#! Bitset types to be considered during templating+#:set BITSET_TYPES = ["type({})".format(k) for k in BITSET_KINDS]
+#:set BITSET_TYPES_ALT_NAME = list(zip(BITSET_TYPES, BITSET_TYPES, BITSET_KINDS))#! For better code reuse in fypp, make lists that contain the input types,#! with each having output types and a separate name prefix for subroutines#! This approach allows us to have the same code for all input types.-#:set IRSC_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME + STRING_TYPES_ALT_NAME + CHAR_TYPES_ALT_NAME+#:set IRSC_TYPES_ALT_NAME = INT_TYPES_ALT_NAME + REAL_TYPES_ALT_NAME + STRING_TYPES_ALT_NAME + CHAR_TYPES_ALT_NAME + BITSET_TYPES_ALT_NAME
The text was updated successfully, but these errors were encountered:
degawa
added
the
idea
Proposition of an idea and opening an issue to discuss it
label
Jun 20, 2023
Thank you @degawa . I think it is a good idea and doable.
It seems that you already identified the changes in stdlib_sorting.fypp. Would you like to give it a try and open a MR?
Motivation
Currently, stdlib does not support the sorting of bitset arrays. Support for sorting arrays of bitsets may allow stdlib to apply to modern numerical simulations.
In recent years, adaptive mesh refinement (AMR) has attracted much attention in fluid simulations. In some research aimed at the efficient implementation of AMR, a bit sequence like
11010010
representing the grid position and refinement level is used as an ID for a grid, and the bitset is used to store IDs.The IDs represented by bitsets are sorted for load balancing in parallel computations. stdlib has bitsets but cannot perform sorting. This prevents the implementation of AMR using stdlib.
Thus, it is worth supporting sorting arrays of bitsets.
Prior Art
std::bitset
to represent IDs in their implementation of AMR using C++.Additional Information
stdlib already implements the assignment operator (
=
) and comparison operators (>, >=, <, <=
) for bitsets. So it is easy to support sorting arrays of bitsets by adding a few lines to stdlib_sorting.fypp and related files:The text was updated successfully, but these errors were encountered: