TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Static_Int_Lists_32_64< _SIZE_ > Class Template Reference

This class allows storing lists of integers accessible in constant time. More...

#include <Static_Int_Lists.h>

Public Types

using int_t = _SIZE_
using ArrOfInt_t = ArrOfInt_T<_SIZE_>
using ArrsOfInt_t = ArrsOfInt_T<_SIZE_>

Public Member Functions

void set_list_sizes (const ArrOfInt_t &sizes)
 Destroys existing lists and creates new ones.
void reset ()
 Destroys all lists.
void copy_list_to_array (int_t i_liste, ArrOfInt_t &array) const
 Copies the i-th list into the provided array. The array must be resizable.
void set_value (int_t i_liste, int_t i_element, int_t valeur)
 Assigns "valeur" to the j-th element of the i-th list with 0 <= i < get_nb_lists() and 0 <= j < get_list_size(i).
int_t operator() (int_t i_liste, int_t i_element) const
 Returns the j-th element of the i-th list with 0 <= i < get_nb_lists() and 0 <= j < get_list_size(i).
int_t get_list_size (int_t i_liste) const
 Returns the number of elements in list i.
int_t get_nb_lists () const
 Returns the number of stored lists.
const ArrOfInt_tget_index () const
const ArrOfInt_tget_data () const
void set_data (const ArrOfInt_t &data)
 Replaces the values stored in all lists with those from the data array.
void set_index_data (const ArrOfInt_t &index, const ArrOfInt_t &data)
 Replaces index and data arrays.
void trier_liste (int_t i)
 Sorts the values of the i-th list in ascending order.
void set (const ArrsOfInt_t &src)
SortieprintOn (Sortie &os) const
EntreereadOn (Entree &is)
Sortieecrire (Sortie &os) const

Detailed Description

template<typename _SIZE_>
class Static_Int_Lists_32_64< _SIZE_ >

This class allows storing lists of integers accessible in constant time.

The size of the lists cannot change without losing the content (these are static lists). Example: Static_Int_List l; ArrOfInt tailles(3); tailles[0] = 2; tailles[1] = 3; tailles[2] = 0; // Reserve memory for three lists of size 2, 3 and 0: l.set_list_sizes(tailles); // Assign a value to the second element of the first list: l.set_value(0,1,765); // Print the value Cout << l(0,1);

Definition at line 38 of file Static_Int_Lists.h.

Member Typedef Documentation

◆ ArrOfInt_t

template<typename _SIZE_>
using Static_Int_Lists_32_64< _SIZE_ >::ArrOfInt_t = ArrOfInt_T<_SIZE_>

Definition at line 42 of file Static_Int_Lists.h.

◆ ArrsOfInt_t

template<typename _SIZE_>
using Static_Int_Lists_32_64< _SIZE_ >::ArrsOfInt_t = ArrsOfInt_T<_SIZE_>

Definition at line 43 of file Static_Int_Lists.h.

◆ int_t

template<typename _SIZE_>
using Static_Int_Lists_32_64< _SIZE_ >::int_t = _SIZE_

Definition at line 41 of file Static_Int_Lists.h.

Member Function Documentation

◆ copy_list_to_array()

template<typename _SIZE_>
void Static_Int_Lists_32_64< _SIZE_ >::copy_list_to_array ( int_t i,
ArrOfInt_t & array ) const

Copies the i-th list into the provided array. The array must be resizable.

Parameters
iindex of the list to copy
arraydestination array to fill

Definition at line 124 of file Static_Int_Lists.cpp.

◆ ecrire()

template<typename _SIZE_>
Sortie & Static_Int_Lists_32_64< _SIZE_ >::ecrire ( Sortie & os) const

Definition at line 154 of file Static_Int_Lists.cpp.

◆ get_data()

template<typename _SIZE_>
const ArrOfInt_t & Static_Int_Lists_32_64< _SIZE_ >::get_data ( ) const
inline

Definition at line 55 of file Static_Int_Lists.h.

◆ get_index()

