TrioCFD 1.9.9_beta
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
 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).
void 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.
void ref_as_small (TRUSTArray< int, int > &out) const
void 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 ...).
Public Member Functions inherited from Objet_U
 ~Objet_U () override
 Destructor. Removes the object from the list of objects registered in "memory".
int numero () const
 Returns the index of the object in Memoire::data.
virtual int est_egal_a (const Objet_U &) const
 Returns 1 if x and *this are the same instance (same memory address).
virtual const Nomle_nom () const
 Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
virtual void nommer (const Nom &)
 Assigns a name to the Objet_U. Virtual method to override.
virtual int reprendre (Entree &)
 Restores an Objet_U from an input stream. Virtual method to override.
virtual int sauvegarder (Sortie &) const
 Saves an Objet_U to an output stream. Virtual method to override.
int get_object_id () const
 Returns the unique identifier of the object (object_id_).
virtual const Type_infoget_info () const
 Returns type information for the Objet_U.
const Nomque_suis_je () const
 Returns the string identifying the class.
const char * le_type () const
 Returns the type name of the Objet_U.
virtual int change_num (const int *const)
 Changes the internal number of the Objet_U.
virtual int lire_motcle_non_standard (const Motcle &motlu, Entree &is)
 Reads non-simple-type parameters of an Objet_U from an input stream.
virtual int associer_ (Objet_U &)
 Associates the Objet_U with another Objet_U. Virtual method to override.
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
 Writes the object to an output stream. Virtual method to override.
EntreereadOn (Entree &is) override
 Reads an Objet_U from an input stream. Virtual method to override.
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 ()
 Default constructor: assigns a unique identifier to the object (object_id_) and registers the object in "memory" by giving it a num_obj number.
 Objet_U (const Objet_U &)
 Copy constructor.
const Objet_Uoperator= (const Objet_U &)
 Assignment operator: does nothing (the number and identifier are preserved).
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 ()
 Returns a constant reference to the case name. This method is static.
static Nomget_set_nom_du_cas ()
 Returns a non-constant reference to the case name (to allow modification). This method is static.
static const Type_infoinfo ()
 Returns type information for the Objet_U (static version).
static const Objet_Uself_cast (const Objet_U &)
 Method added for casting in Python.
static Objet_Uself_cast (Objet_U &)
Static Public Member Functions inherited from Process
static int me ()
 Returns the rank of the local processor in the current communication group. See Comm_Group::rank() and PE_Groups::current_group().
static int nproc ()
 Returns the number of processors in the current group. See Comm_Group::nproc() and PE_Groups::current_group().
static bool is_parallel ()
static void exit (int exit_code=-1)
 Exit routine for TRUST within a Kokkos region.
static double mp_sum (double)
 Computes the sum of x over all processors in the current group.
static float mp_sum (float)
static trustIdType mp_sum (trustIdType)
 Computes the sum of x over all processors in the current group.
static double mp_max (double)
static double mp_min (double)
static int mp_max (int)
 Returns the maximum value of x across all processors in the current group.
static int mp_min (int)
 Returns the minimum value of x across all processors in the current group.
static double mp_sum_as_double (int v)
static trustIdType mppartial_sum (trustIdType i)
 Computes the partial sum of x over processors 0 to me()-1 (returns 0 on processor 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)
 Computes the logical AND of b across all processors in the current group.
static bool mp_or (bool)
static int check_int_overflow (trustIdType)
static int je_suis_maitre ()
 Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
static KOKKOS_INLINE_FUNCTION void Kokkos_exit (const char *)
 Exit routine for TRUST within a Kokkos region.
static int node_master ()
 Returns 1 if on the NUMA node master processor, 0 otherwise.
static void exit (const Nom &message, int exit_code=-1)
static bool is_sequential ()
static void barrier ()
 Synchronizes all processors in the current group (waits until all processors have reached the barrier).
static void abort ()
 Abort routine for TRUST on a fatal error.
static SortieJournal (int message_level=0)
 Returns a static Sortie object used as an event journal.
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 ...).

Parameters
outthe output ArrOfInt filled with the converted values

Definition at line 302 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 319 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 )

Copies elements source[first_element_source + i] into elements (*this)[first_element_dest + i] for 0 <= i < nb_elements The other elements of (*this) are left unchanged.

Parameters
constArrOfDouble& m: the array to use, must be different from *this !
_SIZE_nb_elements: number of elements to copy, nb_elements >= -1. If nb_elements==-1, the entire array m is copied. Default value: -1
_SIZE_first_element_dest. Default value: 0
_SIZE_first_element_source. Default value: 0
Returns
ArrOfDouble& : *this
Exceptions
Exitswith an error if the size of array m is larger than the size of array 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)

Multiplies all entries by dy

muliplie toutes les cases par dy

Definition at line 457 of file TRUSTArray.cpp.

◆ operator+=() [1/2]

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

Adds the same value to all entries of the array

Adds the same value to every element of the array

Definition at line 389 of file TRUSTArray.cpp.

◆ operator+=() [2/2]

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

Element-wise addition over all entries: the size of y must be at least equal to the size of *this

Element-wise addition over all elements of the array: the size of y must be at least equal to the size of this

Definition at line 358 of file TRUSTArray.cpp.

◆ operator-=() [1/2]

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

Subtracts the same value from all entries

soustrait la meme valeur a toutes les cases

Definition at line 448 of file TRUSTArray.cpp.

◆ operator-=() [2/2]

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

Element-wise subtraction over all entries: array must have the same size as *this

Element-wise subtraction over all elements of the array: array must be the same size as *this

Definition at line 417 of file TRUSTArray.cpp.

◆ operator/=()

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

Divides all entries by dy (not for TRUSTArray<int>)

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

Definition at line 485 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

Fills the array with the value x passed as parameter (x is assigned to every element of the array)

Definition at line 330 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 261 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).

Parameters
outthe output big array that will reference the same data

Definition at line 255 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 290 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.

Parameters
outthe output small array that will reference the same data

Definition at line 274 of file TRUSTArray.cpp.

◆ ref_as_small() [3/3]

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

Definition at line 282 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

◆ 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: