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

Implementation of an 'IData' whose container is based on a 'NumArray'. More...

Inheritance diagram for Arcane::NumArrayDataT< DataType, RankValue >:
Collaboration diagram for Arcane::NumArrayDataT< DataType, RankValue >:

Classes

class  Internal

Public Types

typedef NumArrayDataT< DataType, RankValue > ThatClass
typedef INumArrayDataT< DataType, RankValue > DataInterfaceType
using ExtentType = typename MDDimType<RankValue>::DimType
Public Types inherited from Arcane::INumArrayDataT< DataType, RankValue >
typedef INumArrayDataT< DataType, RankValue > ThatClass
using ExtentType = typename MDDimType<RankValue>::DimType

Public Member Functions

 NumArrayDataT (ITraceMng *trace)
 NumArrayDataT (const DataStorageBuildInfo &dsbi)
 NumArrayDataT (const NumArrayDataT< DataType, RankValue > &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.
MDSpan< DataType, ExtentType > view () override
 View of the data.
MDSpan< const DataType, ExtentType > view () const override
 Constant view of 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.
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.
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 *)
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 *) override
 Apply the visitor to the data.
IDataInternal_commonInternal () override
void swapValuesDirect (ThatClass *true_data)
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 ()
INumArrayDataT< DataType, RankValue > * _cloneTrue () const
INumArrayDataT< DataType, RankValue > * _cloneTrueEmpty () const
void _resizeDim1 (Int32 dim1_size)
Int64 _getDim2Size () const
Span2< DataType > _valueAsSpan2 ()
Span2< const DataType > _valueAsConstSpan2 ()

Private Attributes

friend Impl
NumArray< DataType, ExtentType > m_value
 Data.
ITraceMngm_trace
ArrayShape m_shape
Internal m_internal
DataAllocationInfo m_allocation_info

Detailed Description

template<class DataType, int RankValue>
class Arcane::NumArrayDataT< DataType, RankValue >

Implementation of an 'IData' whose container is based on a 'NumArray'.

Definition at line 99 of file NumArrayData.cc.

Member Typedef Documentation

◆ DataInterfaceType

template<class DataType, int RankValue>
typedef INumArrayDataT<DataType, RankValue> Arcane::NumArrayDataT< DataType, RankValue >::DataInterfaceType

Definition at line 110 of file NumArrayData.cc.

◆ ExtentType

template<class DataType, int RankValue>
using Arcane::NumArrayDataT< DataType, RankValue >::ExtentType = typename MDDimType<RankValue>::DimType

Definition at line 111 of file NumArrayData.cc.

◆ ThatClass

template<class DataType, int RankValue>
typedef NumArrayDataT<DataType, RankValue> Arcane::NumArrayDataT< DataType, RankValue >::ThatClass

Definition at line 109 of file NumArrayData.cc.

Constructor & Destructor Documentation

◆ NumArrayDataT() [1/3]

template<typename DataType, int RankValue>
Arcane::NumArrayDataT< DataType, RankValue >::NumArrayDataT ( ITraceMng * trace)
explicit

Definition at line 222 of file NumArrayData.cc.

◆ NumArrayDataT() [2/3]

template<typename DataType, int RankValue>
Arcane::NumArrayDataT< DataType, RankValue >::NumArrayDataT ( const DataStorageBuildInfo & dsbi)
explicit

Definition at line 242 of file NumArrayData.cc.

◆ NumArrayDataT() [3/3]

template<typename DataType, int RankValue>
Arcane::NumArrayDataT< DataType, RankValue >::NumArrayDataT ( const NumArrayDataT< DataType, RankValue > & rhs)

Definition at line 231 of file NumArrayData.cc.

◆ ~NumArrayDataT()

template<typename DataType, int RankValue>
Arcane::NumArrayDataT< DataType, RankValue >::~NumArrayDataT ( )
override

Definition at line 251 of file NumArrayData.cc.

Member Function Documentation

◆ _cloneTrue()

template<class DataType, int RankValue>
INumArrayDataT< DataType, RankValue > * Arcane::NumArrayDataT< DataType, RankValue >::_cloneTrue ( ) const
inlineprivate

Definition at line 211 of file NumArrayData.cc.

◆ _cloneTrueEmpty()

template<class DataType, int RankValue>
INumArrayDataT< DataType, RankValue > * Arcane::NumArrayDataT< DataType, RankValue >::_cloneTrueEmpty ( ) const
inlineprivate

Definition at line 212 of file NumArrayData.cc.

◆ _commonInternal()

template<class DataType, int RankValue>
IDataInternal * Arcane::NumArrayDataT< DataType, RankValue >::_commonInternal ( )
inlineoverridevirtual

Implements Arcane::IData.

Definition at line 191 of file NumArrayData.cc.

◆ _getDim2Size()

template<typename DataType, int RankValue>
Int64 Arcane::NumArrayDataT< DataType, RankValue >::_getDim2Size ( ) const
private