template<typename _SIZE_>
const ArrOfInt_t & Static_Int_Lists_32_64< _SIZE_ >::get_index ( ) const
inline

Definition at line 54 of file Static_Int_Lists.h.

◆ get_list_size()

template<typename _SIZE_>
Static_Int_Lists_32_64< _SIZE_ >::int_t Static_Int_Lists_32_64< _SIZE_ >::get_list_size ( int_t i_liste) const
inline

Returns the number of elements in list i.

Definition at line 102 of file Static_Int_Lists.h.

◆ get_nb_lists()

template<typename _SIZE_>
Static_Int_Lists_32_64< _SIZE_ >::int_t Static_Int_Lists_32_64< _SIZE_ >::get_nb_lists ( ) const
inline

Returns the number of stored lists.

Definition at line 111 of file Static_Int_Lists.h.

◆ operator()()

template<typename _SIZE_>
Static_Int_Lists_32_64< _SIZE_ >::int_t Static_Int_Lists_32_64< _SIZE_ >::operator() ( int_t i_liste,
int_t i_element ) const
inline

Returns the j-th element of the i-th list with 0 <= i < get_nb_lists() and 0 <= j < get_list_size(i).

Definition at line 90 of file Static_Int_Lists.h.

◆ printOn()

template<typename _SIZE_>
Sortie & Static_Int_Lists_32_64< _SIZE_ >::printOn ( Sortie & os) const

Definition at line 133 of file Static_Int_Lists.cpp.

◆ readOn()

template<typename _SIZE_>
Entree & Static_Int_Lists_32_64< _SIZE_ >::readOn ( Entree & is)

Definition at line 143 of file Static_Int_Lists.cpp.

◆ reset()

template<typename _SIZE_>
void Static_Int_Lists_32_64< _SIZE_ >::reset ( )

Destroys all lists.

Definition at line 21 of file Static_Int_Lists.cpp.

◆ set()

template<typename _SIZE_>
void Static_Int_Lists_32_64< _SIZE_ >::set ( const ArrsOfInt_t & src)

Definition at line 178 of file Static_Int_Lists.cpp.

◆ set_data()

template<typename _SIZE_>
void Static_Int_Lists_32_64< _SIZE_ >::set_data ( const ArrOfInt_t & data)

Replaces the values stored in all lists with those from the data array.

data must have a size equal to the sum of the sizes of all lists.

Definition at line 58 of file Static_Int_Lists.cpp.

◆ set_index_data()

template<typename _SIZE_>
void Static_Int_Lists_32_64< _SIZE_ >::set_index_data ( const ArrOfInt_t & index,
const ArrOfInt_t & data )

Replaces index and data arrays.

Parameters
indexthe new index array
datathe new data array

Definition at line 89 of file Static_Int_Lists.cpp.

◆ set_list_sizes()

template<typename _SIZE_>
void Static_Int_Lists_32_64< _SIZE_ >::set_list_sizes ( const ArrOfInt_t & sizes)

Destroys existing lists and creates new ones.

Creates as many lists as there are elements in the sizes array. The i-th list has a size of sizes[i]. The sizes values must be non-negative.

Definition at line 35 of file Static_Int_Lists.cpp.

◆ set_value()

template<typename _SIZE_>
void Static_Int_Lists_32_64< _SIZE_ >::set_value ( int_t i_liste,
int_t i_element,
int_t valeur )
inline

Assigns "valeur" to the j-th element of the i-th list with 0 <= i < get_nb_lists() and 0 <= j < get_list_size(i).

Definition at line 79 of file Static_Int_Lists.h.

◆ trier_liste()

template<typename _SIZE_>
void Static_Int_Lists_32_64< _SIZE_ >::trier_liste ( int_t num_liste)

Sorts the values of the i-th list in ascending order.

If num_liste < 0, all lists are sorted.

Parameters
num_listeindex of the list to sort, or -1 to sort all lists

Definition at line 103 of file Static_Int_Lists.cpp.


The documentation for this class was generated from the following files: