Arcane  v3.16.0.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
PrivateVariableArray.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2023 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/* PrivateVariableArray.h (C) 2000-2023 */
9/* */
10/* Classe gérant une variable array sur une entité du maillage. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_PRIVATEVARIABLEARRAY_H
13#define ARCANE_CORE_PRIVATEVARIABLEARRAY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/MeshVariableRef.h"
18
19#include "arcane/core/Array2Variable.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29/*!
30 * \ingroup Variable
31 * \brief Classe de factorisation des variables scalaires sur des entités du maillage.
32 */
33template<typename DataType>
34class PrivateVariableArrayT
35: public MeshVariableRef
36{
37 protected:
38
39 typedef DataType& DataTypeReturnReference;
40 typedef Array2VariableT<DataType> PrivatePartType;
41
42 protected:
43
44 ARCANE_CORE_EXPORT PrivateVariableArrayT(const VariableBuildInfo& vb, const VariableInfo& vi);
45 ARCANE_CORE_EXPORT PrivateVariableArrayT(const PrivateVariableArrayT& rhs);
46 ARCANE_CORE_EXPORT PrivateVariableArrayT(IVariable* var);
47
48 ARCANE_CORE_EXPORT void operator=(const PrivateVariableArrayT& rhs);
49
50 public:
51
52 Array2View<DataType> asArray() { return m_view; }
53 ConstArray2View<DataType> asArray() const { return m_view; }
54
55 Integer totalNbElement() const { return m_view.totalNbElement(); }
56
57 Integer arraySize() const { return m_view.dim2Size(); }
58
59 bool isArrayVariable() const { return true; }
60
61 ARCANE_CORE_EXPORT void updateFromInternal();
62
63 ARCANE_CORE_EXPORT ItemGroup itemGroup() const;
64
65 /*
66 * \brief Redimensionne le nombre d'éléments du tableau.
67 *
68 * La première dimension reste toujours égale au nombre d'éléments du maillage.
69 * Seule la deuxième composante est retaillée.
70 * \warning le redimensionnement ne conserve pas les valeurs précédentes...
71 */
72 ARCANE_CORE_EXPORT void resize(Int32 dim2_size);
73
74 /*
75 * \brief Redimensionne le nombre d'éléments du tableau.
76 *
77 * \sa resize(Int32)
78 */
79 ARCANE_CORE_EXPORT void resizeAndReshape(const ArrayShape& shape);
80
81 public:
82
83 SmallSpan2<DataType> _internalSpan() { return m_view; }
84 SmallSpan2<const DataType> _internalSpan() const { return m_view; }
85 SmallSpan2<const DataType> _internalConstSpan() const { return m_view; }
86
87 protected:
88
89 void _internalInit() { MeshVariableRef::_internalInit(m_private_part); }
90
91 protected:
92
93 PrivatePartType* m_private_part;
94
95 Array2View<DataType> m_view;
96};
97
98/*---------------------------------------------------------------------------*/
99/*---------------------------------------------------------------------------*/
100
101} // End namespace Arcane
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105
106#endif
Vue modifiable pour un tableau 2D.
MeshVariableRef(const VariableBuildInfo &vb)
Construit une référence liée au module module.
Integer arraySize() const
Si la variable est un tableau, retourne sa dimension, sinon retourne 0.
void updateFromInternal()
Mise à jour à partir de la partie interne.
Paramètres nécessaires à la construction d'une variable.
Infos caractérisant une variable.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.