Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::Array2DataT< DataType > Class Template Reference

Two-dimensional array data of type DataType. More...

#include <arcane/impl/internal/Array2Data.h>

Inheritance diagram for Arcane::Array2DataT< DataType >:
Collaboration diagram for Arcane::Array2DataT< DataType >:

Classes

class  Impl

Public Types

typedef Array2DataT< DataType > ThatClass
typedef IArray2DataT< DataType > DataInterfaceType
Public Types inherited from Arcane::IArray2DataT< DataType >
typedef IArray2DataT< DataType > ThatClass

Public Member Functions

 Array2DataT (ITraceMng *trace)
 Array2DataT (const DataStorageBuildInfo &dsbi)
 Array2DataT (const Array2DataT< DataType > &rhs)
Integer dimension () const override
 Dimension. 0 for a scalar, 1 for a mono-dim array, 2 for a bi-dim array.
Integer multiTag () const override
 Multi-tag. 0 if not multiple, 1 if multiple, 2 if multiple for MultiArray variables (obsolete).
eDataType dataType () const override
 Data type.
void serialize (ISerializer *sbuf, IDataOperation *operation) override
 Serializes the data by applying the operation.
void serialize (ISerializer *sbuf, Int32ConstArrayView ids, IDataOperation *operation) override
 Serialize the data for the indices ids.
Array2< DataType > & value () override
 Data value.
const Array2< DataType > & value () const override
 Data value.
Array2View< DataType > view () override
 View on the data.
ConstArray2View< DataType > view () const override
 Constant view on the data.
void resize (Integer new_size) override
 Resize the data.
IDataclone () override
 Clone the data. The created instance must be destroyed by the 'delete' operator.
IDatacloneEmpty () override
 Clone the data but without elements. The created instance must be destroyed by the 'delete' operator.
Ref< IDatacloneRef () override
 Clone the data.
Ref< IDatacloneEmptyRef () override
 Clone the data but without elements.
DataStorageTypeInfo storageTypeInfo () const override
 Information about the data container type.
DataInterfaceType * cloneTrue () override
 Clone the data.
DataInterfaceType * cloneTrueEmpty () override
 Clone the data but without elements.
Ref< DataInterfaceType > cloneTrueRef () override
 Clone the data.
Ref< DataInterfaceType > cloneTrueEmptyRef () override
 Clone the data but without elements.
void fillDefault () override
 Fills the data with its default value.
void setName (const String &name) override
 Sets the name of the data (internal).
Ref< ISerializedDatacreateSerializedDataRef (bool use_basic_type) const override
 Serialize the data.
void allocateBufferForSerializedData (ISerializedData *sdata) override
 Allocate memory to read the serialized values sdata.
void assignSerializedData (const ISerializedData *sdata) override
 Assign the serialized values sdata to the data.
void copy (const IData *data) override
 Copy the data data into the current instance.
void swapValues (IData *data) override
 Swap the values of data with those of the instance.
void computeHash (IHashAlgorithm *algo, ByteArray &output) const override
 Compute a hash key on this data.
void computeHash (DataHashInfo &hash_algo) const
ArrayShape shape () const override
 Array shape for a 1D or 2D data item.
void setShape (const ArrayShape &new_shape) override
 Sets the array shape.
void setAllocationInfo (const DataAllocationInfo &v) override
 Sets the allocation information.
DataAllocationInfo allocationInfo () const override
 Allocation information.
void visit (IArray2DataVisitor *visitor)
void visit (IDataVisitor *visitor) override
 Applies the visitor to the data.
void visitScalar (IScalarDataVisitor *) override
 Apply the visitor to the data.
void visitArray (IArrayDataVisitor *) override
 Apply the visitor to the data.
void visitArray2 (IArray2DataVisitor *visitor) override
 Apply the visitor to the data.
