14#include "arcane/mesh/FullItemInfo.h"
16#include "arcane/ISerializer.h"
17#include "arcane/ItemInternal.h"
18#include "arcane/ItemInternalEnumerator.h"
20#include "arcane/mesh/DynamicMesh.h"
34 bool has_edge,
bool has_amr,
bool with_flags)
42, m_first_parent_node(0)
43, m_first_parent_edge(0)
44, m_first_parent_face(0)
45, m_first_parent_cell(0)
46, m_parent_info(parent_info)
50, m_with_flags(with_flags)
63print(std::ostream& o)
const
65 o <<
"Cell uid=" << uniqueId()
66 <<
" nb_node=" << nbNode()
67 <<
" nb_edge=" << nbEdge()
68 <<
" nb_face=" << nbFace()
70 for (
Integer z = 0, zs = nbNode(); z < zs; ++z)
71 o <<
" N" << z <<
"=" << nodeUniqueId(z);
72 for (
Integer z = 0, zs = nbEdge(); z < zs; ++z)
73 o <<
" E" << z <<
"=" << edgeUniqueId(z);
74 for (
Integer z = 0, zs = nbFace(); z < zs; ++z)
75 o <<
" F" << z <<
"=" << faceUniqueId(z);
82memoryUsed(
ItemTypeInfo* it,
Integer parent_info,
bool has_edge,
bool has_amr,
bool with_flags)
90 if (parent_info & PI_Node)
92 if (parent_info & PI_Edge)
94 if (parent_info & PI_Face)
96 if (parent_info & PI_Cell)
109 class SerializerDumpAdapter
118 m_serializer->putInt64(v);
123 ISerializer* m_serializer;
126 class ArrayDumpAdapter
130 ArrayDumpAdapter(Array<Int64>& a)
140 Array<Int64>& m_array_ref;
143 template <
typename Adapter>
void
144 _dumpCellInfo(
Cell cell, Adapter buf,
Integer parent_info,
145 bool has_edge,
bool has_amr,
bool with_flags)
147 buf.put(cell.type());
148 buf.put(cell.uniqueId().asInt64());
149 buf.put(cell.owner());
151 for (Item node : cell.nodes()) {
152 buf.put(node.uniqueId().asInt64());
153 buf.put(node.owner());
157 for (Edge edge : cell.edges()) {
158 buf.put(edge.uniqueId().asInt64());
159 buf.put(edge.owner());
162 for (Face face : cell.faces()) {
163 buf.put(face.uniqueId().asInt64());
164 buf.put(face.owner());
166 if (parent_info & FullCellInfo::PI_Node) {
167 for (Node node : cell.nodes()) {
168 Item parent = node.parent(0);
169 buf.put(parent.uniqueId().asInt64());
172 if (parent_info & FullCellInfo::PI_Edge) {
173 for (Edge edge : cell.edges()) {
174 Item parent = edge.parent(0);
175 buf.put(parent.uniqueId().asInt64());
176 buf.put(parent.type());
179 if (parent_info & FullCellInfo::PI_Face) {
180 for (Face face : cell.faces()) {
181 Item parent = face.parent(0);
182 buf.put(parent.uniqueId().asInt64());
183 buf.put(parent.type());
186 if (parent_info & FullCellInfo::PI_Cell) {
187 Item parent = cell.parent(0);
188 buf.put(parent.uniqueId().asInt64());
189 buf.put(parent.type());
193 buf.put(cell.level());
194 if (cell.level() == 0) {
195 buf.put(NULL_ITEM_ID);
196 buf.put(NULL_ITEM_ID);
199 Cell hParent = cell.hParent();
200 buf.put(hParent.uniqueId().asInt64());
201 buf.put(hParent.whichChildAmI(cell));
205 buf.put(cell.itemBase().flags());
214dump(ItemInternal* icell, ISerializer* buf,
Integer parent_info,
215 bool has_edge,
bool has_amr,
bool with_flags)
217 SerializerDumpAdapter adapter(buf);
218 _dumpCellInfo(icell, adapter, parent_info, has_edge, has_amr, with_flags);
222dump(
Cell cell, Array<Int64>& buf,
Integer parent_info,
223 bool has_edge,
bool has_amr,
bool with_flags)
225 ArrayDumpAdapter adapter(buf);
226 _dumpCellInfo(cell, adapter, parent_info, has_edge, has_amr, with_flags);
233parentInfo(IMesh* mesh)
236 if (mesh->cellFamily()->parentFamily())
238 if (mesh->faceFamily()->parentFamily())
240 if (mesh->edgeFamily()->parentFamily())
242 if (mesh->nodeFamily()->parentFamily())
253 m_nb_node = m_type->nbLocalNode();
255 m_nb_edge = m_type->nbLocalEdge();
258 m_nb_face = m_type->nbLocalFace();
259 m_first_edge = 3 + m_nb_node * 2;
260 m_first_face = m_first_edge + m_nb_edge * 2;
261 m_first_parent_node = m_first_face + m_nb_face * 2;
262 m_first_parent_edge = m_first_parent_node;
263 if (m_parent_info & PI_Node)
264 m_first_parent_edge += m_nb_node;
265 m_first_parent_face = m_first_parent_edge;
266 if (m_parent_info & PI_Edge)
267 m_first_parent_face += m_nb_edge * 2;
268 m_first_parent_cell = m_first_parent_face;
269 if (m_parent_info & PI_Face)
270 m_first_parent_cell += m_nb_face * 2;
271 m_memory_used = m_first_parent_cell;
272 if (m_parent_info & PI_Cell)
Info on a mesh entity type.
Integer nbLocalEdge() const
Number of edges of the entity.
Integer nbLocalNode() const
Number of nodes of the entity.
Integer nbLocalFace() const
Number of faces of the entity.
Mesh entity type manager.
ItemTypeInfo * typeFromId(Integer id) const
Type corresponding to the number id.
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.
Integer m_first_hParent_cell
AMR.
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.
@ Cell
The mesh is AMR by cell.