Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
VariableRefArray2.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* VariableRefArray2.h (C) 2000-2025 */
9/* */
10/* Class managing a reference to a 2D array variable. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_VARIABLEREFARRAY2_H
13#define ARCANE_CORE_VARIABLEREFARRAY2_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/Array2View.h"
18#include "arcane/core/VariableRef.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
34template <typename T>
36: public VariableRef
37, public Array2View<T>
38{
39 public:
40
41 typedef T DataType;
42 typedef Array2<T> ValueType;
43 typedef ConstArrayView<T> ConstReturnReferenceType;
44 typedef ArrayView<T> ReturnReferenceType;
45
47 typedef DataType ElementType;
54
55 typedef Array2VariableT<DataType> PrivatePartType;
56
57 typedef VariableRefArray2T<DataType> ThatClass;
58
59 public:
60
62 ARCANE_CORE_EXPORT VariableRefArray2T(const VariableBuildInfo& vb);
64 ARCANE_CORE_EXPORT VariableRefArray2T(const VariableRefArray2T<DataType>& rhs);
66 explicit ARCANE_CORE_EXPORT VariableRefArray2T(IVariable* var);
71 ARCCORE_DEPRECATED_2021("Use refersTo() instead.")
72 ARCANE_CORE_EXPORT void operator=(const VariableRefArray2T<DataType>& rhs);
73 virtual ARCANE_CORE_EXPORT ~VariableRefArray2T();
74
75 public:
76
83 virtual ARCANE_CORE_EXPORT void resize(Integer new_size);
84
92 ARCANE_CORE_EXPORT void resize(Integer dim1_size, Integer dim2_size);
93
95 ARCANE_CORE_EXPORT void fill(const DataType& value);
96
98 ARCANE_CORE_EXPORT void refersTo(const VariableRefArray2T<DataType>& rhs);
99
100 public:
101
102 virtual bool isArrayVariable() const { return true; }
103 virtual Integer arraySize() const { return this->dim1Size(); }
104 Integer size() const { return this->dim1Size(); }
105 virtual ARCANE_CORE_EXPORT void updateFromInternal();
106
112 ARCCORE_DEPRECATED_2021("Use _internalTrueData() instead.")
113 ARCANE_CORE_EXPORT ContainerType& internalContainer();
114
115 public:
116
118 ARCANE_CORE_EXPORT IArray2DataInternalT<T>* _internalTrueData();
119
120 public:
121
122 static ARCANE_CORE_EXPORT VariableTypeInfo _internalVariableTypeInfo();
123 static ARCANE_CORE_EXPORT VariableInfo _internalVariableInfo(const VariableBuildInfo& vbi);
124
125 private:
126
127 PrivatePartType* m_private_part;
128
129 private:
130
131 static VariableFactoryRegisterer m_auto_registerer;
132 static VariableRef* _autoCreate(const VariableBuildInfo& vb);
133};
134
135/*---------------------------------------------------------------------------*/
136/*---------------------------------------------------------------------------*/
137
138} // End namespace Arcane
139
140/*---------------------------------------------------------------------------*/
141/*---------------------------------------------------------------------------*/
142
143#endif
Variable on a 2D array.
constexpr Array2View(T *ptr, Integer dim1_size, Integer dim2_size)
Class representing a classic 2D array.
Modifiable view of an array of type T.
Constant view of an array of type T.
Interface for a two-dimensional array data of type T.
Interface of a variable.
Definition IVariable.h:40
Parameters necessary for building a variable.
Information characterizing a variable.
void refersTo(const VariableRefArray2T< DataType > &rhs)
DataType ElementType
Type of the variable elements.
IArray2DataInternalT< DataType > * _internalTrueData()
VariableRefArray2T(const VariableBuildInfo &vb)
Constructs a reference to a 2D array variable specified in vb.
virtual void resize(Integer new_size)
void fill(const DataType &value)
virtual Integer arraySize() const
If the variable is an array, returns its dimension, otherwise returns 0.
VariableRefArray2T(const VariableRefArray2T< DataType > &rhs)
Constructs a reference from rhs.
Array2< DataType > ContainerType
Type of the class managing the variable value.
VariableRef BaseClass
Type of the base class.
virtual void updateFromInternal()
Updates from the internal part.
VariableRefArray2T(IVariable *var)
Constructs a reference from var.
Array2View< DataType > ArrayBase
Type of the array used to access the variable.
VariableRef(const VariableBuildInfo &vbi)
Constructs a reference to a variable with the infos vbi.
Information characterizing the type of a variable.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.