void swapValuesDirect (ThatClass *true_data)
void changeAllocator (const MemoryAllocationOptions &alloc_info)
IArray2DataInternalT< DataType > * _internal () override
IDataInternal_commonInternal () override
Public Member Functions inherited from Arcane::ReferenceCounterImpl
void addReference ()
void removeReference ()
void _internalAddReference ()
bool _internalRemoveReference ()
Public Member Functions inherited from Arcane::IData
virtual void visitMultiArray2 (IMultiArray2DataVisitor *visitor)
 Apply the visitor to the data.

Static Public Member Functions

static DataStorageTypeInfo staticStorageTypeInfo ()

Private Member Functions

 ARCCORE_DEFINE_REFERENCE_COUNTED_INCLASS_METHODS ()
IArray2DataT< DataType > * _cloneTrue () const
IArray2DataT< DataType > * _cloneTrueEmpty () const

Private Attributes

UniqueArray2< DataType > m_value
 Data.
ITraceMngm_trace
IArray2DataInternalT< DataType > * m_internal
ArrayShape m_shape
DataAllocationInfo m_allocation_info

Friends

class Impl

Detailed Description

template<class DataType>
class Arcane::Array2DataT< DataType >

Two-dimensional array data of type DataType.

Definition at line 47 of file Array2Data.h.

Member Typedef Documentation

◆ DataInterfaceType

template<class DataType>
typedef IArray2DataT<DataType> Arcane::Array2DataT< DataType >::DataInterfaceType

Definition at line 58 of file Array2Data.h.

◆ ThatClass

template<class DataType>
typedef Array2DataT<DataType> Arcane::Array2DataT< DataType >::ThatClass

Definition at line 57 of file Array2Data.h.

Constructor & Destructor Documentation

◆ Array2DataT() [1/3]

template<typename DataType>
Arcane::Array2DataT< DataType >::Array2DataT ( ITraceMng * trace)
explicit

Definition at line 54 of file Array2Data.inst.h.

◆ Array2DataT() [2/3]

template<typename DataType>
Arcane::Array2DataT< DataType >::Array2DataT ( const DataStorageBuildInfo & dsbi)
explicit

Definition at line 78 of file Array2Data.inst.h.

◆ Array2DataT() [3/3]

template<typename DataType>
Arcane::Array2DataT< DataType >::Array2DataT ( const Array2DataT< DataType > & rhs)

Definition at line 65 of file Array2Data.inst.h.

◆ ~Array2DataT()

template<typename DataType>
Arcane::Array2DataT< DataType >::~Array2DataT ( )
override

Definition at line 89 of file Array2Data.inst.h.

Member Function Documentation

◆ _cloneTrue()

template<class DataType>
IArray2DataT< DataType > * Arcane::Array2DataT< DataType >::_cloneTrue ( ) const
inlineprivate

Definition at line 155 of file Array2Data.h.

◆ _cloneTrueEmpty()

template<class DataType>
IArray2DataT< DataType > * Arcane::Array2DataT< DataType >::_cloneTrueEmpty ( ) const
inlineprivate

Definition at line 156 of file Array2Data.h.

◆ _commonInternal()

template<class DataType>
IDataInternal * Arcane::Array2DataT< DataType >::_commonInternal ( )
inlineoverridevirtual

Implements Arcane::IData.

Definition at line 139 of file Array2Data.h.

◆ _internal()

template<class DataType>
IArray2DataInternalT< DataType > * Arcane::Array2DataT< DataType >::_internal ( )
inlineoverridevirtual

Implements Arcane::IArray2DataT< DataType >.

Definition at line 138 of file Array2Data.h.

◆ allocateBufferForSerializedData()

template<typename DataType>
void Arcane::Array2DataT< DataType >::allocateBufferForSerializedData ( ISerializedData * sdata)
overridevirtual

Allocate memory to read the serialized values sdata.

This method sets sdata->setBuffer(), which will contain the memory needed to read the serialized data.

Implements Arcane::IData.

Definition at line 167 of file Array2Data.inst.h.

References ARCANE_FATAL, Arcane::ISerializedData::baseDataType(), dataType(), Arcane::ISerializedData::extents(), Arcane::ISerializedData::isMultiSize(), m_value, Arcane::ISerializedData::memorySize(), Arcane::ISerializedData::setWritableBytes(), and Arcane::ISerializedData::shape().

