14#include "arcane/mesh/CellFamilySerializer.h"
16#include "arcane/core/ISerializer.h"
17#include "arcane/core/ItemPrinter.h"
18#include "arcane/core/IMesh.h"
19#include "arcane/core/MeshPartInfo.h"
21#include "arcane/mesh/FullItemInfo.h"
22#include "arcane/mesh/DynamicMeshIncrementalBuilder.h"
23#include "arcane/mesh/OneMeshItemAdder.h"
35CellFamilySerializer(
CellFamily* family,
bool use_flags,
37: TraceAccessor(family->traceMng())
38, m_mesh_builder(mesh_builder)
40, m_use_flags(use_flags)
47void CellFamilySerializer::
55 Int32 my_rank =
mesh->meshPartInfo().partRank();
56 const Integer parent_info = FullCellInfo::parentInfo(
mesh);
57 const bool has_amr =
mesh->isAmrActivated();
58 const bool has_edge = m_mesh_builder->hasEdge();
59 const bool use_flags = m_use_flags;
61 info(4) <<
"_serializeItems : "
62 <<
mesh->name() <<
" "
63 << m_family->name() <<
" "
64 << m_family->parentFamilyDepth();
66 switch (buf->
mode()) {
67 case ISerializer::ModeReserve: {
71 for (
Integer i_cell = 0; i_cell < nb_cell; ++i_cell) {
72 Int32 lid = cells_local_id[i_cell];
75 FullCellInfo::dump(cell, tmp_buf, parent_info, has_edge, has_amr, use_flags);
83 info(4) <<
"Serialize: Put: nb_cell=" << nb_cell;
86 for (
Integer i_cell = 0; i_cell < nb_cell; ++i_cell) {
87 Int32 lid = cells_local_id[i_cell];
90 FullCellInfo::dump(cell, tmp_buf, parent_info, has_edge, has_amr, use_flags);
104void CellFamilySerializer::
109 Int32 my_rank =
mesh->meshPartInfo().partRank();
112 const Integer parent_info = FullCellInfo::parentInfo(
mesh);
117 bool use_array =
false;
118 if (cells_local_id) {
119 cells_local_id->
resize(nb_cell);
120 locals_id_view = (*cells_local_id);
124 const bool has_edge = m_mesh_builder->hasEdge();
125 const bool has_amr =
mesh->isAmrActivated();
126 const bool use_flags = m_use_flags;
127 info(4) <<
"DeserializeCells: nb_cell=" << nb_cell <<
" orig=" << orig_rank <<
" has_edge=" << has_edge
128 <<
" has_amr=" << has_amr <<
" use_flags=" << use_flags;
129 for (
Integer i_cell = 0; i_cell < nb_cell; ++i_cell) {
131 mem_buf.
resize(memory_needed);
133 FullCellInfo current_cell(mem_buf, 0, itm, parent_info, has_edge, has_amr, use_flags);
134 ItemInternal* icell = m_mesh_builder->oneMeshItemAdder()->addOneCell(current_cell);
137 locals_id_view[i_cell] = icell->
localId();
141 icell->
setFlags(current_cell.flags());
145 icell->
setOwner(current_cell.owner(), my_rank);
149 bool has_error =
false;
152 has_error |= (node.uniqueId() != current_cell.nodeUniqueId(node_index));
157 has_error |= (edge.uniqueId() != current_cell.edgeUniqueId(edge_index));
162 has_error |= (face.uniqueId() != current_cell.faceUniqueId(face_index));
169 <<
" remote_uid=" << current_cell.nodeUniqueId(node_index);
175 <<
" remote_uid=" << current_cell.edgeUniqueId(edge_index);
181 <<
" remote_uid=" << current_cell.faceUniqueId(face_index);
184 ARCANE_FATAL(
"Incoherent local and remote node, edge or face unique id");
192 node.mutableItemBase().setOwner(current_cell.nodeOwner(node_index), my_rank);
197 edge.mutableItemBase().setOwner(current_cell.edgeOwner(edge_index), my_rank);
202 face.mutableItemBase().setOwner(current_cell.faceOwner(face_index), my_rank);
207 info(4) <<
"EndDeserializeCells: nb_cell=" << nb_cell <<
" orig=" << orig_rank;
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Int64 largeSize() const
Number of elements in the vector (in 64 bits).
void resize(Int64 s)
Changes the number of elements in the array to s.
void clear()
Removes the elements from the array.
void reserve(Int64 new_capacity)
Reserves memory for new_capacity elements.
FaceConnectedListViewType faces() const
List of faces of the cell.
EdgeConnectedListViewType edges() const
List of edges of the cell.
constexpr Integer size() const noexcept
Number of elements in the array.
Interface of an entity family.
void reserveInt64(Int64 n)
Reserve for n Int64.
@ ModePut
The serializer expects reserve().
@ ModeGet
The serializer expects get().
virtual Int64 getInt64()=0
Retrieve a size.
virtual void putSpan(Span< const Real > values)
Add the array values.
virtual eMode mode() const =0
Current operating mode.
virtual void getSpan(Span< Real > values)
Retrieve the array values.
virtual void reserveSpan(eBasicDataType dt, Int64 n)=0
Reserves memory for n values of dt.
virtual void putInt64(Int64 value)=0
Add the integer value.
Int32 localId() const
Local number (in the subdomain) of the entity.
Internal structure of a mesh entity.
Utility class for printing information about an entity.
Mesh entity type manager.
NodeConnectedListViewType nodes() const
List of nodes of the entity.
void setOwner(Integer suid, Int32 current_sub_domain)
Sets the sub-domain number of the entity owner.
void setFlags(Int32 f)
Sets the entity flags.
TraceMessage info() const
Flow for an information message.
1D data vector with value semantics (STL style).
void deserializeItems(ISerializer *buf, Int32Array *cells_local_id) override
Deserializes the entities of the family family() from buf.
Construction of a mesh incrementally.
Info to create/serialize a cell knowing the uniqueId() and owner() of all these sub-entities (cells,...
bool arcaneIsCheck()
True if running in check mode.
UniqueArray< Int64 > Int64UniqueArray
Dynamic 1D array of 64-bit integers.
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
ConstArrayView< ItemInternal * > ItemInternalList
Type of the internal list of entities.
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
Array< Int32 > Int32Array
Dynamic one-dimensional array of 32-bit integers.
std::int32_t Int32
Signed integer type of 32 bits.