Definition at line 299 of file NumArrayData.cc.

◆ _resizeDim1()

template<typename DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::_resizeDim1 ( Int32 dim1_size)
private

Definition at line 286 of file NumArrayData.cc.

◆ _valueAsConstSpan2()

template<typename DataType, int RankValue>
Span2< const DataType > Arcane::NumArrayDataT< DataType, RankValue >::_valueAsConstSpan2 ( )
private

Definition at line 333 of file NumArrayData.cc.

◆ _valueAsSpan2()

template<typename DataType, int RankValue>
Span2< DataType > Arcane::NumArrayDataT< DataType, RankValue >::_valueAsSpan2 ( )
private

Definition at line 317 of file NumArrayData.cc.

◆ allocateBufferForSerializedData()

template<typename DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::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 390 of file NumArrayData.cc.

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

Here is the call graph for this function:

◆ allocationInfo()

template<class DataType, int RankValue>
DataAllocationInfo Arcane::NumArrayDataT< DataType, RankValue >::allocationInfo ( ) const
inlineoverridevirtual

Allocation information.

Implements Arcane::IData.

Definition at line 169 of file NumArrayData.cc.

◆ assignSerializedData()

template<typename DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::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 421 of file NumArrayData.cc.

◆ clone()

template<class DataType, int RankValue>
IData * Arcane::NumArrayDataT< DataType, RankValue >::clone ( )
inlineoverridevirtual

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

Implements Arcane::IData.

Definition at line 143 of file NumArrayData.cc.

◆ cloneEmpty()

template<class DataType, int RankValue>
IData * Arcane::NumArrayDataT< DataType, RankValue >::cloneEmpty ( )
inlineoverridevirtual

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

Implements Arcane::IData.

Definition at line 144 of file NumArrayData.cc.

◆ cloneEmptyRef()

template<class DataType, int RankValue>
Ref< IData > Arcane::NumArrayDataT< DataType, RankValue >::cloneEmptyRef ( )
inlineoverridevirtual

Clone the data but without elements.

Implements Arcane::IData.

Definition at line 146 of file NumArrayData.cc.

References Arcane::makeRef().

Here is the call graph for this function:

◆ cloneRef()

template<class DataType, int RankValue>
Ref< IData > Arcane::NumArrayDataT< DataType, RankValue >::cloneRef ( )
inlineoverridevirtual

Clone the data.

Implements Arcane::IData.

Definition at line 145 of file NumArrayData.cc.

References Arcane::makeRef().

Here is the call graph for this function:

◆ cloneTrueEmptyRef()

template<class DataType, int RankValue>
Ref< DataInterfaceType > Arcane::NumArrayDataT< DataType, RankValue >::cloneTrueEmptyRef ( )
inlineoverridevirtual

Clone the data but without elements.

Implements Arcane::INumArrayDataT< DataType, RankValue >.

Definition at line 153 of file NumArrayData.cc.

References Arcane::makeRef().

Here is the call graph for this function:

◆ cloneTrueRef()

template<class DataType, int RankValue>
Ref< DataInterfaceType > Arcane::NumArrayDataT< DataType, RankValue >::cloneTrueRef ( )
inlineoverridevirtual

Clone the data.

Implements Arcane::INumArrayDataT< DataType, RankValue >.

Definition at line 148 of file NumArrayData.cc.

References Arcane::makeRef().

Here is the call graph for this function:

◆ computeHash()

template<typename DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::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 672 of file NumArrayData.cc.

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

Here is the call graph for this function:

◆ copy()

template<typename DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::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 696 of file NumArrayData.cc.

References m_value.

◆ createSerializedDataRef()

template<typename DataType, int RankValue>
Ref< ISerializedData > Arcane::NumArrayDataT< DataType, RankValue >::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 355 of file NumArrayData.cc.

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

Here is the call graph for this function:

◆ dataType()

template<class DataType, int RankValue>
eDataType Arcane::NumArrayDataT< DataType, RankValue >::dataType ( ) const
inlineoverridevirtual

Data type.

Implements Arcane::IData.

Definition at line 137 of file NumArrayData.cc.

Referenced by allocateBufferForSerializedData(), and createSerializedDataRef().

Here is the caller graph for this function:

◆ dimension()

template<class DataType, int RankValue>
Integer Arcane::NumArrayDataT< DataType, RankValue >::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 135 of file NumArrayData.cc.

◆ fillDefault()

template<typename DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::fillDefault ( )
overridevirtual

Fills the data with its default value.

Implements Arcane::IData.

Definition at line 654 of file NumArrayData.cc.

References m_value.

◆ multiTag()

template<class DataType, int RankValue>
Integer Arcane::NumArrayDataT< DataType, RankValue >::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 136 of file NumArrayData.cc.

◆ resize()

template<typename DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::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 345 of file NumArrayData.cc.