Here is the call graph for this function:

◆ allocationInfo()

template<class DataType>
DataAllocationInfo Arcane::Array2DataT< DataType >::allocationInfo ( ) const
inlineoverridevirtual

Allocation information.

Implements Arcane::IData.

Definition at line 108 of file Array2Data.h.

◆ assignSerializedData()

template<typename DataType>
void Arcane::Array2DataT< DataType >::assignSerializedData ( const ISerializedData * sdata)
overridevirtual

Assign the serialized values sdata to the data.

The buffer containing the serialization values must have be allocated by calling allocateBufferForSerializedData().

Implements Arcane::IData.

Definition at line 198 of file Array2Data.inst.h.

◆ changeAllocator()

template<typename DataType>
void Arcane::Array2DataT< DataType >::changeAllocator ( const MemoryAllocationOptions & alloc_info)

Definition at line 518 of file Array2Data.inst.h.

◆ clone()

template<class DataType>
IData * Arcane::Array2DataT< DataType >::clone ( )
inlineoverridevirtual

Clone the data. The created instance must be destroyed by the 'delete' operator.

Implements Arcane::IData.

Definition at line 79 of file Array2Data.h.

◆ cloneEmpty()

template<class DataType>
IData * Arcane::Array2DataT< DataType >::cloneEmpty ( )
inlineoverridevirtual

Clone the data but without elements. The created instance must be destroyed by the 'delete' operator.

Implements Arcane::IData.

Definition at line 80 of file Array2Data.h.

◆ cloneEmptyRef()

template<class DataType>
Ref< IData > Arcane::Array2DataT< DataType >::cloneEmptyRef ( )
inlineoverridevirtual

Clone the data but without elements.

Implements Arcane::IData.

Definition at line 82 of file Array2Data.h.

References cloneTrueEmpty(), and Arcane::makeRef().

Here is the call graph for this function:

◆ cloneRef()

template<class DataType>
Ref< IData > Arcane::Array2DataT< DataType >::cloneRef ( )
inlineoverridevirtual

Clone the data.

Implements Arcane::IData.

Definition at line 81 of file Array2Data.h.

References cloneTrue(), and Arcane::makeRef().

Here is the call graph for this function:

◆ cloneTrue()

template<class DataType>
DataInterfaceType * Arcane::Array2DataT< DataType >::cloneTrue ( )
inlineoverridevirtual

Clone the data.

Implements Arcane::IArray2DataT< DataType >.

Definition at line 84 of file Array2Data.h.

Referenced by cloneRef().

Here is the caller graph for this function:

◆ cloneTrueEmpty()

template<class DataType>
DataInterfaceType * Arcane::Array2DataT< DataType >::cloneTrueEmpty ( )
inlineoverridevirtual

Clone the data but without elements.

Implements Arcane::IArray2DataT< DataType >.

Definition at line 85 of file Array2Data.h.

Referenced by cloneEmptyRef().

Here is the caller graph for this function:

◆ cloneTrueEmptyRef()

template<class DataType>
Ref< DataInterfaceType > Arcane::Array2DataT< DataType >::cloneTrueEmptyRef ( )
inlineoverridevirtual

Clone the data but without elements.

Implements Arcane::IArray2DataT< DataType >.

Definition at line 91 of file Array2Data.h.

References Arcane::makeRef().

Here is the call graph for this function:

◆ cloneTrueRef()

template<class DataType>
Ref< DataInterfaceType > Arcane::Array2DataT< DataType >::cloneTrueRef ( )
inlineoverridevirtual

Clone the data.

Implements Arcane::IArray2DataT< DataType >.

Definition at line 86 of file Array2Data.h.

References Arcane::makeRef().

Here is the call graph for this function:

◆ computeHash() [1/2]

template<typename DataType>
void Arcane::Array2DataT< DataType >::computeHash ( DataHashInfo & hash_algo) const

Definition at line 453 of file Array2Data.inst.h.

◆ computeHash() [2/2]

