Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
VariableArray.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/* VariableArray.h (C) 2000-2025 */
9/* */
10/* 1D array variable. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_VARIABLEARRAY_H
13#define ARCANE_CORE_VARIABLEARRAY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/Variable.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
34template <class T>
36: public Variable
37{
38 public:
39
40 typedef Array<T> ValueType;
41 typedef IArrayDataT<T> ValueDataType;
42 typedef VariableArrayT<T> ThatClass;
43 typedef Variable BaseClass;
44
45 protected:
46
49
50 public:
51
52 ~VariableArrayT() override;
53
54 public:
55
56 static ARCANE_CORE_EXPORT ThatClass* getReference(IVariable* var);
57 static ARCANE_CORE_EXPORT ThatClass* getReference(const VariableBuildInfo& v, const VariableInfo& vi);
58
59 public:
60
61 void synchronize() override;
62 void synchronize(Int32ConstArrayView local_ids) override;
63 virtual void resizeWithReserve(Integer n, Integer nb_additional);
64 Real allocatedMemory() const override;
65 bool initialize(const ItemGroup& group, const String& value) override;
66 Integer nbElement() const override { return m_value->view().size(); }
67 ARCCORE_DEPRECATED_2021("use valueView() instead")
68 ARCANE_CORE_EXPORT ValueType& value();
69 ConstArrayView<T> constValueView() const { return m_value->view(); }
70 ConstArrayView<T> valueView() const { return m_value->view(); }
71 ArrayView<T> valueView() { return m_value->view(); }
72 ARCANE_CORE_EXPORT void shrinkMemory() override;
73 ARCANE_CORE_EXPORT Integer capacity();
74 void copyItemsValues(Int32ConstArrayView source, Int32ConstArrayView destination) override;
76 Int32ConstArrayView second_source,
77 Int32ConstArrayView destination) override;
78 void compact(Int32ConstArrayView old_to_new_ids) override;
79 void print(std::ostream& o) const override;
80 void setIsSynchronized() override;
81 void setIsSynchronized(const ItemGroup& item_group) override;
82 IData* data() override { return m_value; }
83 const IData* data() const override { return m_value; }
84
85 virtual void fill(const T& v);
86 virtual void fill(const T& v, const ItemGroup& item_group);
87
88 public:
89
90 ARCANE_CORE_EXPORT void swapValues(ThatClass& rhs);
91 ValueDataType* trueData() { return m_value; }
92
93 protected:
94
95 void _internalResize(const VariableResizeArgs& resize_args) override;
97
98 private:
99
100 ValueDataType* m_value;
101};
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105
106} // End namespace Arcane
107
108/*---------------------------------------------------------------------------*/
109/*---------------------------------------------------------------------------*/
110
111#endif
Base class for 1D data vectors.
Constant view of an array of type T.
Interface of a 1D array data item of type T.
Definition IData.h:300
virtual ConstArrayView< DataType > view() const =0
Constant view on the data.
Interface of a data item.
Definition IData.h:34
Interface of a variable.
Definition IVariable.h:40
Mesh entity group.
Definition ItemGroup.h:51
VariableArrayT(const VariableBuildInfo &v, const VariableInfo &vi)
Construit une variable basée sur la référence v.
void copyItemsMeanValues(Int32ConstArrayView first_source, Int32ConstArrayView second_source, Int32ConstArrayView destination) override
Copies the mean values of entities numbered first_source and second_source into entities numbered des...
void synchronize(Int32ConstArrayView local_ids) override
Synchronizes the variable on a list of entities.
void shrinkMemory() override
Frees any additional memory allocated for the data.
Integer nbElement() const override
Number of elements of the variable.
void compact(Int32ConstArrayView old_to_new_ids) override
Compresses the variable's values.
bool initialize(const ItemGroup &group, const String &value) override
Initializes the variable.
void copyItemsValues(Int32ConstArrayView source, Int32ConstArrayView destination) override
Copies the values of entities numbered source into entities numbered destination.
void setIsSynchronized(const ItemGroup &item_group) override
Indicates that the variable is synchronized on the group item_group.
const IData * data() const override
Data associated with the variable.
IData * data() override
Data associated with the variable.
VariableComparerResults _compareVariable(const VariableComparerArgs &compare_args) final
Comparison of values between variables.
void print(std::ostream &o) const override
Prints the variable's values to the stream o.
void setIsSynchronized() override
Indicates that the variable is synchronized.
Real allocatedMemory() const override
Memory size (in Bytes) used by the variable.
void synchronize() override
Synchronizes the variable.
Parameters necessary for building a variable.
Arguments for VariableComparer methods.
Results of a comparison operation.
Information characterizing a variable.
Variable(const VariableBuildInfo &v, const VariableInfo &vi)
Creates a variable linked to the reference v.
Definition Variable.cc:344
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
double Real
Type representing a real number.