Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
FullItemInfo.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/* FullItemInfo.h (C) 2000-2022 */
9/* */
10/* Serialization information for a cell. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MESH_FULLCELLINFO_H
13#define ARCANE_MESH_FULLCELLINFO_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/mesh/MeshGlobal.h"
18
19#include "arcane/utils/CheckedConvert.h"
20
21#include "arcane/core/ItemTypeMng.h"
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane::mesh
28{
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
38{
39 public:
40
41 enum
42 { // parent info
43 PI_Node = 1 << 1,
44 PI_Edge = 1 << 2,
45 PI_Face = 1 << 3,
46 PI_Cell = 1 << 4
47 };
48
49 public:
50
56 FullCellInfo(Int64ConstArrayView cells_infos, Integer cell_index,
57 ItemTypeMng* itm, Integer parent_info,
58 bool has_edge, bool has_amr, bool with_flags = false);
59
60 public:
61
62 ItemTypeInfo* typeInfo() const { return m_type; }
63 Integer typeId() const { return CheckedConvert::toInteger(m_infos[0]); }
64 Int64 uniqueId() const { return m_infos[1]; }
65 Integer owner() const { return CheckedConvert::toInteger(m_infos[2]); }
66 Integer nbNode() const { return m_nb_node; }
67 Integer nbEdge() const { return m_nb_edge; }
68 Integer nbFace() const { return m_nb_face; }
69 Int64 faceUniqueId(Integer index) const { return m_infos[m_first_face + (index * 2)]; }
70 Int32 faceOwner(Integer index) const { return CheckedConvert::toInt32(m_infos[m_first_face + (index * 2) + 1]); }
71 Int64 edgeUniqueId(Integer index) const { return m_infos[m_first_edge + (index * 2)]; }
72 Int32 edgeOwner(Integer index) const { return CheckedConvert::toInt32(m_infos[m_first_edge + (index * 2) + 1]); }
73 Int64 nodeUniqueId(Integer index) const { return m_infos[3 + (index * 2)]; }
74 Int32 nodeOwner(Integer index) const { return CheckedConvert::toInt32(m_infos[3 + (index * 2) + 1]); }
75 Integer memoryUsed() const { return m_memory_used; }
76 bool hasParentNode() const { return (m_parent_info & PI_Node); }
77 Int64 parentNodeUniqueId(Integer index) const { return m_infos[m_first_parent_node + index]; }
78 bool hasParentEdge() const { return (m_parent_info & PI_Edge); }
79 Int64 parentEdgeUniqueId(Integer index) const { return m_infos[m_first_parent_edge + (index * 2)]; }
80 Int64 parentEdgeTypeId(Integer index) const { return m_infos[m_first_parent_edge + (index * 2) + 1]; }
81 bool hasParentFace() const { return (m_parent_info & PI_Face); }
82 Int64 parentFaceUniqueId(Integer index) const { return m_infos[m_first_parent_face + (index * 2)]; }
83 Int64 parentFaceTypeId(Integer index) const { return m_infos[m_first_parent_face + (index * 2) + 1]; }
84 bool hasParentCell() const { return (m_parent_info & PI_Cell); }
85 Int64 parentCellUniqueId() const { return m_infos[m_first_parent_cell]; }
86 Int64 parentCellTypeId() const { return m_infos[m_first_parent_cell + 1]; }
88 Integer level() const { return CheckedConvert::toInteger(m_infos[m_first_hParent_cell]); }
89 Int64 hParentCellUniqueId() const { return m_infos[m_first_hParent_cell + 1]; }
90 Integer whichChildAmI() const { return CheckedConvert::toInteger(m_infos[m_first_hParent_cell + 2]); }
91 Int32 flags() const { return CheckedConvert::toInt32(m_with_flags ? m_infos[m_first_hParent_cell + 3] : 0); }
92
93 friend inline std::ostream& operator<<(std::ostream& o, const FullCellInfo& i)
94 {
95 i.print(o);
96 return o;
97 }
98
99 public:
100
101 void print(std::ostream& o) const;
102
103 public:
104
106
107 ARCCORE_DEPRECATED_2020("Use dump() overload with buffer")
108 static Integer memoryUsed(ItemTypeInfo* it, Integer parent_info, bool has_edge, bool has_amr, bool with_flags);
109 ARCCORE_DEPRECATED_2020("Use dump() overload with buffer")
110 static void dump(ItemInternal* cell, ISerializer* buf, Integer parent_info, bool has_edge, bool has_amr, bool with_flags);
111
112 static void dump(Cell cell, Array<Int64>& buf, Integer parent_info, bool has_edge, bool has_amr, bool with_flags);
113 static Integer parentInfo(IMesh* mesh);
114
115 protected:
116
117 void _setInternalInfos();
118
119 public:
120
121 Int64ConstArrayView m_infos;
122
123 private:
124
125 Integer m_nb_node;
126 Integer m_nb_edge;
127 Integer m_nb_face;
128
129 public:
130
131 Integer m_first_edge;
132 Integer m_first_face;
133 Integer m_memory_used;
134 ItemTypeInfo* m_type;
135 Integer m_first_parent_node;
136 Integer m_first_parent_edge;
137 Integer m_first_parent_face;
138 Integer m_first_parent_cell;
139 Integer m_parent_info;
140 bool m_has_edge;
143 bool m_has_amr;
144 bool m_with_flags;
145};
146
147/*---------------------------------------------------------------------------*/
148/*---------------------------------------------------------------------------*/
149
150} // End namespace Arcane::mesh
151
152/*---------------------------------------------------------------------------*/
153/*---------------------------------------------------------------------------*/
154
155#endif
Declarations of types on entities.
Info on a mesh entity type.
Mesh entity type manager.
Definition ItemTypeMng.h:66
Integer level() const
AMR.
FullCellInfo(Int64ConstArrayView cells_infos, Integer cell_index, ItemTypeMng *itm, Integer parent_info, bool has_edge, bool has_amr, bool with_flags=false)
References the info of a cell.
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
Definition UtilsTypes.h:480
@ Cell
The mesh is AMR by cell.
Definition MeshKind.h:53
std::int32_t Int32
Signed integer type of 32 bits.