template<typename DataType>
void Arcane::Array2DataT< DataType >::computeHash ( IHashAlgorithm * algo,
ByteArray & output ) const
overridevirtual

Compute a hash key on this data.

The key is added to output. The length of the key depends on the algorithm used.

Implements Arcane::IData.

Definition at line 427 of file Array2Data.inst.h.

References Arcane::IHashAlgorithm::computeHash64(), Arcane::Array< T >::data(), Arcane::SpanImpl< T, SizeType, Extent >::data(), m_value, Arcane::AbstractArray< T >::size(), and Arcane::SpanImpl< T, SizeType, Extent >::size().

Here is the call graph for this function:

◆ copy()

template<typename DataType>
void Arcane::Array2DataT< DataType >::copy ( const IData * data)
overridevirtual

Copy the data data into the current instance.

The data data must be of the same type as the instance.

Implements Arcane::IData.

Definition at line 473 of file Array2Data.inst.h.

References m_value.

◆ createSerializedDataRef()

template<typename DataType>
Ref< ISerializedData > Arcane::Array2DataT< DataType >::createSerializedDataRef ( bool use_basic_type) const
overridevirtual

Serialize the data.

For performance reasons, the returned instance may directly reference the memory area of this data. Consequently, it is only valid as long as this data is not modified. If you wish to modify this instance, you must first clone it (via IData::cloneRef()) and then serialize the cloned data.

If use_basic_type is true, the data is serialized for a basic type, namely DT_Byte, DT_Int16, DT_Int32, DT_Int64 or DT_Real. Otherwise, the type can be a POD, namely DT_Byte, DT_Int16, DT_Int32, DT_Int64, DT_Real, DT_Real2, DT_Real3, DT_Real2x2, DT_Real3x3.

Implements Arcane::IData.

Definition at line 133 of file Array2Data.inst.h.

References Arcane::arcaneCreateSerializedDataRef(), dataType(), m_value, Arcane::Array< T >::resize(), shape(), and Arcane::SpanImpl< T, SizeType, Extent >::size().

Here is the call graph for this function:

◆ dataType()

template<class DataType>
eDataType Arcane::Array2DataT< DataType >::dataType ( ) const
inlineoverridevirtual

Data type.

Implements Arcane::IData.

Definition at line 71 of file Array2Data.h.

Referenced by allocateBufferForSerializedData(), and createSerializedDataRef().

Here is the caller graph for this function:

◆ dimension()

template<class DataType>
Integer Arcane::Array2DataT< DataType >::dimension ( ) const
inlineoverridevirtual

Dimension. 0 for a scalar, 1 for a mono-dim array, 2 for a bi-dim array.

Implements Arcane::IData.

Definition at line 69 of file Array2Data.h.

◆ fillDefault()

template<typename DataType>
void Arcane::Array2DataT< DataType >::fillDefault ( )
overridevirtual

Fills the data with its default value.

Implements Arcane::IData.

Definition at line 409 of file Array2Data.inst.h.

References m_value.

◆ multiTag()

template<class DataType>
Integer Arcane::Array2DataT< DataType >::multiTag ( ) const
inlineoverridevirtual

Multi-tag. 0 if not multiple, 1 if multiple, 2 if multiple for MultiArray variables (obsolete).

Implements Arcane::IData.

Definition at line 70 of file Array2Data.h.

◆ resize()

template<typename DataType>
void Arcane::Array2DataT< DataType >::resize ( Integer new_size)
overridevirtual

Resize the data.

This operation only makes sense for data of dimension 1 or more. If the new number of elements is greater than the old one, the values added to the data are not initialized.

Implements Arcane::IData.

Definition at line 124 of file Array2Data.inst.h.

References m_value.

◆ serialize() [1/2]

template<typename DataType>
void Arcane::Array2DataT< DataType >::serialize ( ISerializer * sbuf,
IDataOperation * operation )
overridevirtual

Serializes the data by applying the operation.

Implements Arcane::IData.

Definition at line 208 of file Array2Data.inst.h.

