|
Template Numerical Library version\ main:4e6e2c1
|
Data structure for sorted segments. More...
#include <TNL/Algorithms/Segments/SortedSegments.h>
Public Types | |
| using | ConstPermutationView |
| using | ConstViewType = SortedSegmentsView< typename EmbeddedSegments::ConstViewType > |
| Type of constant segments view. | |
| using | DeviceType |
| The device where the segments are operating. | |
| using | EmbeddedSegmentsConstView |
| using | EmbeddedSegmentsType = EmbeddedSegments |
| using | EmbeddedSegmentsView |
| using | IndexAllocatorType = IndexAllocator |
| using | IndexType |
| The type used for indexing of segments elements. | |
| using | PermutationContainer = Containers::Vector< IndexType, DeviceType, IndexType, IndexAllocatorType > |
| Type of container storing offsets of particular segments. | |
| using | PermutationView |
| template<typename Device_ = DeviceType, typename Index_ = IndexType> | |
| using | ViewTemplate = SortedSegmentsView< typename EmbeddedSegments::template ViewTemplate< Device_, Index_ > > |
| Templated view type. | |
| using | ViewType = SortedSegmentsView< typename EmbeddedSegments::ViewType > |
| Type of segments view. | |
| Public Types inherited from TNL::Algorithms::Segments::SortedSegmentsBase< EmbeddedSegments::ViewType > | |
| using | ConstPermutationView |
| using | DeviceType |
| The device where the segments are operating. | |
| using | EmbeddedSegmentsConstView |
| using | EmbeddedSegmentsView |
| using | IndexType |
| The type used for indexing of segments elements. | |
| using | PermutationView |
| using | SegmentViewType |
| Accessor type for one particular segment. | |
Public Member Functions | |
| SortedSegments () | |
| Constructor with no parameters to create empty segments. | |
| template<typename SizesContainer, std::enable_if_t< IsArrayType< SizesContainer >::value, bool > = true> | |
| SortedSegments (const SizesContainer &segmentsSizes) | |
| Constructor that initializes segments based on their sizes. | |
| SortedSegments (const SortedSegments &segments) | |
| Copy constructor (makes deep copy). | |
| template<typename ListIndex> | |
| SortedSegments (const std::initializer_list< ListIndex > &segmentsSizes) | |
| Constructor that initializes segments using an initializer list. | |
| SortedSegments (SortedSegments &&) noexcept=default | |
| Move constructor. | |
| ConstViewType | getConstView () const |
| Returns a constant view for this instance of segments which can by used for example in lambda functions running in GPU kernels. | |
| const EmbeddedSegments & | getEmbeddedSegments () const |
| Returns a reference on embedded segments. | |
| const PermutationContainer & | getInverseSegmentsPermutation () const |
| Returns a reference on inverse segments permutation. | |
| const PermutationContainer & | getSegmentsPermutation () const |
| Returns a reference on segments permutation. | |
| ViewType | getView () |
| Returns a view for this instance of segments which can by used for example in lambda functions running in GPU kernels. | |
| void | load (File &file) |
| Method for loading the segments from a file in a binary form. | |
| SortedSegments & | operator= (const SortedSegments &segments) |
| Copy-assignment operator (makes a deep copy). | |
| template<typename EmbeddedSegments_, typename IndexAllocator_> | |
| SortedSegments & | operator= (const SortedSegments< EmbeddedSegments_, IndexAllocator_ > &segments) noexcept(false) |
| Copy-assignment operator for segments with different template parameters. | |
| SortedSegments & | operator= (SortedSegments &&) noexcept(false) |
| Move-assignment operator. | |
| template<typename EmbeddedSegments_, typename IndexAllocator_> | |
| SortedSegments & | operator= (SortedSegments< EmbeddedSegments_, IndexAllocator_ > &&segments) noexcept(false) |
| Move-assignment operator for segments with different template parameters. | |
| void | reset () |
| Reset the segments to empty states (it means that there is no segment in the segments). | |
| void | save (File &file) const |
| Method for saving the segments to a file in a binary form. | |
| template<typename SizesContainer> | |
| void | setSegmentsSizes (const SizesContainer &segmentsSizes) |
| Set sizes of particular segments. | |
| Public Member Functions inherited from TNL::Algorithms::Segments::SortedSegmentsBase< EmbeddedSegments::ViewType > | |
| __cuda_callable__ | SortedSegmentsBase ()=default |
| Default constructor with no parameters to create empty segments view. | |
| __cuda_callable__ IndexType | getElementCount () const |
| Returns the number of elements managed by all segments. | |
| __cuda_callable__ EmbeddedSegmentsConstView | getEmbeddedSegmentsView () const |
| __cuda_callable__ IndexType | getGlobalIndex (IndexType segmentIdx, IndexType localIdx) const |
| Computes the global index of an element managed by the segments. | |
| __cuda_callable__ PermutationView | getInverseSegmentsPermutationView () |
| Returns a modifiable vector view with inverse segments permutation. | |
| __cuda_callable__ IndexType | getSegmentCount () const |
| Returns the number of segments. | |
| __cuda_callable__ IndexType | getSegmentsCount () const |
| Returns the number of segments. Deprecated, use getSegmentCount(). | |
| __cuda_callable__ IndexType | getSegmentSize (IndexType segmentIdx) const |
| Returns the size of a particular segment denoted by segmentIdx. | |
| __cuda_callable__ PermutationView | getSegmentsPermutationView () |
| Returns a modifiable vector view with segments permutation. | |
| __cuda_callable__ SegmentViewType | getSegmentView (IndexType segmentIdx) const |
| Returns a segment view (i.e., a segment accessor) for the specified segment index. | |
| __cuda_callable__ IndexType | getSigma () const |
| Gets the value of sigma. | |
| __cuda_callable__ IndexType | getSize () const |
| Returns the number of elements managed by all segments. | |
| __cuda_callable__ IndexType | getStorageSize () const |
| Returns number of elements that needs to be allocated by a container connected to this segments. | |
| SortedSegmentsBase & | operator= (const SortedSegmentsBase &)=delete |
| Copy-assignment operator. | |
| __cuda_callable__ void | setSigma (IndexType value) |
| Sets the value of sigma. | |
Protected Attributes | |
| EmbeddedSegments | embeddedSegments |
| PermutationContainer | inverseSegmentsPermutation |
| PermutationContainer | segmentsPermutation |
| Protected Attributes inherited from TNL::Algorithms::Segments::SortedSegmentsBase< EmbeddedSegments::ViewType > | |
| EmbeddedSegmentsView | embeddedSegmentsView |
| PermutationView | inverseSegmentsPermutationView |
| PermutationView | segmentsPermutationView |
| Vector view with the segments permutation. | |
| IndexType | sigma |
Additional Inherited Members | |
| Static Public Member Functions inherited from TNL::Algorithms::Segments::SortedSegmentsBase< EmbeddedSegments::ViewType > | |
| static constexpr ElementsOrganization | getOrganization () |
| Returns the data layout (it is always row-major order). | |
| static std::string | getSegmentsType () |
| Returns string with the segments type. | |
| static std::string | getSerializationType () |
| Returns string with the serialization type. | |
| static constexpr bool | havePadding () |
| This function denotes if the underlying segments use the padding elements. | |
| Protected Member Functions inherited from TNL::Algorithms::Segments::SortedSegmentsBase< EmbeddedSegments::ViewType > | |
| __cuda_callable__ void | bind (const EmbeddedSegmentsView &embeddedSegmentsView, const PermutationView &segmentsPermutation, const PermutationView &inverseSegmentsPermutation) |
| Re-initializes the internal attributes of the base class. | |
Data structure for sorted segments.
See TNL::Algorithms::Segments for more details about segments.
| EmbeddedSegments | The type of embedded segments. |
| IndexAllocator | The allocator used for managing index containers. |
| using TNL::Algorithms::Segments::SortedSegments< EmbeddedSegments, IndexAllocator >::ViewTemplate = SortedSegmentsView< typename EmbeddedSegments::template ViewTemplate< Device_, Index_ > > |
Templated view type.
| Device_ | is alternative device type for the view. |
| Index_ | is alternative index type for the view. |
| TNL::Algorithms::Segments::SortedSegments< EmbeddedSegments, IndexAllocator >::SortedSegments | ( | const SizesContainer & | segmentsSizes | ) |
Constructor that initializes segments based on their sizes.
The number of segments is determined by the size of segmentsSizes. Each element in this container specifies the size of a corresponding segment.
| SizesContainer | The type of container used to store segment sizes. It can be, for example, TNL::Containers::Array or TNL::Containers::Vector. |
| segmentsSizes | An instance of the container holding the sizes of the segments. |
See the following example:
The expected output is:
| TNL::Algorithms::Segments::SortedSegments< EmbeddedSegments, IndexAllocator >::SortedSegments | ( | const std::initializer_list< ListIndex > & | segmentsSizes | ) |
Constructor that initializes segments using an initializer list.
The number of segments is determined by the size of segmentsSizes. Each element in this initializer list specifies the size of a corresponding segment.
| ListIndex | The type used for indexing elements in the initializer list. |
| segmentsSizes | An initializer list defining the sizes of the segments. |
See the following example:
The expected output is:
| void TNL::Algorithms::Segments::SortedSegments< EmbeddedSegments, IndexAllocator >::load | ( | File & | file | ) |
Method for loading the segments from a file in a binary form.
| file | is the source file. |
| void TNL::Algorithms::Segments::SortedSegments< EmbeddedSegments, IndexAllocator >::save | ( | File & | file | ) | const |
Method for saving the segments to a file in a binary form.
| file | is the target file. |
| void TNL::Algorithms::Segments::SortedSegments< EmbeddedSegments, IndexAllocator >::setSegmentsSizes | ( | const SizesContainer & | segmentsSizes | ) |
Set sizes of particular segments.
| SizesContainer | is a container with segments sizes. It can be TNL::Containers::Array or TNL::Containers::Vector for example. |
| segmentsSizes | is an instance of the container with segments sizes. |