TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
TRUSTArray< _TYPE_, _SIZE_ > Class Template Reference

Represents a an array of int/int64/double/... values. More...

#include <TRUSTArray.h>

Inheritance diagram for TRUSTArray< _TYPE_, _SIZE_ >:
[legend]
Collaboration diagram for TRUSTArray< _TYPE_, _SIZE_ >:
[legend]

Public Types

using Value_type_ = _TYPE_
using int_t = _SIZE_
using Iterator_ = typename tcb::span<_TYPE_>::iterator
using Vector_ = std::vector<_TYPE_, TVAlloc<_TYPE_> >
using Span_ = tcb::span<_TYPE_>

Public Member Functions

Iterator_ begin ()
Iterator_ end ()
const Iterator_ begin () const
const Iterator_ end () const
virtual ~TRUSTArray ()
 TRUSTArray ()
 TRUSTArray (_SIZE_ n)
 TRUSTArray (const TRUSTArray &A)
void resize (_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
void resize_array (_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
void ref_as_big (TRUSTArray< _TYPE_, trustIdType > &out) const
void ref_as_small (TRUSTArray< _TYPE_, int > &out) const
void from_tid_to_int (TRUSTArray< int, int > &out) const
void set_mem_storage (const STORAGE storage)
STORAGE get_mem_storage () const
std::shared_ptr< Vector_get_mem ()
TRUSTArrayoperator= (const TRUSTArray &)
_TYPE_ & operator[] (_SIZE_ i)
const _TYPE_ & operator[] (_SIZE_ i) const
_TYPE_ & operator() (_SIZE_ i)
const _TYPE_ & operator() (_SIZE_ i) const
_TYPE_ * addr ()
const _TYPE_ * addr () const
_TYPE_ * data ()
const _TYPE_ * data () const
_SIZE_ size_array () const
int ref_count () const
void append_array (_TYPE_ valeur)
TRUSTArrayoperator= (_TYPE_ x)
TRUSTArrayoperator+= (const TRUSTArray &y)
TRUSTArrayoperator+= (const _TYPE_ dy)
TRUSTArrayoperator-= (const TRUSTArray &y)
TRUSTArrayoperator-= (const _TYPE_ dy)
TRUSTArrayoperator*= (const _TYPE_ dy)
TRUSTArrayoperator/= (const _TYPE_ dy)
TRUSTArrayinject_array (const TRUSTArray &source, _SIZE_ nb_elements=-1, _SIZE_ first_element_dest=0, _SIZE_ first_element_source=0)
TRUSTArraycopy_array (const TRUSTArray &a)
void ordonne_array ()
virtual void ref_data (_TYPE_ *ptr, _SIZE_ size)
virtual void reset ()
virtual void ref_array (TRUSTArray &, _SIZE_ start=0, _SIZE_ sz=-1)
virtual void resize_tab (_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
DataLocation get_data_location ()
DataLocation get_data_location () const
void set_data_location (DataLocation flag)
void set_data_location (DataLocation flag) const
int size_mem ()
void ensureDataOnHost ()
void ensureDataOnHost () const
bool isDataOnDevice () const
bool checkDataOnDevice ()
bool checkDataOnDevice () const
bool checkDataOnDevice (const TRUSTArray &arr)
virtual Span_ get_span ()
virtual Span_ get_span_tot ()
virtual const Span_ get_span () const
virtual const Span_ get_span_tot () const
virtual _SIZE_ dimension_tot (int) const
void ref_as_big (TRUSTArray< trustIdType, trustIdType > &out) const
void ref_as_small (TRUSTArray< float, int > &out) const
void ref_as_small (TRUSTArray< int, int > &out) const
void from_tid_to_int (TRUSTArray< int, int > &out) const
Public Member Functions inherited from Objet_U
 ~Objet_U () override
 Destructeur, supprime l'objet de la liste d'objets enregistres dans "memoire".
int numero () const
 Renvoie l'indice de l'objet dans Memoire::data.
virtual int est_egal_a (const Objet_U &) const
 Renvoie 1 si l'objet x et *this sont une seule et meme instance (meme adresse en memoire).
virtual const Nomle_nom () const
 Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
virtual void nommer (const Nom &)
 Donne un nom a l'Objet_U Methode virtuelle a surcharger.
virtual int reprendre (Entree &)
 Reprise d'un Objet_U sur un flot d'entree Methode a surcharger.
virtual int sauvegarder (Sortie &) const
 Sauvegarde d'un Objet_U sur un flot de sortie Methode a surcharger.
int get_object_id () const
 Renvoie l'identifiant unique de l'objet object_id_.
virtual const Type_infoget_info () const
 Donne des informations sur le type de l'Objet_U.
const Nomque_suis_je () const
 renvoie la chaine identifiant la classe.
const char * le_type () const
 Donne le nom du type de l'Objet_U.
virtual int change_num (const int *const)
 Change le numero interne de l'Objet_U.
virtual int lire_motcle_non_standard (const Motcle &motlu, Entree &is)
 Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
virtual int associer_ (Objet_U &)
 Associe l'Objet_U a un autre Objet_U Methode virtuelle a surcharger.
const Interpreteinterprete () const
Interpreteinterprete ()
Public Member Functions inherited from Process
virtual ~Process ()

Protected Member Functions

unsigned taille_memoire () const override
int duplique () const override
SortieprintOn (Sortie &os) const override
 Ecriture de l'objet sur un flot de sortie Methode a surcharger.
EntreereadOn (Entree &is) override
 Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
void attach_array (const TRUSTArray &a, _SIZE_ start=0, _SIZE_ size=-1)
bool detach_array ()
void resize_array_ (_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Protected Member Functions inherited from Objet_U
 Objet_U ()
 Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_), et enregistre l'objet en "memoire".
 Objet_U (const Objet_U &)
 Constructeur par copie.
const Objet_Uoperator= (const Objet_U &)
 Operateur= : ne fait rien (on conserve le numero et l'identifiant).
virtual void set_param (Param &) const

Protected Attributes

int nb_dim_ = 1

Friends

class TRUSTArrayKokkos
template<typename _TYPE2_, typename _SIZE2_>
class TRUSTArray

Additional Inherited Members

Static Public Member Functions inherited from Objet_U
static const Nomnom_du_cas ()
 Renvoie une reference constante vers le nom du cas.
static Nomget_set_nom_du_cas ()
 Renvoie une reference non constante vers le nom du cas (pour pouvoir le modifier).
static const Type_infoinfo ()
 Donne des informations sur le type de l'Objet_U.
static const Objet_Uself_cast (const Objet_U &)
 methode ajoutee pour caster en python
static Objet_Uself_cast (Objet_U &)
Static Public Member Functions inherited from Process
static int me ()
 renvoie mon rang dans le groupe de communication courant.
static int nproc ()
 renvoie le nombre de processeurs dans le groupe courant Voir Comm_Group::nproc() et PE_Groups::current_group()
static bool is_parallel ()
static void exit (int exit_code=-1)
 Routine de sortie de TRUST dans une region Kokkos.
static double mp_sum (double)
 Calcule la somme de x sur tous les processeurs du groupe courant.
static float mp_sum (float)
static trustIdType mp_sum (trustIdType)
 Calcule la somme de x sur tous les processeurs du groupe courant.
static double mp_max (double)
static double mp_min (double)
static int mp_max (int)
 renvoie le plus grand int i sur l'ensemble des processeurs du groupe courant.
static int mp_min (int)
 renvoie le plus petit int i sur l'ensemble des processeurs du groupe courant.
static double mp_sum_as_double (int v)
static trustIdType mppartial_sum (trustIdType i)
 Calul de la somme partielle de i sur les processeurs 0 a me()-1 (renvoie 0 sur le processeur 0).
template<typename T>
static void mp_sum_for_each (T &arg1, T &arg2)
 C++14 compatible mp_sum_for_each: combine multiple mp_sum calls into one collective operation Usage: mp_sum_for_each(a, b); mp_sum_for_each(a, b, c); mp_sum_for_each(a, b, c, d); mp_sum_for_each(a, b, c, d, e); All arguments must be of the same type (double or int) and are modified in place. Supports 2-5 parameters.
template<typename T>
static void mp_sum_for_each (T &arg1, T &arg2, T &arg3)
template<typename T>
static void mp_sum_for_each (T &arg1, T &arg2, T &arg3, T &arg4)
template<typename T>
static void mp_sum_for_each (T &arg1, T &arg2, T &arg3, T &arg4, T &arg5)
template<typename T>
static void mp_max_for_each (T &arg1, T &arg2)
 C++14 compatible mp_max_for_each: combine multiple mp_max calls into one collective operation.
template<typename T>
static void mp_max_for_each (T &arg1, T &arg2, T &arg3)
template<typename T>
static void mp_max_for_each (T &arg1, T &arg2, T &arg3, T &arg4)
template<typename T>
static void mp_max_for_each (T &arg1, T &arg2, T &arg3, T &arg4, T &arg5)
template<typename T>
static void mp_min_for_each (T &arg1, T &arg2)
 C++14 compatible mp_min_for_each: combine multiple mp_min calls into one collective operation.
template<typename T>
static void mp_min_for_each (T &arg1, T &arg2, T &arg3)
template<typename T>
static void mp_min_for_each (T &arg1, T &arg2, T &arg3, T &arg4)
template<typename T>
static void mp_min_for_each (T &arg1, T &arg2, T &arg3, T &arg4, T &arg5)
template<typename _TYPE_>
static void mp_sum_for_each_item (TRUSTArray< _TYPE_ > &x, int n=-1)
template<typename _TYPE_>
static void mp_max_for_each_item (TRUSTArray< _TYPE_ > &x, int n=-1)
template<typename _TYPE_>
static void mp_min_for_each_item (TRUSTArray< _TYPE_ > &x, int n=-1)
static bool mp_and (bool)
 Calcule le 'et' logique de b sur tous les processeurs du groupe courant.
static bool mp_or (bool)
static int check_int_overflow (trustIdType)
static int je_suis_maitre ()
 renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0), 0 sinon.
static KOKKOS_INLINE_FUNCTION void Kokkos_exit (const char *)
 Routine de sortie de TRUST dans une region Kokkos.
static int node_master ()
 renvoie 1 si on est sur le processeur maitre du noeud numa, 0 sinon.
static void exit (const Nom &message, int exit_code=-1)
static bool is_sequential ()
static void barrier ()
 Synchronise tous les processeurs du groupe courant (attend que tous les processeurs soient arrives a la barriere).
static void abort ()
 Routine de sortie de Trio-U sur une erreur abort().
static SortieJournal (int message_level=0)
 Renvoie un objet statique de type Sortie qui sert de journal d'evenements.
static double ram_processeur ()
static void imprimer_ram_totale (int all_process=0)
static bool force_single_file (const int ranks, const Nom &filename)
Static Public Attributes inherited from Objet_U
static double precision_geom = 1e-10
static constexpr bool HAS_POINTER = false
static int dimension =0
static int format_precision_geom =11
static int axi =0
static int bidim_axi =0
static int DEACTIVATE_SIGINT_CATCH =0
static Type_info info_obj
static bool disable_TU =false
 Flag to disable or not the writing of the .TU files.
static bool stat_per_proc_perf_log =false
 Flag to enable the writing of the statistics detailed per processor in _csv.TU file.
Static Public Attributes inherited from Process
static int exception_sur_exit =0
static int multiple_files =5120

Detailed Description

template<typename _TYPE_, typename _SIZE_>
class TRUSTArray< _TYPE_, _SIZE_ >

Represents a an array of int/int64/double/... values.

The two main members are mem_ and span_:

  • 'mem_' is the (shared) pointer to the actual underlying data. The block of data itself is a std::vector. This block of data can be shared among several arrays (see below) or can be null if we reference external data (ref_data)
  • 'span_' is a view on the actual data, and can point to a sub-part of *mem_.

We can have 3 states for the array:

  • "detached": meaning mem_==nullptr, span_.empty() == true (state obtained with the default ctor and detach_array())
  • "normal" : in this case mem_ is a non-null shared pointer to a std::vector holding the data. 'span_' then typically represents the entire span of the vector. The array is always initialised with 0. When the array is destroyed, the shared_ptr 'mem_' is destroyed too, and if this was the last reference to the underlying data, the std::vector itself is freed. The memory space of the array can be shared among several TRUSTArray ('mem_' has the same underlying value in several instances). This is typically produced by ref_array(). Note that when this happens, we have two instances pointing to the same underlying block of data, but none of them has precedence over the other one (none of them is 'the' owner of the data). Ownership is shared, and when the last owner is destroyed, memory is released.
  • "ref_data" : this is used to point to an exterior existing memory zone (not managed by TRUSTArray - for example data provided by an external Fortran func) In this case, mem_ remains nullptr, just the span_ is correctly filled, and no memory is released when the array is destroyed.

Finally, in case of a "XXTrav" array, the memory allocation is special:

  • a Trav array is allocated once, but when released, memory is kept in a pool so that another request for a new Trav might re-use it without having to perform the allocation again.
  • a Trav may not be ref_data or ref_array.
  • see implementation details of this mechanism in the TRUSTTravPool class.

In the template parameters below, TYPE is the value type (what it contains), SIZE is the extent type (how many items).

Definition at line 80 of file TRUSTArray.h.

Member Typedef Documentation

◆ int_t

template<typename _TYPE_, typename _SIZE_>
using TRUSTArray< _TYPE_, _SIZE_ >::int_t = _SIZE_

Definition at line 99 of file TRUSTArray.h.

◆ Iterator_

template<typename _TYPE_, typename _SIZE_>
using TRUSTArray< _TYPE_, _SIZE_ >::Iterator_ = typename tcb::span<_TYPE_>::iterator

Definition at line 100 of file TRUSTArray.h.

◆ Span_

template<typename _TYPE_, typename _SIZE_>
using TRUSTArray< _TYPE_, _SIZE_ >::Span_ = tcb::span<_TYPE_>

Definition at line 102 of file TRUSTArray.h.

◆ Value_type_

template<typename _TYPE_, typename _SIZE_>
using TRUSTArray< _TYPE_, _SIZE_ >::Value_type_ = _TYPE_

Definition at line 98 of file TRUSTArray.h.

◆ Vector_

template<typename _TYPE_, typename _SIZE_>
using TRUSTArray< _TYPE_, _SIZE_ >::Vector_ = std::vector<_TYPE_, TVAlloc<_TYPE_> >

Definition at line 101 of file TRUSTArray.h.

Constructor & Destructor Documentation

◆ ~TRUSTArray()

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ >::~TRUSTArray ( )
inlinevirtual

Destroy array, potentially making block available again if this was a Trav

Definition at line 27 of file TRUSTArray.tpp.

◆ TRUSTArray() [1/3]

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ >::TRUSTArray ( )
inline

Definition at line 118 of file TRUSTArray.h.

◆ TRUSTArray() [2/3]

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ >::TRUSTArray ( _SIZE_ n)
inline

Definition at line 120 of file TRUSTArray.h.

◆ TRUSTArray() [3/3]

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ >::TRUSTArray ( const TRUSTArray< _TYPE_, _SIZE_ > & A)
inline

Copy ctor. Performs a deep copy.

It is forbidden to deep copy a ref_data.

Definition at line 136 of file TRUSTArray.h.

Member Function Documentation

◆ addr() [1/2]

template<typename _TYPE_, typename _SIZE_>
_TYPE_ * TRUSTArray< _TYPE_, _SIZE_ >::addr ( )
inline

Returns a pointer on the first element of the array. nullptr will be returned if array is detached. Careful, address might change after a resize_array(), ref_data(), etc.

Definition at line 159 of file TRUSTArray.tpp.

◆ addr() [2/2]

template<typename _TYPE_, typename _SIZE_>
const _TYPE_ * TRUSTArray< _TYPE_, _SIZE_ >::addr ( ) const
inline

Definition at line 166 of file TRUSTArray.tpp.

◆ append_array()

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::append_array ( _TYPE_ valeur)
inline

Add a slot at the end of the array and store it valeur -> similar to vector<>::push_back

Ajoute une case en fin de tableau et y stocke la "valeur" Precondition: Le tableau ne doit pas etre "ref_data", et il ne doit pas y avoir plus d'une reference a la zone de memoire pointee (meme precondition que resize_array()) Le tableau doit etre de type TRUSTArray (pas un type derive)

Definition at line 216 of file TRUSTArray.tpp.

◆ attach_array()

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::attach_array ( const TRUSTArray< _TYPE_, _SIZE_ > & m,
_SIZE_ start = 0,
_SIZE_ size = -1 )
inlineprotected

Attach the array to (part of) an existing block of data stored in another array. The data is then shared between that other array and this.

If size < 0, we take the data from the specified start till the end of the block. Array must be detached first before invoking this method. It is forbidden to attach to a ref_data.

Definition at line 242 of file TRUSTArray.tpp.

◆ begin() [1/2]

template<typename _TYPE_, typename _SIZE_>
Iterator_ TRUSTArray< _TYPE_, _SIZE_ >::begin ( )
inline

Definition at line 111 of file TRUSTArray.h.

◆ begin() [2/2]

template<typename _TYPE_, typename _SIZE_>
const Iterator_ TRUSTArray< _TYPE_, _SIZE_ >::begin ( ) const
inline

Definition at line 113 of file TRUSTArray.h.

◆ checkDataOnDevice() [1/3]

template<typename _TYPE_, typename _SIZE_>
bool TRUSTArray< _TYPE_, _SIZE_ >::checkDataOnDevice ( )
inline

Definition at line 72 of file TRUSTArray_device.tpp.

◆ checkDataOnDevice() [2/3]

template<typename _TYPE_, typename _SIZE_>
bool TRUSTArray< _TYPE_, _SIZE_ >::checkDataOnDevice ( ) const
inline

Definition at line 57 of file TRUSTArray_device.tpp.

◆ checkDataOnDevice() [3/3]

template<typename _TYPE_, typename _SIZE_>
bool TRUSTArray< _TYPE_, _SIZE_ >::checkDataOnDevice ( const TRUSTArray< _TYPE_, _SIZE_ > & arr)
inline

Definition at line 87 of file TRUSTArray_device.tpp.

◆ copy_array()

template<typename _TYPE_, typename _SIZE_>
TRUSTArray & TRUSTArray< _TYPE_, _SIZE_ >::copy_array ( const TRUSTArray< _TYPE_, _SIZE_ > & a)
inline

Definition at line 227 of file TRUSTArray.h.

◆ data() [1/2]

template<typename _TYPE_, typename _SIZE_>
_TYPE_ * TRUSTArray< _TYPE_, _SIZE_ >::data ( )
inline

Definition at line 173 of file TRUSTArray.tpp.

◆ data() [2/2]

template<typename _TYPE_, typename _SIZE_>
const _TYPE_ * TRUSTArray< _TYPE_, _SIZE_ >::data ( ) const
inline

Definition at line 179 of file TRUSTArray.tpp.

◆ detach_array()

template<typename _TYPE_, typename _SIZE_>
bool TRUSTArray< _TYPE_, _SIZE_ >::detach_array ( )
inlineprotected

Bring the current array in a detached state, i.e. both 'mem_' and 'span_' are cleared, whatever the current state.

Definition at line 277 of file TRUSTArray.tpp.

◆ dimension_tot()

◆ duplique()

◆ end() [1/2]

template<typename _TYPE_, typename _SIZE_>
Iterator_ TRUSTArray< _TYPE_, _SIZE_ >::end ( )
inline

Definition at line 112 of file TRUSTArray.h.

◆ end() [2/2]

template<typename _TYPE_, typename _SIZE_>
const Iterator_ TRUSTArray< _TYPE_, _SIZE_ >::end ( ) const
inline

Definition at line 114 of file TRUSTArray.h.

◆ ensureDataOnHost() [1/2]

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::ensureDataOnHost ( )
inline

Definition at line 33 of file TRUSTArray_device.tpp.

◆ ensureDataOnHost() [2/2]

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::ensureDataOnHost ( ) const
inline

Definition at line 24 of file TRUSTArray_device.tpp.

◆ from_tid_to_int() [1/2]

void TRUSTArray< trustIdType, trustIdType >::from_tid_to_int ( TRUSTArray< int, int > & out) const

Conversion from a BigArrOfTID to an ArrOfInt. Careful, it always does a copy! It is your responsibility to invoke it only when necessary (typically you should avoid this when trustIdType == int ...)

Definition at line 299 of file TRUSTArray.cpp.

◆ from_tid_to_int() [2/2]

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::from_tid_to_int ( TRUSTArray< int, int > & out) const

Definition at line 316 of file TRUSTArray.cpp.

◆ get_data_location() [1/2]

template<typename _TYPE_, typename _SIZE_>
DataLocation TRUSTArray< _TYPE_, _SIZE_ >::get_data_location ( )
inline

Definition at line 245 of file TRUSTArray.h.

◆ get_data_location() [2/2]

template<typename _TYPE_, typename _SIZE_>
DataLocation TRUSTArray< _TYPE_, _SIZE_ >::get_data_location ( ) const
inline

Definition at line 246 of file TRUSTArray.h.

◆ get_mem()

template<typename _TYPE_, typename _SIZE_>
std::shared_ptr< Vector_ > TRUSTArray< _TYPE_, _SIZE_ >::get_mem ( )
inline

Definition at line 173 of file TRUSTArray.h.

◆ get_mem_storage()

template<typename _TYPE_, typename _SIZE_>
STORAGE TRUSTArray< _TYPE_, _SIZE_ >::get_mem_storage ( ) const
inline

Definition at line 171 of file TRUSTArray.h.

◆ get_span() [1/2]

◆ get_span() [2/2]

◆ get_span_tot() [1/2]

◆ get_span_tot() [2/2]

◆ inject_array()

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ > & TRUSTArray< _TYPE_, _SIZE_ >::inject_array ( const TRUSTArray< _TYPE_, _SIZE_ > & source,
_SIZE_ nb_elements = -1,
_SIZE_ first_element_dest = 0,
_SIZE_ first_element_source = 0 )

Copie les elements source[first_element_source + i] dans les elements (*this)[first_element_dest + i] pour 0 <= i < nb_elements Les autres elements de (*this) sont inchanges.

Parameters
constArrOfDouble& m: le tableau a utiliser, doit etre different de *this !
_SIZE_nb_elements: nombre d'elements a copier, nb_elements >= -1. Si nb_elements==-1, on copie tout le tableau m. Valeurs par defaut: -1
_SIZE_first_element_dest. Valeurs par defaut: 0
_SIZE_first_element_source. Valeurs par defaut: 0
Returns
ArrOfDouble& : *this
Exceptions
Sorten erreur si la taille du tableau m est plus grande que la taille de tableau this.

Definition at line 195 of file TRUSTArray.cpp.

◆ isDataOnDevice()

template<typename _TYPE_, typename _SIZE_>
bool TRUSTArray< _TYPE_, _SIZE_ >::isDataOnDevice ( ) const
inline

Definition at line 47 of file TRUSTArray_device.tpp.

◆ operator()() [1/2]

template<typename _TYPE_, typename _SIZE_>
_TYPE_ & TRUSTArray< _TYPE_, _SIZE_ >::operator() ( _SIZE_ i)
inline

Definition at line 180 of file TRUSTArray.h.

◆ operator()() [2/2]

template<typename _TYPE_, typename _SIZE_>
const _TYPE_ & TRUSTArray< _TYPE_, _SIZE_ >::operator() ( _SIZE_ i) const
inline

Definition at line 181 of file TRUSTArray.h.

◆ operator*=()

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ > & TRUSTArray< _TYPE_, _SIZE_ >::operator*= ( const _TYPE_ dy)

muliplie toutes les cases par dy

Definition at line 454 of file TRUSTArray.cpp.

◆ operator+=() [1/2]

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ > & TRUSTArray< _TYPE_, _SIZE_ >::operator+= ( const _TYPE_ dy)

ajoute la meme valeur a toutes les cases du tableau

Ajoute la meme valeur a toutes les cases du tableau

Definition at line 386 of file TRUSTArray.cpp.

◆ operator+=() [2/2]

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ > & TRUSTArray< _TYPE_, _SIZE_ >::operator+= ( const TRUSTArray< _TYPE_, _SIZE_ > & y)

Addition case a case sur toutes les cases du tableau : la taille de y doit etre au moins egale a la taille de this

Definition at line 355 of file TRUSTArray.cpp.

◆ operator-=() [1/2]

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ > & TRUSTArray< _TYPE_, _SIZE_ >::operator-= ( const _TYPE_ dy)

soustrait la meme valeur a toutes les cases

Definition at line 445 of file TRUSTArray.cpp.

◆ operator-=() [2/2]

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ > & TRUSTArray< _TYPE_, _SIZE_ >::operator-= ( const TRUSTArray< _TYPE_, _SIZE_ > & y)

Soustraction case a case sur toutes les cases du tableau : tableau de meme taille que *this

Definition at line 414 of file TRUSTArray.cpp.

◆ operator/=()

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ > & TRUSTArray< _TYPE_, _SIZE_ >::operator/= ( const _TYPE_ dy)

divise toutes les cases par dy (pas pour TRUSTArray<int>)

Definition at line 482 of file TRUSTArray.cpp.

◆ operator=() [1/2]

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ > & TRUSTArray< _TYPE_, _SIZE_ >::operator= ( _TYPE_ x)

Assign 'x' to all slots in the array

Remplit le tableau avec la x en parametre (x est affecte a toutes les cases du tableau)

Definition at line 327 of file TRUSTArray.cpp.

◆ operator=() [2/2]

template<typename _TYPE_, typename _SIZE_>
TRUSTArray< _TYPE_, _SIZE_ > & TRUSTArray< _TYPE_, _SIZE_ >::operator= ( const TRUSTArray< _TYPE_, _SIZE_ > & m)
inline

Copy the data from another array, potentially resizing. The storage type is not copied.

Definition at line 115 of file TRUSTArray.tpp.

◆ operator[]() [1/2]

template<typename _TYPE_, typename _SIZE_>
_TYPE_ & TRUSTArray< _TYPE_, _SIZE_ >::operator[] ( _SIZE_ i)
inline

operateur [] retourne le ieme element du tableau Parametre: SIZE i Signification: indice dans l'intervalle 0 <= i < size_array() Exception: assert si i n'est pas dans l'intervalle

Definition at line 133 of file TRUSTArray.tpp.

◆ operator[]() [2/2]

template<typename _TYPE_, typename _SIZE_>
const _TYPE_ & TRUSTArray< _TYPE_, _SIZE_ >::operator[] ( _SIZE_ i) const
inline

Definition at line 143 of file TRUSTArray.tpp.

◆ ordonne_array()

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::ordonne_array ( )
inline

Tri des valeurs du tableau dans l'ordre croissant.

Definition at line 228 of file TRUSTArray.tpp.

◆ printOn()

◆ readOn()

◆ ref_array()

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::ref_array ( TRUSTArray< _TYPE_, _SIZE_ > & m,
_SIZE_ start = 0,
_SIZE_ size = -1 )
inlinevirtual

Make the current array point to the data of another existing array. Ownership of the data is hence shared.

The current array is first detached (see detach_array()), and then attached to the provided data (see attach_array()) Wanring: virtual -> in derived classes this method initializes structures to create a sequential array.

Reimplemented in TRUSTTab< _TYPE_, _SIZE_ >, TRUSTTab< _TYPE_ >, TRUSTVect< _TYPE_, _SIZE_ >, and TRUSTVect< _TYPE_, int >.

Definition at line 103 of file TRUSTArray.tpp.

◆ ref_as_big() [1/2]

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::ref_as_big ( TRUSTArray< _TYPE_, trustIdType > & out) const

Definition at line 260 of file TRUSTArray.cpp.

◆ ref_as_big() [2/2]

void TRUSTArray< trustIdType, int >::ref_as_big ( TRUSTArray< trustIdType, trustIdType > & out) const

Conversion methods - from a small array (SIZE=int) of TID (TYPE=trustIdType), return a big one (SIZE=trustIdType). No data copied! This behaves somewhat like a ref_array. Used in LATA stuff notably. Not implemented for TYPE=double or float (because never needed).

Definition at line 254 of file TRUSTArray.cpp.

◆ ref_as_small() [1/3]

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::ref_as_small ( TRUSTArray< _TYPE_, int > & out) const

Definition at line 288 of file TRUSTArray.cpp.

◆ ref_as_small() [2/3]

void TRUSTArray< float, trustIdType >::ref_as_small ( TRUSTArray< float, int > & out) const

Conversion methods - from a big array (SIZE=trustIdType), return a small one (SIZE=int). Overflow is detected in debug if array is too big to be fit into SIZE=int. No data copied! This behaves somewhat like a ref_array. Used in LATA stuff and FT notably.

Definition at line 272 of file TRUSTArray.cpp.

◆ ref_as_small() [3/3]

void TRUSTArray< int, trustIdType >::ref_as_small ( TRUSTArray< int, int > & out) const

Definition at line 280 of file TRUSTArray.cpp.

◆ ref_count()

template<typename _TYPE_, typename _SIZE_>
int TRUSTArray< _TYPE_, _SIZE_ >::ref_count ( ) const
inline

Returns the number of owners of the data, i.e. the number of Arrays pointing to the same underlying data

Returns the number of shared owners of the data underlying the array. If -1 detached array. This is simply the ref count of the shared pointer 'mem_'

Definition at line 196 of file TRUSTArray.tpp.

◆ ref_data()

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::ref_data ( _TYPE_ * ptr,
_SIZE_ size )
inlinevirtual

Construction de tableaux qui pointent vers des donnees existantes !!! Utiliser ref_data avec precaution

Make the array point to the memory zone indicated by data_. The array is detached from its current underlying data ('mem_' is released).

Warning: virtual method. In derived classes this method initializes the structures to create a sequential array. To create a ref on a parallel array, see DoubleVect::ref()

Reimplemented in TRUSTTab< _TYPE_, _SIZE_ >, TRUSTTab< _SIZE_, _SIZE_ >, TRUSTTab< _TYPE_ >, TRUSTTab< _TYPE_, int >, TRUSTTab< _TYPE_, trustIdType >, TRUSTTab< double, _SIZE_ >, TRUSTTab< double, int >, TRUSTTab< double, trustIdType >, TRUSTTab< float, int >, TRUSTTab< int, int >, TRUSTTab< int, trustIdType >, TRUSTTab< trustIdType, int >, TRUSTTab< trustIdType, trustIdType >, TRUSTVect< _TYPE_, _SIZE_ >, TRUSTVect< _SIZE_, _SIZE_ >, TRUSTVect< _TYPE_, trustIdType >, TRUSTVect< double, _SIZE_ >, TRUSTVect< double, int >, TRUSTVect< double, trustIdType >, TRUSTVect< float, int >, TRUSTVect< int, _SIZE_ >, TRUSTVect< int, _TYPE_ >, TRUSTVect< int, int >, TRUSTVect< int, trustIdType >, TRUSTVect< trustIdType, int >, and TRUSTVect< trustIdType, trustIdType >.

Definition at line 86 of file TRUSTArray.tpp.

◆ reset()

◆ resize()

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::resize ( _SIZE_ new_size,
RESIZE_OPTIONS opt = RESIZE_OPTIONS::COPY_INIT )
inline

Definition at line 156 of file TRUSTArray.h.

◆ resize_array()

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::resize_array ( _SIZE_ new_size,
RESIZE_OPTIONS opt = RESIZE_OPTIONS::COPY_INIT )
inline

Change the size of the array.

This updates the underlying std::vector size.

Conditions:

  • if the size changes, type must not be a derived class of TRUSTArray.
  • the array can not be resized if data is shared (ref_array)
  • the array can not be resized if it is a 'ref_data'.

Definition at line 43 of file TRUSTArray.tpp.

◆ resize_array_()

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::resize_array_ ( _SIZE_ new_size,
RESIZE_OPTIONS opt = RESIZE_OPTIONS::COPY_INIT )
protected

Protected method for resize. Used by derived classes. Same as resize_array() with less checks.

This is also where we deal with the STORAGE::TEMP_STORAGE capability, i.e. the Trav arrays. There memory is taken from a shared pool (TRUSTTravPool). This kind of array should never be used in 64bits, since Trav are meaningful when inside the timestepping (so the 32bit world after the Scatter isntruction).

Definition at line 79 of file TRUSTArray.cpp.

◆ resize_tab()

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::resize_tab ( _SIZE_ n,
RESIZE_OPTIONS opt = RESIZE_OPTIONS::COPY_INIT )
inlinevirtual

◆ set_data_location() [1/2]

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::set_data_location ( DataLocation flag)
inline

Definition at line 247 of file TRUSTArray.h.

◆ set_data_location() [2/2]

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::set_data_location ( DataLocation flag) const
inline

Definition at line 248 of file TRUSTArray.h.

◆ set_mem_storage()

template<typename _TYPE_, typename _SIZE_>
void TRUSTArray< _TYPE_, _SIZE_ >::set_mem_storage ( const STORAGE storage)
inline

Memory allocation type - TEMP arrays (i.e. Trav) have a different allocation mechanism - see TRUSTTravPool.h)

Definition at line 73 of file TRUSTArray.tpp.

◆ size_array()

template<typename _TYPE_, typename _SIZE_>
_SIZE_ TRUSTArray< _TYPE_, _SIZE_ >::size_array ( ) const
inline

Return the size of the span on the data (not the full underlying allocated size)

Returns the size of the array.

Definition at line 187 of file TRUSTArray.tpp.

◆ size_mem()

template<typename _TYPE_, typename _SIZE_>
int TRUSTArray< _TYPE_, _SIZE_ >::size_mem ( )
inline

Definition at line 249 of file TRUSTArray.h.

◆ taille_memoire()

◆ TRUSTArray

template<typename _TYPE_, typename _SIZE_>
template<typename _TYPE2_, typename _SIZE2_>
friend class TRUSTArray
friend

Definition at line 108 of file TRUSTArray.h.

◆ TRUSTArrayKokkos

template<typename _TYPE_, typename _SIZE_>
friend class TRUSTArrayKokkos
friend

Definition at line 105 of file TRUSTArray.h.

Member Data Documentation

◆ nb_dim_

template<typename _TYPE_, typename _SIZE_>
int TRUSTArray< _TYPE_, _SIZE_ >::nb_dim_ = 1
protected

Definition at line 95 of file TRUSTArray.h.


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