References ARCANE_FATAL, Arcane::ISerializer::getSpan(), Arcane::Int64, m_value, Arcane::ISerializer::mode(), Arcane::ISerializer::ModeGet, Arcane::ISerializer::ModePut, Arcane::ISerializer::putSpan(), Arcane::ISerializer::ReadAdd, Arcane::ISerializer::readMode(), Arcane::ISerializer::ReadReplace, and Arcane::ISerializer::reserveSpan().

Here is the call graph for this function:

◆ serialize() [2/2]

template<typename DataType>
void Arcane::Array2DataT< DataType >::serialize ( ISerializer * sbuf,
Int32ConstArrayView ids,
IDataOperation * operation )
overridevirtual

Serialize the data for the indices ids.

This operation only makes sense for data of dimension 1 or more.

Implements Arcane::IData.

Definition at line 280 of file Array2Data.inst.h.

References ARCANE_FATAL, Arcane::Array< T >::data(), Arcane::ISerializer::getSpan(), Arcane::Int64, m_value, Arcane::ISerializer::mode(), Arcane::ISerializer::ModeGet, Arcane::ISerializer::ModePut, Arcane::ISerializer::putSpan(), Arcane::ISerializer::ReadAdd, Arcane::ISerializer::readMode(), Arcane::ISerializer::ReadReplace, Arcane::ISerializer::reserveSpan(), Arcane::Array< T >::resize(), Arcane::ConstArrayView< T >::size(), Arcane::SpanImpl< T, SizeType, Extent >::size(), and Arcane::Array< T >::view().

Here is the call graph for this function:

◆ setAllocationInfo()

template<typename DataType>
void Arcane::Array2DataT< DataType >::setAllocationInfo ( const DataAllocationInfo & v)
overridevirtual

Sets the allocation information.

Implements Arcane::IData.

Definition at line 506 of file Array2Data.inst.h.

References m_value.

◆ setName()

template<typename DataType>
void Arcane::Array2DataT< DataType >::setName ( const String & name)
overridevirtual

Sets the name of the data (internal).

Implements Arcane::IData.

Definition at line 418 of file Array2Data.inst.h.

References m_value.

◆ setShape()

template<class DataType>
void Arcane::Array2DataT< DataType >::setShape ( const ArrayShape & new_shape)
inlineoverridevirtual

Sets the array shape.

Implements Arcane::IData.

Definition at line 106 of file Array2Data.h.

◆ shape()

template<class DataType>
ArrayShape Arcane::Array2DataT< DataType >::shape ( ) const
inlineoverridevirtual

Array shape for a 1D or 2D data item.

The shape is only considered for dimensions greater than 1. For a 1D data item, the shape is therefore by default {1}. For a 2D array, the shape defaults to {dim2_size}. It is possible to change the rank of the shape and its values as long as shape().totalNbElement()==dim2_size. For example, if the number of values dim2_size is 12, then it is possible to have { 12 }, { 6, 2 } or { 3, 2, 2 } as the shape.

The values are not preserved during a restart, so the shape must be repositioned in this case. It is up to the user to ensure that the shape is homogeneous across sub-domains.

Implements Arcane::IData.

Definition at line 105 of file Array2Data.h.

Referenced by createSerializedDataRef().

Here is the caller graph for this function:

◆ staticStorageTypeInfo()

template<typename DataType>
DataStorageTypeInfo Arcane::Array2DataT< DataType >::staticStorageTypeInfo ( )
static

Definition at line 101 of file Array2Data.inst.h.

◆ storageTypeInfo()

template<typename DataType>
DataStorageTypeInfo Arcane::Array2DataT< DataType >::storageTypeInfo ( ) const
overridevirtual

Information about the data container type.

Implements Arcane::IData.

Definition at line 115 of file Array2Data.inst.h.

◆ swapValues()

template<typename DataType>
void Arcane::Array2DataT< DataType >::swapValues ( IData * data)
overridevirtual

Swap the values of data with those of the instance.

The data IData must be of the same type as the instance. Only the values are swapped and other possible properties (such as the name, for example) are not modified.

Implements Arcane::IData.

Definition at line 485 of file Array2Data.inst.h.