◆ serialize() [1/2]

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

Serializes the data by applying the operation.

Implements Arcane::IData.

Definition at line 431 of file NumArrayData.cc.

References ARCANE_FATAL, ARCANE_THROW, Arcane::ISerializer::getSpan(), Arcane::Int32, 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, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::serialize ( ISerializer * sbuf,
Int32ConstArrayView ids,
IDataOperation * operation )
overridevirtual

◆ setAllocationInfo()

template<class DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::setAllocationInfo ( const DataAllocationInfo & v)
inlineoverridevirtual

Sets the allocation information.

Implements Arcane::IData.

Definition at line 168 of file NumArrayData.cc.

◆ setName()

template<typename DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::setName ( const String & name)
overridevirtual

Sets the name of the data (internal).

Implements Arcane::IData.

Definition at line 663 of file NumArrayData.cc.

◆ setShape()

template<class DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::setShape ( const ArrayShape & new_shape)
inlineoverridevirtual

Sets the array shape.

Implements Arcane::IData.

Definition at line 167 of file NumArrayData.cc.

◆ shape()

template<class DataType, int RankValue>
ArrayShape Arcane::NumArrayDataT< DataType, RankValue >::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 166 of file NumArrayData.cc.

Referenced by createSerializedDataRef().

Here is the caller graph for this function:

◆ staticStorageTypeInfo()

template<typename DataType, int RankValue>
DataStorageTypeInfo Arcane::NumArrayDataT< DataType, RankValue >::staticStorageTypeInfo ( )
static

Definition at line 262 of file NumArrayData.cc.

◆ storageTypeInfo()

template<typename DataType, int RankValue>
DataStorageTypeInfo Arcane::NumArrayDataT< DataType, RankValue >::storageTypeInfo ( ) const
overridevirtual

Information about the data container type.

Implements Arcane::IData.

Definition at line 277 of file NumArrayData.cc.

◆ swapValues()

template<typename DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::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 708 of file NumArrayData.cc.

◆ swapValuesDirect()

template<typename DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::swapValuesDirect ( ThatClass * true_data)

Definition at line 720 of file NumArrayData.cc.

◆ view() [1/2]

template<class DataType, int RankValue>
MDSpan< const DataType, ExtentType > Arcane::NumArrayDataT< DataType, RankValue >::view ( ) const
inlineoverridevirtual

Constant view of the data.

Implements Arcane::INumArrayDataT< DataType, RankValue >.

Definition at line 141 of file NumArrayData.cc.

References m_value.

◆ view() [2/2]

template<class DataType, int RankValue>
MDSpan< DataType, ExtentType > Arcane::NumArrayDataT< DataType, RankValue >::view ( )
inlineoverridevirtual

View of the data.

Implements Arcane::INumArrayDataT< DataType, RankValue >.

Definition at line 140 of file NumArrayData.cc.

References m_value.

◆ visit() [1/2]

template<class DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::visit ( IArray2DataVisitor * )
inline

Definition at line 170 of file NumArrayData.cc.

◆ visit() [2/2]

template<class DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::visit ( IDataVisitor * visitor)
inlineoverridevirtual

Applies the visitor to the data.

Implements Arcane::IData.

Definition at line 174 of file NumArrayData.cc.

References ARCANE_THROW.

◆ visitArray()

template<class DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::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 183 of file NumArrayData.cc.

References ARCANE_THROW.

◆ visitArray2()

template<class DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::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 187 of file NumArrayData.cc.

References ARCANE_THROW.

◆ visitScalar()

template<class DataType, int RankValue>
void Arcane::NumArrayDataT< DataType, RankValue >::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 179 of file NumArrayData.cc.

References ARCANE_THROW.

Member Data Documentation

◆ Impl

template<class DataType, int RankValue>
friend Arcane::NumArrayDataT< DataType, RankValue >::Impl
private

Definition at line 105 of file NumArrayData.cc.

◆ m_allocation_info

template<class DataType, int RankValue>
DataAllocationInfo Arcane::NumArrayDataT< DataType, RankValue >::m_allocation_info
private

Definition at line 207 of file NumArrayData.cc.

◆ m_internal

template<class DataType, int RankValue>
Internal Arcane::NumArrayDataT< DataType, RankValue >::m_internal
private

Definition at line 206 of file NumArrayData.cc.

◆ m_shape

template<class DataType, int RankValue>
ArrayShape Arcane::NumArrayDataT< DataType, RankValue >::m_shape
private

Definition at line 205 of file NumArrayData.cc.

◆ m_trace

template<class DataType, int RankValue>
ITraceMng* Arcane::NumArrayDataT< DataType, RankValue >::m_trace
private

Definition at line 204 of file NumArrayData.cc.

◆ m_value

template<class DataType, int RankValue>
NumArray<DataType, ExtentType> Arcane::NumArrayDataT< DataType, RankValue >::m_value
private

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