Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ItemGenericInfoListView.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/* ItemGenericInfoListView.h (C) 2000-2025 */
9/* */
10/* View of the generic information of an entity family. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_ITEMGENERICINFOLISTVIEW_H
13#define ARCANE_CORE_ITEMGENERICINFOLISTVIEW_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/ArrayView.h"
18
20#include "arcane/core/ItemSharedInfo.h"
21#include "arcane/core/ItemUniqueId.h"
22#include "arcane/core/ItemLocalId.h"
23#include "arcane/core/ItemFlags.h"
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane
29{
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
34/*!
35 * \brief View of the generic information of an entity family.
36 *
37 * Like all views, instances of this class are temporary
38 * and should not be kept when the associated family is modified.
39 */
40class ARCANE_CORE_EXPORT ItemGenericInfoListView
41{
42 friend class ItemInfoListView;
43
44 public:
45
46 ItemGenericInfoListView() = default;
47
48 /*!
49 * \brief Constructs a view associated with the family \a family.
50 *
51 * \a family may be \a nullptr in which case the instance is
52 * not usable for retrieving information about entities
53 */
54 explicit ItemGenericInfoListView(IItemFamily* family);
55
56 explicit ItemGenericInfoListView(const ItemInfoListView& info_list_view);
57
58 public:
59
60 //! Associated family
61 IItemFamily* itemFamily() const { return m_item_shared_info->itemFamily(); }
62
63 //! Owner of the entity with local ID \a local_id
64 constexpr ARCCORE_HOST_DEVICE Int32 owner(Int32 local_id) const { return m_owners[local_id]; }
65
66 //! Owner of the entity with local ID \a local_id
67 constexpr ARCCORE_HOST_DEVICE Int32 owner(ItemLocalId local_id) const { return m_owners[local_id.localId()]; }
68
69 //! Type of the entity with local ID \a local_id
70 constexpr ARCCORE_HOST_DEVICE Int16 typeId(Int32 local_id) const { return m_type_ids[local_id]; }
71
72 //! Type of the entity with local ID \a local_id
73 constexpr ARCCORE_HOST_DEVICE Int16 typeId(ItemLocalId local_id) const { return m_type_ids[local_id.localId()]; }
74
75 //! uniqueId() of the entity with local ID \a local_id
76 ARCCORE_HOST_DEVICE ItemUniqueId uniqueId(Int32 local_id) const
77 {
78 return ItemUniqueId{ m_unique_ids[local_id] };
79 }
80
81 //! uniqueId() of the entity with local ID \a local_id
82 ARCCORE_HOST_DEVICE ItemUniqueId uniqueId(ItemLocalId local_id) const
83 {
84 return ItemUniqueId{ m_unique_ids[local_id.localId()] };
85 }
86
87 //! Indicates if the entity with local ID \a local_id belongs to the subdomain
88 constexpr ARCCORE_HOST_DEVICE bool isOwn(Int32 local_id) const
89 {
90 return ItemFlags::isOwn(m_flags[local_id]);
91 }
92
93 //! Indicates if the entity with local ID \a local_id belongs to the subdomain
94 constexpr ARCCORE_HOST_DEVICE bool isOwn(ItemLocalId local_id) const
95 {
96 return ItemFlags::isOwn(m_flags[local_id]);
97 }
98
99 //! Indicates if the entity with local ID \a local_id is shared by other subdomains
100 constexpr ARCCORE_HOST_DEVICE bool isShared(Int32 local_id) const
101 {
102 return ItemFlags::isShared(m_flags[local_id]);
103 }
104
105 //! Indicates if the entity with local ID \a local_id is shared by other subdomains
106 constexpr ARCCORE_HOST_DEVICE bool isShared(ItemLocalId local_id) const
107 {
108 return ItemFlags::isShared(m_flags[local_id]);
109 }
110
111 private:
112
113 // NOTE: This structure is used in the C# wrapping.
114 // If the fields are modified, the equivalent C# structure must be updated
115 Int64ArrayView m_unique_ids;
116 Int32ArrayView m_owners;
117 Int32ArrayView m_flags;
118 Int16ArrayView m_type_ids;
119 ItemSharedInfo* m_item_shared_info = ItemSharedInfo::nullInstance();
120
121 private:
122
123 // Only ItemFamily can create instances via this constructor
124 explicit ItemGenericInfoListView(ItemSharedInfo* shared_info);
125};
126
127/*---------------------------------------------------------------------------*/
128/*---------------------------------------------------------------------------*/
129
130} // End namespace Arcane
131
132/*---------------------------------------------------------------------------*/
133/*---------------------------------------------------------------------------*/
134
135#endif
Declarations of types on entities.
Interface of an entity family.
Definition IItemFamily.h:83
View of the generic information of an entity family.
constexpr __host__ __device__ bool isOwn(Int32 local_id) const
Indicates if the entity with local ID local_id belongs to the subdomain.
constexpr __host__ __device__ Int16 typeId(ItemLocalId local_id) const
Type of the entity with local ID local_id.
IItemFamily * itemFamily() const
Associated family.
constexpr __host__ __device__ Int32 owner(ItemLocalId local_id) const
Owner of the entity with local ID local_id.
constexpr __host__ __device__ bool isShared(ItemLocalId local_id) const
Indicates if the entity with local ID local_id is shared by other subdomains.
constexpr __host__ __device__ bool isOwn(ItemLocalId local_id) const
Indicates if the entity with local ID local_id belongs to the subdomain.
__host__ __device__ ItemUniqueId uniqueId(ItemLocalId local_id) const
uniqueId() of the entity with local ID local_id
constexpr __host__ __device__ Int16 typeId(Int32 local_id) const
Type of the entity with local ID local_id.
constexpr __host__ __device__ Int32 owner(Int32 local_id) const
Owner of the entity with local ID local_id.
constexpr __host__ __device__ bool isShared(Int32 local_id) const
Indicates if the entity with local ID local_id is shared by other subdomains.
__host__ __device__ ItemUniqueId uniqueId(Int32 local_id) const
uniqueId() of the entity with local ID local_id
Index of an Item in a variable.
Definition ItemLocalId.h:42
Unique identifier of an entity.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
ArrayView< Int64 > Int64ArrayView
C equivalent of a 1D array of 64-bit integers.
Definition UtilsTypes.h:451
ArrayView< Int16 > Int16ArrayView
C equivalent of a 1D array of 16-bit integers.
Definition UtilsTypes.h:455
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:453
std::int16_t Int16
Signed integer type of 16 bits.
std::int32_t Int32
Signed integer type of 32 bits.