◆ swapValuesDirect()

template<typename DataType>
void Arcane::Array2DataT< DataType >::swapValuesDirect ( ThatClass * true_data)

Definition at line 497 of file Array2Data.inst.h.

◆ value() [1/2]

template<class DataType>
const Array2< DataType > & Arcane::Array2DataT< DataType >::value ( ) const
inlineoverridevirtual

Data value.

Implements Arcane::IArray2DataT< DataType >.

Definition at line 75 of file Array2Data.h.

References m_value.

◆ value() [2/2]

template<class DataType>
Array2< DataType > & Arcane::Array2DataT< DataType >::value ( )
inlineoverridevirtual

Data value.

Implements Arcane::IArray2DataT< DataType >.

Definition at line 74 of file Array2Data.h.

References m_value.

Referenced by Arcane::Array2DataT< DataType >::Impl::memoryView().

Here is the caller graph for this function:

◆ view() [1/2]

template<class DataType>
ConstArray2View< DataType > Arcane::Array2DataT< DataType >::view ( ) const
inlineoverridevirtual

Constant view on the data.

Implements Arcane::IArray2DataT< DataType >.

Definition at line 77 of file Array2Data.h.

References m_value.

◆ view() [2/2]

template<class DataType>
Array2View< DataType > Arcane::Array2DataT< DataType >::view ( )
inlineoverridevirtual

View on the data.

Implements Arcane::IArray2DataT< DataType >.

Definition at line 76 of file Array2Data.h.

References m_value.

◆ visit() [1/2]

template<class DataType>
void Arcane::Array2DataT< DataType >::visit ( IArray2DataVisitor * visitor)
inline

Definition at line 110 of file Array2Data.h.

◆ visit() [2/2]

template<class DataType>
void Arcane::Array2DataT< DataType >::visit ( IDataVisitor * visitor)
inlineoverridevirtual

Applies the visitor to the data.

Implements Arcane::IData.

Definition at line 114 of file Array2Data.h.

◆ visitArray()

template<class DataType>
void Arcane::Array2DataT< DataType >::visitArray ( IArrayDataVisitor * visitor)
inlineoverridevirtual

Apply the visitor to the data.

If the data is not a 1D array, an exception NotSupportedException is thrown.

Implements Arcane::IData.

Definition at line 122 of file Array2Data.h.

References ARCANE_THROW.

◆ visitArray2()

template<class DataType>
void Arcane::Array2DataT< DataType >::visitArray2 ( IArray2DataVisitor * visitor)
inlineoverridevirtual

Apply the visitor to the data.

If the data is not a 2D array, an exception NotSupportedException is thrown.

Implements Arcane::IData.

Definition at line 126 of file Array2Data.h.

◆ visitScalar()

template<class DataType>
void Arcane::Array2DataT< DataType >::visitScalar ( IScalarDataVisitor * visitor)
inlineoverridevirtual

Apply the visitor to the data.

If the data is not scalar, a NotSupportedException is thrown.

Implements Arcane::IData.

Definition at line 118 of file Array2Data.h.

References ARCANE_THROW.

◆ Impl

template<class DataType>
friend class Impl
friend

Definition at line 53 of file Array2Data.h.

Member Data Documentation

◆ m_allocation_info

template<class DataType>
DataAllocationInfo Arcane::Array2DataT< DataType >::m_allocation_info
private

Definition at line 151 of file Array2Data.h.

◆ m_internal

template<class DataType>
IArray2DataInternalT<DataType>* Arcane::Array2DataT< DataType >::m_internal
private

Definition at line 149 of file Array2Data.h.

◆ m_shape

template<class DataType>
ArrayShape Arcane::Array2DataT< DataType >::m_shape
private

Definition at line 150 of file Array2Data.h.

◆ m_trace

template<class DataType>
ITraceMng* Arcane::Array2DataT< DataType >::m_trace
private

Definition at line 148 of file Array2Data.h.

◆ m_value

template<class DataType>
UniqueArray2<DataType> Arcane::Array2DataT< DataType >::m_value
private

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