14#include "arcane/utils/Iterator.h"
15#include "arcane/utils/ArgumentException.h"
16#include "arcane/utils/NotImplementedException.h"
17#include "arcane/utils/NotSupportedException.h"
18#include "arcane/utils/ITraceMng.h"
19#include "arcane/utils/ValueConvert.h"
21#include "arcane/core/ItemTypeMng.h"
23#include "arcane/core/IParallelMng.h"
24#include "arcane/core/SerializeBuffer.h"
25#include "arcane/core/ItemPrinter.h"
26#include "arcane/core/Connectivity.h"
27#include "arcane/core/MeshToMeshTransposer.h"
28#include "arcane/core/IItemFamilyModifier.h"
30#include "arcane/mesh/DynamicMesh.h"
31#include "arcane/mesh/DynamicMeshIncrementalBuilder.h"
32#include "arcane/mesh/OneMeshItemAdder.h"
33#include "arcane/mesh/GhostLayerBuilder.h"
34#include "arcane/mesh/FaceUniqueIdBuilder.h"
35#include "arcane/mesh/EdgeUniqueIdBuilder.h"
36#include "arcane/mesh/CellFamily.h"
37#include "arcane/mesh/GraphDoFs.h"
38#include "arcane/mesh/ParticleFamily.h"
63, m_item_type_mng(mesh->itemTypeMng())
74DynamicMeshIncrementalBuilder::
75~DynamicMeshIncrementalBuilder()
78 delete m_face_unique_id_builder;
79 delete m_edge_unique_id_builder;
86void DynamicMeshIncrementalBuilder::
93 for (
Face face : cell.faces()) {
95 if (face.backCell() == cell) {
97 add_msg =
"is a back face";
101 add_msg =
"is a front face";
103 info() << str <<
": celluid=" << cell.uniqueId()
104 <<
" faceuid=" << face.uniqueId()
105 <<
" faceindex=" << index
109 info() << str <<
": celluid=" << cell.uniqueId()
110 <<
" nbback=" << nb_num_back_face
111 <<
" nbfront=" << nb_num_front_face;
127 bool allow_build_face)
132 bool add_to_cells = cells.
size() != 0;
133 if (add_to_cells && nb_cell != cells.
size())
135 for (
Integer i_cell = 0; i_cell < nb_cell; ++i_cell) {
138 Int64 cell_unique_id = cells_infos[cells_infos_index];
143 Int64ConstArrayView current_cell_nodes_uid(current_cell_nb_node, &cells_infos[cells_infos_index]);
149 cells[i_cell] = cell->
localId();
150 cells_infos_index += current_cell_nb_node;
170 bool allow_build_face)
172 bool add_to_cells = cells.
size() != 0;
173 if (add_to_cells && nb_cell != cells.
size())
175 "return array 'cells' has to have same size as number of cells");
179 nb_cell, 0, cells, &mesh()->trueCellFamily(), &mesh()->trueCellFamily(), sub_domain_id);
183 Integer nb_face = 0, nb_edge = 0, nb_node = 0;
184 std::map<Int64, Int64SharedArray> cell_to_face_connectivity_info;
185 std::map<std::pair<Int64, Int64>,
Int64> edge_uid_map;
188 _fillFaceInfo(nb_face, nb_cell, faces_infos, cells_infos, cell_to_face_connectivity_info);
189 _fillEdgeInfo(nb_edge, nb_face, edges_infos, faces_infos, edge_uid_map);
190 _fillNodeInfo(nb_node, nb_face, nodes_infos, faces_infos);
193 _fillCellNewInfoNew(nb_cell, cells_infos, cell_data.itemInfos(), cell_to_face_connectivity_info, edge_uid_map);
195 if (allow_build_face) {
196 ItemData& face_data = item_data_list.itemData(
Integer(
m_mesh->faceFamily()->itemKind()), nb_face, 0, face_lids, &mesh()->trueFaceFamily(), &mesh()->trueFaceFamily(), sub_domain_id);
197 face_lids.
resize(item_data_list[
m_mesh->faceFamily()->itemKind()].nbItems());
198 _fillFaceNewInfoNew(nb_face, faces_infos, face_data.itemInfos(), edge_uid_map);
199 ItemData& face_relation_data = item_relation_data_list.itemData(
Integer(
m_mesh->faceFamily()->itemKind()), nb_face, 0, face_lids, &mesh()->trueFaceFamily(), &mesh()->trueFaceFamily(), sub_domain_id);
204 Integer edge_info_size = 1 + nb_edge * 6;
205 ItemData& edge_data = item_data_list.itemData(
Integer(
m_mesh->edgeFamily()->itemKind()), nb_edge, edge_info_size, edge_lids, &mesh()->trueEdgeFamily(), &mesh()->trueEdgeFamily(), sub_domain_id);
206 edge_lids.
resize(item_data_list[
m_mesh->edgeFamily()->itemKind()].nbItems());
207 _fillEdgeNewInfoNew(nb_edge, edges_infos, edge_data.itemInfos());
208 ItemData& edge_relation_data = item_relation_data_list.itemData(
Integer(
m_mesh->edgeFamily()->itemKind()), nb_edge, edge_info_size, edge_lids, &mesh()->trueEdgeFamily(), &mesh()->trueEdgeFamily(), sub_domain_id);
209 _initEdgeRelationInfo(edge_relation_data, cell_data, edges_infos);
210 if (allow_build_face) {
211 _appendEdgeRelationInfo(edge_relation_data, item_data_list[
IK_Face], edges_infos);
212 _appendFaceRelationInfo(item_relation_data_list[
IK_Face], edge_data, faces_infos);
216 Integer node_info_size = 1 + nb_node * 2;
217 ItemData& node_data = item_data_list.itemData(
Integer(
m_mesh->nodeFamily()->itemKind()), nb_node, node_info_size, node_lids, &mesh()->trueNodeFamily(), &mesh()->trueNodeFamily(), sub_domain_id);
218 node_lids.
resize(item_data_list[
m_mesh->nodeFamily()->itemKind()].nbItems());
219 _fillNodeNewInfo(nodes_infos, node_data.itemInfos());
220 ItemData& node_relation_data = item_relation_data_list.itemData(
Integer(
m_mesh->nodeFamily()->itemKind()), nb_node, node_info_size, node_lids, &mesh()->trueNodeFamily(), &mesh()->trueNodeFamily(), sub_domain_id);
221 _initNodeRelationInfo(node_relation_data, cell_data, nodes_infos);
222 if (allow_build_face)
223 _appendNodeRelationInfo(node_relation_data, item_data_list[
IK_Face], nodes_infos);
225 _appendNodeRelationInfo(node_relation_data, item_data_list[
IK_Edge], nodes_infos);
228 addItems(item_data_list, item_relation_data_list);
233void DynamicMeshIncrementalBuilder::
236 bool allow_build_face)
240 nb_cell, 0, cells, &
mesh()->trueCellFamily(), &
mesh()->trueCellFamily(), sub_domain_id);
242 Int64Array& cell_infos2 = cell_data.itemInfos();
249 _fillCellInfo2(nb_cell, cells_infos, cell_infos2, nb_face, faces_infos, node_uids, allow_build_face);
252 if (allow_build_face) {
253 Integer face_infos2_size = faces_infos.
size() + 1 + 2 * nb_face;
254 face_lids.
resize(nb_face);
256 nb_face, face_infos2_size, face_lids, &
mesh()->trueFaceFamily(), &
mesh()->trueFaceFamily(), sub_domain_id);
258 _fillFaceInfo2(nb_face, faces_infos, face_infos2, node_uids);
265 nb_node_to_add, 2 * nb_node_to_add + 1, node_lids, &
mesh()->trueNodeFamily(), &
mesh()->trueNodeFamily(), sub_domain_id);
266 Int64Array& node_infos2 = node_data.itemInfos();
267 _fillNodeNewInfo(node_uids, node_infos2);
292 NodeInFaceSet face_nodes_set;
293 for (
Integer i_cell = 0; i_cell < nb_cell; ++i_cell) {
295 Int64 current_cell_unique_id = cells_infos[cells_infos_index++];
298 Int64ConstArrayView current_cell_node_uids(current_cell_nb_node, &cells_infos[cells_infos_index]);
300 for (
Integer face_in_cell_index = 0; face_in_cell_index < current_cell_nb_face; ++face_in_cell_index) {
303 work_face_orig_nodes.
resize(current_face_nb_node);
304 work_face_sorted_nodes.
resize(current_face_nb_node);
306 for (
Integer node_in_face_index = 0; node_in_face_index < current_face_nb_node; ++node_in_face_index) {
307 work_face_orig_nodes[i++] = current_cell_node_uids[current_face.
node(node_in_face_index)];
311 Int64 current_face_uid = _findFaceUniqueId(work_face_sorted_nodes, face_nodes_set);
312 if (current_face_uid == NULL_ITEM_ID)
316 faces_infos.
add(current_face_uid);
317 faces_infos.
addRange(work_face_sorted_nodes);
318 _addFaceNodes(face_nodes_set, work_face_sorted_nodes, current_face_uid);
321 cell_to_face_connectivity_info[current_cell_unique_id].add(current_face_uid);
323 cells_infos_index += current_cell_nb_node;
329void DynamicMeshIncrementalBuilder::
337 for (
Integer i_face = 0; i_face < nb_face; ++i_face) {
342 Int64ConstArrayView current_face_node_uids(current_face_nb_node, &faces_infos[faces_infos_index]);
344 for (
Integer edge_in_face_index = 0; edge_in_face_index < current_face_nb_edge; ++edge_in_face_index) {
346 Int64 first_node = current_face_node_uids[current_edge.
beginNode()];
347 Int64 second_node = current_face_node_uids[current_edge.
endNode()];
348 if (first_node > second_node)
349 std::swap(first_node, second_node);
350 auto edge_it = edge_uid_map.insert(std::make_pair(std::make_pair(first_node, second_node),
m_edge_uid_pool));
351 if (edge_it.second) {
353 edges_infos.
add(first_node);
354 edges_infos.
add(second_node);
359 faces_infos_index += current_face_nb_node;
365void DynamicMeshIncrementalBuilder::
368 nodes_infos.reserve(faces_infos.size());
370 std::set<Int64> nodes_set;
371 ItemTypeMng* itm = m_item_type_mng;
372 for (
Integer i_face = 0; i_face < nb_face; ++i_face) {
373 Int32 type_id = CheckedConvert::toInt32(faces_infos[faces_infos_index++]);
374 Integer current_face_nb_node = itm->typeFromId(type_id)->nbLocalNode();
376 for (
auto node_uid : faces_infos.subConstView(faces_infos_index, current_face_nb_node)) {
377 nodes_set.insert(node_uid);
379 faces_infos_index += current_face_nb_node;
381 nb_node = CheckedConvert::toInteger(nodes_set.size());
382 for (
auto node_uid : nodes_set) {
383 nodes_infos.add(node_uid);
389void DynamicMeshIncrementalBuilder::
392 nodes_infos.reserve(2 * edges_infos.size());
394 std::set<Int64> nodes_set;
395 for (
Integer i_edge = 0; i_edge < nb_edge; ++i_edge) {
397 nodes_set.insert(edges_infos[edges_infos_index++]);
398 nodes_set.insert(edges_infos[edges_infos_index++]);
400 nb_node = CheckedConvert::toInteger(nodes_set.size());
401 for (
auto node_uid : nodes_set) {
402 nodes_infos.add(node_uid);
407void DynamicMeshIncrementalBuilder::
409 const std::map<Int64, Int64SharedArray>& cell_to_face_connectivity_info,
const std::map<std::pair<Int64, Int64>,
Int64>& edge_uid_map)
411 Integer cell_infos2_size_approx = 1 + 3 * (cells_infos.size() + 2 * nb_cell);
412 cell_infos2.reserve(cell_infos2_size_approx);
413 ItemTypeMng* itm = m_item_type_mng;
415 Integer nb_connected_families = hasEdge() ? 3 : 2;
416 cell_infos2.add(nb_connected_families);
417 for (
Integer i_cell = 0; i_cell < nb_cell; ++i_cell) {
419 cell_infos2.add(cells_infos[cells_infos_index++]);
420 Int64 current_cell_uid = cells_infos[cells_infos_index];
421 cell_infos2.add(cells_infos[cells_infos_index++]);
422 ItemTypeInfo* it = itm->typeFromId(item_type_id);
424 cell_infos2.add(mesh()->nodeFamily()->itemKind());
426 cell_infos2.add(current_cell_nb_node);
427 Int64ConstArrayView current_cell_node_uids(current_cell_nb_node, &cells_infos[cells_infos_index]);
428 cell_infos2.addRange(current_cell_node_uids);
430 cell_infos2.add(mesh()->faceFamily()->itemKind());
431 Integer current_cell_nb_face = it->nbLocalFace();
432 cell_infos2.add(current_cell_nb_face);
433 Int64ArrayView current_cell_faces = cell_to_face_connectivity_info.find(current_cell_uid)->second.view();
434 if (current_cell_nb_face != current_cell_faces.size())
435 ARCANE_FATAL(
"Incoherent number of faces for cell {0}. Expected {1} found {2}",
436 current_cell_uid, current_cell_nb_face, current_cell_faces.size());
437 cell_infos2.addRange(current_cell_faces);
440 cell_infos2.add(mesh()->edgeFamily()->itemKind());
441 Integer current_cell_nb_edge = it->nbLocalEdge();
442 cell_infos2.add(current_cell_nb_edge);
443 for (
int edge_index = 0; edge_index < current_cell_nb_edge; ++edge_index) {
444 Int64 first_node = current_cell_node_uids[it->localEdge(edge_index).beginNode()];
445 Int64 second_node = current_cell_node_uids[it->localEdge(edge_index).endNode()];
446 if (first_node > second_node)
447 std::swap(first_node, second_node);
448 auto edge_it = edge_uid_map.find(std::make_pair(first_node, second_node));
449 if (edge_it == edge_uid_map.end())
450 ARCANE_FATAL(
"Do not find edge with nodes {0}-{1} in edge uid map. Exiting",
451 current_cell_node_uids[it->localEdge(edge_index).beginNode()],
452 current_cell_node_uids[it->localEdge(edge_index).endNode()]);
453 cell_infos2.add(edge_it->second);
456 cells_infos_index += current_cell_nb_node;
463void DynamicMeshIncrementalBuilder::
467 Integer cell_infos2_size_approx = 1 + 2 * (cells_infos.size() + 2 * nb_cell);
468 cell_infos2.reserve(cell_infos2_size_approx);
470 ItemTypeMng* itm = m_item_type_mng;
475 faces_infos.reserve(2 * cells_infos.size());
478 NodeInFaceSet face_nodes_set;
479 std::set<Int64> node_uid_set;
481 for (
Integer i_cell = 0; i_cell < nb_cell; ++i_cell) {
484 cell_infos2.add(cells_infos[cells_infos_index++]);
485 cell_infos2.add(cells_infos[cells_infos_index++]);
486 cell_infos2.add(mesh()->nodeFamily()->itemKind());
488 ItemTypeInfo* it = itm->typeFromId(item_type_id);
490 Integer current_cell_nb_node = it->nbLocalNode();
491 cell_infos2.add(current_cell_nb_node);
492 Int64ConstArrayView current_cell_node_uids(current_cell_nb_node, &cells_infos[cells_infos_index]);
493 cell_infos2.addRange(current_cell_node_uids);
494 if (!allow_build_face)
495 node_uid_set.insert(current_cell_node_uids.begin(), current_cell_node_uids.end());
497 cell_infos2.add(mesh()->faceFamily()->itemKind());
498 Integer current_cell_nb_face = it->nbLocalFace();
499 cell_infos2.add(current_cell_nb_face);
500 for (
Integer face_in_cell_index = 0; face_in_cell_index < current_cell_nb_face; ++face_in_cell_index) {
501 ItemTypeInfo::LocalFace current_face = it->localFace(face_in_cell_index);
502 Integer current_face_nb_node = current_face.nbNode();
503 work_face_orig_nodes.resize(current_face_nb_node);
504 work_face_sorted_nodes.resize(current_face_nb_node);
506 for (
Integer node_in_face_index = 0; node_in_face_index < current_face_nb_node; ++node_in_face_index) {
507 work_face_orig_nodes[i++] = current_cell_node_uids[current_face.node(node_in_face_index)];
509 mesh_utils::reorderNodesOfFace(work_face_orig_nodes, work_face_sorted_nodes);
511 Int64 current_face_uid = _findFaceUniqueId(work_face_sorted_nodes, face_nodes_set);
512 if (current_face_uid == NULL_ITEM_ID)
515 faces_infos.add(current_face.typeId());
516 faces_infos.add(current_face_uid);
517 faces_infos.addRange(work_face_sorted_nodes);
518 _addFaceNodes(face_nodes_set, work_face_sorted_nodes, current_face_uid);
521 cell_infos2.add(current_face_uid);
523 cells_infos_index += current_cell_nb_node;
525 if (!allow_build_face) {
526 node_uids.resize(node_uid_set.size());
528 for (
Int64 node_uid : node_uid_set)
529 node_uids[index++] = node_uid;
546 _fillFaceRelationInfo(source_item_relation_data, target_item_dependencies_data, faces_info,
true);
551void DynamicMeshIncrementalBuilder::
554 _fillFaceRelationInfo(source_item_relation_data, target_item_dependencies_data, faces_info,
false);
559void DynamicMeshIncrementalBuilder::
560_fillFaceRelationInfo(ItemData& source_item_relation_data,
const ItemData& target_item_dependencies_data,
565 face_uids_and_types.
reserve(2 * source_item_relation_data.nbItems());
567 for (
Integer face_info_index = 0; face_info_index < faces_info.
size();) {
568 face_uids_and_types.
add(faces_info[face_info_index + 1]);
569 face_uids_and_types.
add(faces_info[face_info_index]);
570 Integer type_id = CheckedConvert::toInteger(face_uids_and_types.
back());
571 face_info_index += (2 + itm->
typeFromId(type_id)->nbLocalNode());
573 _fillItemRelationInfo(source_item_relation_data, target_item_dependencies_data, face_uids_and_types, is_source_relation_data_empty);
578void DynamicMeshIncrementalBuilder::
581 _fillEdgeRelationInfo(source_item_relation_data, target_item_dependencies_data, edges_info,
true);
586void DynamicMeshIncrementalBuilder::
589 _fillEdgeRelationInfo(source_item_relation_data, target_item_dependencies_data, edges_info,
false);
594void DynamicMeshIncrementalBuilder::
595_fillEdgeRelationInfo(
ItemData& source_item_relation_data,
const ItemData& target_item_dependencies_data,
599 ARCANE_ASSERT((source_item_relation_data.nbItems() * 3 == edges_info.size()), (
"source_item_relation_data and edges_info size incoherent. Exiting."));
601 edge_uids_and_types.
reserve(2 * source_item_relation_data.nbItems());
602 for (
Integer edge_info_index = 0; edge_info_index < edges_info.size();) {
603 edge_uids_and_types.add(edges_info[edge_info_index++]);
604 edge_uids_and_types.add(IT_Line2);
605 edge_info_index += 2;
607 _fillItemRelationInfo(source_item_relation_data, target_item_dependencies_data, edge_uids_and_types, is_source_relation_data_empty);
612void DynamicMeshIncrementalBuilder::
615 _fillNodeRelationInfo(source_item_relation_data, target_item_dependencies_data, nodes_info,
true);
620void DynamicMeshIncrementalBuilder::
623 _fillNodeRelationInfo(source_item_relation_data, target_item_dependencies_data, nodes_info,
false);
628void DynamicMeshIncrementalBuilder::
629_fillNodeRelationInfo(
ItemData& source_item_relation_data,
const ItemData& target_item_dependencies_data,
Int64ConstArrayView nodes_info,
bool is_source_relation_data_empty)
632 ARCANE_ASSERT((source_item_relation_data.nbItems() == nodes_info.size()), (
"source_item_relation_data and nodes_info size incoherent. Exiting."));
634 for (
Integer node_index = 0; node_index < nodes_info.size(); ++node_index) {
635 node_uids_and_types[2 * node_index] = nodes_info[node_index];
636 node_uids_and_types[2 * node_index + 1] = IT_Vertex;
638 _fillItemRelationInfo(source_item_relation_data, target_item_dependencies_data, node_uids_and_types, is_source_relation_data_empty);
643void DynamicMeshIncrementalBuilder::
644_fillItemRelationInfo(
ItemData& source_item_relation_data,
const ItemData& target_item_dependencies_data,
646 bool is_source_item_relation_data_empty)
648 ARCANE_ASSERT((source_item_relation_data.nbItems() * 2 == source_item_uids_and_types.size()),
649 (
"source item number incoherent between source_item_relation_data and source_item_uids_and_types. Exiting."));
651 auto& source_relation_info = source_item_relation_data.itemInfos();
652 const auto& target_dependencies_info = target_item_dependencies_data.itemInfos();
653 auto source_family = source_item_relation_data.itemFamily();
654 auto target_family = target_item_dependencies_data.itemFamily();
655 if (!source_family || !target_family)
657 std::map<Int64, Int64SharedArray> source_to_target_uids;
658 Integer nb_families_connected_to_target = CheckedConvert::toInteger(target_dependencies_info[0]);
662 for (; target_info_index < target_dependencies_info.size();) {
664 Int64 target_item_uid = target_dependencies_info[target_info_index++];
665 for (
Integer family_connected_to_target = 0; family_connected_to_target < nb_families_connected_to_target; ++family_connected_to_target) {
666 Int64 family_connected_to_target_kind = target_dependencies_info[target_info_index++];
667 if (family_connected_to_target_kind != source_family->itemKind()) {
668 Integer nb_non_read_values = CheckedConvert::toInteger(target_dependencies_info[target_info_index++]);
669 target_info_index += nb_non_read_values;
673 Int32 nb_source_item_connected_to_target_item = CheckedConvert::toInt32(target_dependencies_info[target_info_index++]);
674 for (
Integer source_item_index = 0; source_item_index < nb_source_item_connected_to_target_item; ++source_item_index) {
675 source_to_target_uids[target_dependencies_info[source_item_index + target_info_index]].add(target_item_uid);
677 target_info_index += nb_source_item_connected_to_target_item;
682 if (is_source_item_relation_data_empty)
683 _initEmptyRelationInfo(source_relation_info, source_to_target_uids, source_item_uids_and_types,
684 target_dependencies_info.size(), target_family);
686 _appendInitializedRelationInfo(source_relation_info, source_to_target_uids, source_item_uids_and_types,
687 target_dependencies_info.size(), target_family);
692void DynamicMeshIncrementalBuilder::
693_initEmptyRelationInfo(
Int64Array& source_relation_info, std::map<Int64, Int64SharedArray>& source_to_target_uids,
Int64ConstArrayView source_item_uids_and_types,
695 IItemFamily
const* target_family)
697 if (!source_relation_info.empty())
698 source_relation_info.clear();
699 source_relation_info.reserve(approx_relation_size);
700 source_relation_info.add(1);
702 for (
Integer source_item_uids_and_types_index = 0; source_item_uids_and_types_index < source_item_uids_and_types.size(); source_item_uids_and_types_index += 2) {
703 Int64 source_item_uid = source_item_uids_and_types[source_item_uids_and_types_index];
704 source_relation_info.add(source_item_uids_and_types[source_item_uids_and_types_index + 1]);
705 source_relation_info.add(source_item_uid);
706 source_relation_info.add(target_family->itemKind());
707 auto& connected_items = source_to_target_uids[source_item_uid];
708 source_relation_info.add(connected_items.size());
709 source_relation_info.addRange(connected_items.view());
715void DynamicMeshIncrementalBuilder::
716_appendInitializedRelationInfo(
Int64Array& source_relation_info, std::map<Int64, Int64SharedArray>& source_to_target_uids,
Int64ConstArrayView source_item_uids_and_types,
718 IItemFamily
const* target_family)
722 source_relation_info_wrk_copy.
reserve(source_relation_info.size() + approx_relation_size);
723 std::set<Int64> treated_items;
724 Integer source_relation_info_index = 0;
725 Integer nb_connected_family = CheckedConvert::toInteger(source_relation_info[source_relation_info_index++]);
726 source_relation_info_wrk_copy.add(nb_connected_family + 1);
727 for (; source_relation_info_index < source_relation_info.size();) {
728 source_relation_info_wrk_copy.add(source_relation_info[source_relation_info_index++]);
729 Int64 source_item_uid = source_relation_info[source_relation_info_index++];
730 source_relation_info_wrk_copy.add(source_item_uid);
731 treated_items.insert(source_item_uid);
732 for (
Integer connected_family_index = 0; connected_family_index < nb_connected_family; ++connected_family_index) {
733 source_relation_info_wrk_copy.add(source_relation_info[source_relation_info_index++]);
734 Integer nb_connected_elements = CheckedConvert::toInteger(source_relation_info[source_relation_info_index++]);
735 source_relation_info_wrk_copy.add(nb_connected_elements);
736 source_relation_info_wrk_copy.addRange(source_relation_info.subConstView(source_relation_info_index, nb_connected_elements));
737 source_relation_info_index += nb_connected_elements;
740 source_relation_info_wrk_copy.add(target_family->itemKind());
741 const auto& connected_items = source_to_target_uids[source_item_uid];
742 source_relation_info_wrk_copy.add(connected_items.size());
743 source_relation_info_wrk_copy.addRange(connected_items);
746 for (
Integer source_item_uids_and_types_index = 0; source_item_uids_and_types_index < source_item_uids_and_types.size(); source_item_uids_and_types_index += 2) {
747 Int64 source_item_uid = source_item_uids_and_types[source_item_uids_and_types_index];
748 if (treated_items.find(source_item_uid) == treated_items.end()) {
749 source_relation_info_wrk_copy.add(source_item_uids_and_types[source_item_uids_and_types_index + 1]);
750 source_relation_info_wrk_copy.add(source_item_uid);
751 source_relation_info_wrk_copy.add(target_family->itemKind());
752 const auto& connected_items = source_to_target_uids[source_item_uid];
753 source_relation_info_wrk_copy.add(connected_items.size());
754 source_relation_info_wrk_copy.addRange(connected_items);
756 for (
Integer connected_family_index = 0; connected_family_index < nb_connected_family; ++connected_family_index) {
757 source_relation_info_wrk_copy.add(0);
758 source_relation_info_wrk_copy.add(0);
763 source_relation_info.resize(source_relation_info_wrk_copy.size());
764 std::copy(source_relation_info_wrk_copy.begin(), source_relation_info_wrk_copy.end(), source_relation_info.begin());
770Int64 DynamicMeshIncrementalBuilder::
771_findFaceUniqueId(
Int64ConstArrayView work_face_sorted_nodes, NodeInFaceSet& face_nodes_set)
776 return _findFaceInFaceNodesSet(face_nodes_set, index, work_face_sorted_nodes,
NodeInFacePtr(NULL_ITEM_ID));
781Int64 DynamicMeshIncrementalBuilder::
782_findFaceInFaceNodesSet(
const NodeInFaceSet& face_nodes_set,
Integer index,
Int64ConstArrayView face_nodes, NodeInFacePtr node)
784 if (index < face_nodes.size()) {
785 auto found_node = std::find(face_nodes_set.begin(), face_nodes_set.end(),
NodeInFacePtr(face_nodes[index]));
786 if (found_node == face_nodes_set.end())
787 return node->faceUid();
789 return _findFaceInFaceNodesSet((*found_node)->nextNodeSet(), ++index, face_nodes, *found_node);
792 return node->faceUid();
797void DynamicMeshIncrementalBuilder::
802 _addFaceInFaceNodesSet(face_nodes_set, index, face_nodes,
NodeInFacePtr(NULL_ITEM_ID), face_uid);
807void DynamicMeshIncrementalBuilder::
810 if (index < face_nodes.size()) {
812 auto next_node = _insertNode(face_nodes_set, face_nodes[index]);
815 _addFaceInFaceNodesSet(next_node->nextNodeSet(), ++index, face_nodes, next_node, face_uid);
820 node->setFaceUid(face_uid);
826DynamicMeshIncrementalBuilder::_insertNode(NodeInFaceSet& face_nodes_set,
Int64 inserted_node_uid)
829 auto found_node = std::find(face_nodes_set.begin(), face_nodes_set.end(), new_node);
830 if (found_node == face_nodes_set.end()) {
831 face_nodes_set.push_back(std::move(new_node));
832 return face_nodes_set.back();
851 for (
Integer i_cell = 0; i_cell < nb_cell; ++i_cell) {
870 bool allow_build_face)
875 debug() <<
"[DynamicMeshIncrementalBuilder::addHChildrenCells] ADD CELLS mesh=" <<
m_mesh->name() <<
" nb_cell=" << nb_cell;
877 bool add_to_cells = cells.
size() != 0;
878 if (add_to_cells && nb_cell != cells.
size())
880 "return array 'cells' has to have same size as number of cells");
881 for (
Integer i_cell = 0; i_cell < nb_cell; ++i_cell) {
882 debug(
Trace::Highest) <<
"\t\t[DynamicMeshIncrementalBuilder::addHChildrenCells]cell " << i_cell <<
"/" << nb_cell;
885 debug(
Trace::Highest) <<
"\t\t[DynamicMeshIncrementalBuilder::addHChildrenCells]cells_infos[" << cells_infos_index <<
"]=" << cells_infos[cells_infos_index] <<
", type_id=" << item_type_id;
888 Int64 cell_unique_id = cells_infos[cells_infos_index];
889 debug(
Trace::Highest) <<
"\t\t[DynamicMeshIncrementalBuilder::addHChildrenCells]cells_infos[" << cells_infos_index <<
"]=" << cells_infos[cells_infos_index] <<
", uid=" << cell_unique_id;
894 debug(
Trace::Highest) <<
"\t\t[DynamicMeshIncrementalBuilder::addHChildrenCells]DM ADD_CELL uid=" << cell_unique_id <<
" type_id=" << item_type_id
895 <<
" nb_node=" << current_cell_nb_node;
896 Int64ConstArrayView current_cell_nodes_uid(current_cell_nb_node, &cells_infos[cells_infos_index]);
897 for (
Integer i = 0; i < current_cell_nb_node; ++i)
898 debug(
Trace::Highest) <<
"\t\t\t[DynamicMeshIncrementalBuilder::addHChildrenCells]DM NODE uid=" << current_cell_nodes_uid[i];
903 current_cell_nodes_uid,
908 cells[i_cell] = cell->
localId();
909 cells_infos_index += current_cell_nb_node;
911 cell_family._addChildrenCellsToCell(hParent_cell, cells);
913 debug() <<
"[DynamicMeshIncrementalBuilder::addHChildrenCells] done";
929 for (
Integer i_item = 0; i_item < nb_item; ++i_item) {
947 bool add_to_nodes = nodes.
size() != 0;
948 if (add_to_nodes && nb_node_to_add != nodes.
size())
950 "return array 'nodes' has to have same size as number of nodes");
951 for (
Integer i_node = 0; i_node < nb_node_to_add; ++i_node) {
954 nodes[i_node] = node->
localId();
971 bool add_to_nodes = nodes.
size() != 0;
972 if (add_to_nodes && nb_node_to_add != nodes.
size())
974 "return array 'nodes' has to have same size as number of nodes");
977 nb_node_to_add, 2 * nb_node_to_add + 1, nodes, &mesh()->trueNodeFamily(), &mesh()->trueNodeFamily(), owner);
978 Int64Array& node_infos2 = node_data.itemInfos();
980 _fillNodeNewInfo(nodes_uid, node_infos2);
988void DynamicMeshIncrementalBuilder::
993 for (
auto node_uid : node_uids) {
994 node_infos2[2 * index + 1] = IT_Vertex;
995 node_infos2[2 * index + 2] = node_uid;
1025 _addItemsOrRelations(item_info_list, IItemFamilyNetwork::InverseTopologicalOrder);
1033 if (item_info_list.size() == 0 || item_relation_info_list.size() == 0)
1036 addRelations(item_relation_info_list);
1041void DynamicMeshIncrementalBuilder::
1042addRelations(ItemDataList& item_relation_list)
1045 _addItemsOrRelations(item_relation_list, IItemFamilyNetwork::TopologicalOrder);
1050void DynamicMeshIncrementalBuilder::
1051_addItemsOrRelations(ItemDataList& info_list, IItemFamilyNetwork::eSchedulingOrder family_graph_traversal_order)
1054 if (info_list.size() == 0)
1057 ItemData i_infos = info_list[family->itemKind()];
1060 family_graph_traversal_order);
1073 if (item_data.nbItems() == 0)
1075 bool add_to_items = item_data.itemLids().
size() != 0;
1076 if (add_to_items && item_data.nbItems() != item_data.itemLids().
size())
1078 "return array containing item lids has to have be of size number of items");
1082 Integer nb_connected_family = CheckedConvert::toInteger(item_infos[0]);
1083 if (nb_connected_family == 0)
1088 for (
Integer info_index = 1; info_index < item_data.itemInfos().size();) {
1090 item_uid = item_infos[info_index++];
1091 Integer item_info_begin_index = info_index;
1092 for (
Integer connected_family_index = 0; connected_family_index < nb_connected_family; ++connected_family_index) {
1093 Integer current_index = CheckedConvert::toInteger(item_infos[info_index + 1]);
1094 Integer nb_item_info_increment = 2 + current_index;
1095 nb_item_info += nb_item_info_increment;
1096 info_index += nb_item_info_increment;
1099 item_data.itemFamilyModifier(),
1102 item_data.itemOwners()[item_index],
1103 item_data.subDomainId(),
1104 nb_connected_family,
1105 item_infos.
subView(item_info_begin_index, nb_item_info));
1107 item_data.itemLids()[item_index++] = item->
localId();
1128 bool add_to_faces = faces.
size() != 0;
1129 if (add_to_faces && nb_face != faces.
size())
1131 "return array 'faces' has to have same size as number of faces");
1133 Integer faces_infos_index = 0;
1134 for (
Integer i_face = 0; i_face < nb_face; ++i_face) {
1137 ++faces_infos_index;
1138 Int64 face_unique_id = faces_infos[faces_infos_index];
1139 ++faces_infos_index;
1145 faces_infos_index += current_face_nb_node;
1150 faces[i_face] = face->
localId();
1168 bool add_to_faces = faces.
size() != 0;
1169 if (add_to_faces && nb_face != faces.
size())
1171 "return array 'faces' has to have same size as number of faces");
1173 Integer face_infos2_size = faces_infos.
size() + 1 + 2 * nb_face;
1176 nb_face, face_infos2_size, faces, &mesh()->trueFaceFamily(), &mesh()->trueFaceFamily(), sub_domain_id);
1182 _fillFaceInfo2(nb_face, faces_infos, face_infos2, node_uids);
1198 nb_node_to_add, 2 * nb_node_to_add + 1, node_lids, &mesh()->trueNodeFamily(), &mesh()->trueNodeFamily(), sub_domain_id);
1199 Int64Array& node_infos2 = node_data.itemInfos();
1200 _fillNodeNewInfo(node_uids, node_infos2);
1208void DynamicMeshIncrementalBuilder::
1212 bool add_to_faces = faces.
size() != 0;
1213 if (add_to_faces && nb_face != faces.
size())
1215 "return array 'faces' has to have same size as number of faces");
1226 std::map<std::pair<Int64, Int64>,
Int64> edge_uid_map;
1229 _fillEdgeInfo(nb_edge, nb_face, edges_infos, faces_infos, edge_uid_map);
1230 _fillNodeInfo(nb_node, nb_face, nodes_infos, faces_infos);
1234 _fillFaceNewInfoNew(nb_face, faces_infos, face_data.itemInfos(), edge_uid_map);
1238 Integer edge_info_size = 1 + nb_edge * 6;
1241 _fillEdgeNewInfoNew(nb_edge, edges_infos, edge_data.itemInfos());
1243 _initEdgeRelationInfo(edge_relation_data, face_data, edges_infos);
1247 Integer node_info_size = 1 + nb_node * 2;
1248 ItemData& node_data = item_data_list.itemData(
Integer(
m_mesh->
nodeFamily()->
itemKind()), nb_node, node_info_size, node_lids, &
mesh()->trueNodeFamily(), &
mesh()->trueNodeFamily(), sub_domain_id);
1250 _fillNodeNewInfo(nodes_infos, node_data.itemInfos());
1251 ItemData& node_relation_data = item_relation_data_list.itemData(
Integer(
m_mesh->
nodeFamily()->
itemKind()), nb_node, node_info_size, node_lids, &
mesh()->trueNodeFamily(), &
mesh()->trueNodeFamily(), sub_domain_id);
1252 _initNodeRelationInfo(node_relation_data, face_data, nodes_infos);
1255 addItems(item_data_list, item_relation_data_list);
1261void DynamicMeshIncrementalBuilder::
1264 ItemTypeMng* itm = m_item_type_mng;
1265 Integer nb_connected_family = hasEdge() ? 2 : 1;
1266 Integer face_infos2_size_approx = 1 + 2 * (faces_infos.size() + 2 * nb_face);
1267 face_infos2.reserve(face_infos2_size_approx);
1270 Integer faces_infos_index = 0;
1272 std::set<Int64> node_uids_set;
1273 face_infos2.
add(nb_connected_family);
1275 for (
Integer i_face = 0; i_face < nb_face; ++i_face) {
1276 Integer current_face_type = (
Integer)faces_infos[faces_infos_index++];
1277 Integer current_face_uid = (
Integer)faces_infos[faces_infos_index++];
1278 face_infos2.add(current_face_type);
1279 face_infos2.add(current_face_uid);
1281 face_infos2.add(mesh()->nodeFamily()->itemKind());
1282 ItemTypeInfo* it = itm->typeFromId(current_face_type);
1283 Integer current_face_nb_node = it->nbLocalNode();
1284 face_infos2.add(current_face_nb_node);
1286 Int64ConstArrayView current_face_node_uids(current_face_nb_node, &faces_infos[faces_infos_index]);
1287 work_face_orig_nodes.resize(current_face_nb_node);
1288 work_face_sorted_nodes.resize(current_face_nb_node);
1289 work_face_orig_nodes.copy(current_face_node_uids);
1290 mesh_utils::reorderNodesOfFace(work_face_orig_nodes, work_face_sorted_nodes);
1291 face_infos2.addRange(work_face_sorted_nodes);
1292 faces_infos_index += current_face_nb_node;
1295 face_infos2.add(mesh()->edgeFamily()->itemKind());
1296 face_infos2.add(it->nbLocalEdge());
1297 for (
int edge_index = 0; edge_index < it->nbLocalEdge(); ++edge_index) {
1298 Int64 first_node = work_face_sorted_nodes[it->localEdge(edge_index).beginNode()];
1299 Int64 second_node = work_face_sorted_nodes[it->localEdge(edge_index).endNode()];
1300 if (first_node > second_node)
1301 std::swap(first_node, second_node);
1302 auto edge_it = edge_uid_map.find(std::make_pair(first_node, second_node));
1303 if (edge_it == edge_uid_map.end())
1304 ARCANE_FATAL(
"Do not find edge with nodes {0}-{1} in edge uid map. Exiting",
1305 work_face_sorted_nodes[it->localEdge(edge_index).beginNode()],
1306 work_face_sorted_nodes[it->localEdge(edge_index).endNode()]);
1307 face_infos2.add(edge_it->second);
1315void DynamicMeshIncrementalBuilder::
1318 ItemTypeMng* itm = m_item_type_mng;
1319 Integer faces_infos_index = 0;
1320 Integer face_infos2_index = 0;
1321 face_infos2[face_infos2_index++] = 1;
1324 std::set<Int64> node_uids_set;
1326 for (
Integer i_face = 0; i_face < nb_face; ++i_face) {
1329 face_infos2[face_infos2_index++] = faces_infos[faces_infos_index++];
1330 face_infos2[face_infos2_index++] = faces_infos[faces_infos_index++];
1331 face_infos2[face_infos2_index++] = mesh()->nodeFamily()->itemKind();
1333 ItemTypeInfo* it = itm->typeFromId(item_type_id);
1334 Integer current_face_nb_node = it->nbLocalNode();
1335 face_infos2[face_infos2_index++] = current_face_nb_node;
1336 Int64ConstArrayView current_face_node_uids(current_face_nb_node, &faces_infos[faces_infos_index]);
1337 work_face_orig_nodes.resize(current_face_nb_node);
1338 work_face_sorted_nodes.resize(current_face_nb_node);
1339 work_face_orig_nodes.copy(current_face_node_uids);
1340 mesh_utils::reorderNodesOfFace(work_face_orig_nodes, work_face_sorted_nodes);
1341 face_infos2.subView(face_infos2_index, current_face_nb_node).copy(work_face_sorted_nodes);
1342 faces_infos_index += current_face_nb_node;
1343 face_infos2_index += current_face_nb_node;
1344 node_uids_set.insert(current_face_node_uids.begin(), current_face_node_uids.end());
1346 node_uids.
resize(node_uids_set.size());
1348 for (
Int64 node_uid : node_uids_set)
1349 node_uids[index++] = node_uid;
1366 bool add_to_edges = edges.
size() != 0;
1367 if (add_to_edges && nb_edge != edges.
size())
1369 "return array 'edges' has to have same size as number of edges");
1372 for (
Integer i_edge = 0; i_edge < nb_edge; ++i_edge) {
1374 Int64 edge_unique_id = edge_infos[edge_info_index];
1378 edge_info_index += 2;
1383 edges[i_edge] = edge->
localId();
1401 bool add_to_edges = edges.
size() != 0;
1402 if (add_to_edges && nb_edge != edges.
size())
1404 "return array 'edges' has to have same size as number of edges");
1407 Integer edge_infos2_size = edge_infos.
size() + 1 + 2 * nb_edge;
1410 nb_edge, edge_infos2_size, edges, &mesh()->trueEdgeFamily(), &mesh()->trueEdgeFamily(), sub_domain_id);
1415 _fillEdgeInfo2(nb_edge, edge_infos, edge_infos2, node_uids);
1421 nb_node_to_add, 2 * nb_node_to_add + 1, node_lids, &mesh()->trueNodeFamily(), &mesh()->trueNodeFamily(), sub_domain_id);
1422 Int64Array& node_infos2 = node_data.itemInfos();
1423 _fillNodeNewInfo(node_uids, node_infos2);
1429void DynamicMeshIncrementalBuilder::
1433 bool add_to_edges = edges.
size() != 0;
1434 if (add_to_edges && nb_edge != edges.
size())
1436 "return array 'edges' has to have same size as number of edges");
1445 _fillNodeInfoFromEdge(nb_node, nb_edge, nodes_infos, edges_infos);
1449 _fillEdgeNewInfoNew(nb_edge, edges_infos, edge_data.itemInfos());
1453 node_lids.
resize(nb_node);
1454 _fillNodeNewInfo(nodes_infos, node_data.itemInfos());
1456 _initNodeRelationInfo(node_relations_data, edge_data, nodes_infos);
1459 addItems(item_data_list, item_relation_data_list);
1465void DynamicMeshIncrementalBuilder::
1468 Integer edges_infos_index = 0;
1469 Integer edge_infos2_index = 0;
1470 std::set<Int64> node_uids_set;
1473 edge_infos2[edge_infos2_index++] = 1;
1475 for (
Integer i_edge = 0; i_edge < nb_edge; ++i_edge) {
1476 edge_infos2[edge_infos2_index++] = IT_Line2;
1477 edge_infos2[edge_infos2_index++] = edges_infos[edges_infos_index++];
1478 edge_infos2[edge_infos2_index++] =
mesh()->nodeFamily()->itemKind();
1479 edge_infos2[edge_infos2_index++] = 2;
1480 edge_infos2[edge_infos2_index++] = edges_infos[edges_infos_index];
1481 node_uids_set.insert(edges_infos[edges_infos_index++]);
1482 edge_infos2[edge_infos2_index++] = edges_infos[edges_infos_index];
1483 node_uids_set.insert(edges_infos[edges_infos_index++]);
1485 node_uids.
resize(node_uids_set.size());
1487 for (Int64 node_uid : node_uids_set)
1488 node_uids[index++] = node_uid;
1491void DynamicMeshIncrementalBuilder::
1494 Integer edges_infos_index = 0;
1495 Integer edges_new_infos_index = 0;
1498 edges_new_infos[edges_new_infos_index++] = 1;
1500 for (
Integer i_edge = 0; i_edge < nb_edge; ++i_edge) {
1501 edges_new_infos[edges_new_infos_index++] = IT_Line2;
1502 edges_new_infos[edges_new_infos_index++] = edges_infos[edges_infos_index++];
1503 edges_new_infos[edges_new_infos_index++] = mesh()->nodeFamily()->itemKind();
1504 edges_new_infos[edges_new_infos_index++] = 2;
1505 Int64 first_node = edges_infos[edges_infos_index++];
1506 Int64 second_node = edges_infos[edges_infos_index++];
1507 if (first_node > second_node)
1508 std::swap(first_node, second_node);
1509 edges_new_infos[edges_new_infos_index++] = first_node;
1510 edges_new_infos[edges_new_infos_index++] = second_node;
1517void DynamicMeshIncrementalBuilder::
1522 ItemInternalMap& faces_map =
m_mesh->facesMap();
1524 faces_map.eachItem([&](Item face) {
1525 if (face.uniqueId() > max_uid)
1526 max_uid = face.uniqueId();
1531 ItemInternalMap& edges_map =
m_mesh->edgesMap();
1533 edges_map.eachItem([&](Item edge) {
1534 if (edge.uniqueId() > max_uid)
1535 max_uid = edge.uniqueId();
1547void DynamicMeshIncrementalBuilder::
1550 info() <<
"-- Mesh information (Arcane2):";
1555 info() <<
"-- Graph information (Arcane2):";
1561void DynamicMeshIncrementalBuilder::
1562printStats(
Int32 level)
1564 info(level) <<
"-- -- Statistics";
1566 <<
" hashmap=" <<
m_mesh->nodesMap().count();
1568 <<
" hashmap=" <<
m_mesh->edgesMap().count();
1570 <<
" hashmap=" <<
m_mesh->facesMap().count();
1572 <<
" hashmap=" <<
m_mesh->cellsMap().count();
1573 info(level) <<
"--";
1600 if (!m_face_unique_id_builder)
1602 m_face_unique_id_builder->computeFacesUniqueIds();
1605 if (!m_edge_unique_id_builder)
1607 m_edge_unique_id_builder->computeEdgesUniqueIds();
1614void DynamicMeshIncrementalBuilder::
1615addGhostLayers(
bool is_allocate)
1617 debug() <<
"Add one ghost layer";
1630 debug() <<
"Add one ghost layer";
1639void DynamicMeshIncrementalBuilder::
1644 items_to_remove.
reserve(1000);
1671 if (!
m_mesh->useMeshItemFamilyDependencies()) {
1675 info() <<
"Remove Items for family : " << links_family->
name();
1680 if (family->itemKind() !=
IK_DoF || family->name() == GraphDoFs::linkFamilyName())
1682 info() <<
"Remove Items for family : " << family->name();
1683 family->removeNeedRemoveMarkedItems();
1707 info() <<
"Number of particles of family " << family->
name() <<
" to remove: " << lids_to_remove.
size();
1708 if (lids_to_remove.
size() > 0)
1709 particle_family->removeParticles(lids_to_remove);
1717 cells_to_remove.
reserve(1000);
1718 _removeNeedRemoveMarkedItems(cell_family.itemsMap(), cells_to_remove);
1720 info() <<
"Number of cells to remove: " << cells_to_remove.
size();
1722#ifdef ARCANE_DEBUG_DYNAMIC_MESH
1723 for (
Integer i = 0, is = cells_to_remove.
size(); i < is; ++i)
1724 info() <<
"remove cell with uid=" << cells_to_remove[i]->uniqueId()
1725 <<
",lid=" << cells_to_remove[i]->localId()
1726 <<
",owner=" << cells_to_remove[i]->owner();
1738 IItemFamilyNetwork::InverseTopologicalOrder);
1739 for (
auto family :
m_mesh->itemFamilies()) {
1753 if (connectivity == 0)
1756 ARCANE_FATAL(
"Connectivity already set: cannot redefine it");
1758 m_has_edge = Connectivity::hasConnectivity(connectivity, Connectivity::CT_HasEdge);
#define ARCANE_CHECK_POINTER(ptr)
Macro returning the pointer ptr if it is not null or throwing an exception if it is null.
#define ARCANE_THROW(exception_class,...)
Macro for throwing an exception with formatting.
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Utility functions for the mesh.
bool reorderNodesOfFace(Int64ConstArrayView before_ids, Int64ArrayView after_ids)
Reorders the nodes of a face.
Integer size() const
Number of elements in the vector.
Exception when an argument is invalid.
constexpr Integer size() const noexcept
Returns the size of the array.
Base class for 1D data vectors.
void addRange(ConstReferenceType val, Int64 n)
Adds n elements of value val to the end of the array.
void resize(Int64 s)
Changes the number of elements in the array to s.
void add(ConstReferenceType val)
Adds element val to the end of the array.
T & back()
Last element of the array.
void reserve(Int64 new_capacity)
Reserves memory for new_capacity elements.
ArrayView< T > view() const
Mutable view of this array.
EnumeratorT< IItemFamily * > Enumerator
constexpr ConstArrayView< T > subView(Integer abegin, Integer asize) const noexcept
Sub-view (constant) starting from element abegin and containing asize elements.
constexpr Integer size() const noexcept
Number of elements in the array.
Template class for converting a type.
virtual void schedule(IItemFamilyNetworkTask task, eSchedulingOrder order=TopologicalOrder)=0
Schedules the execution of a task, in topological or inverse topological order.
Interface of an entity family.
virtual void removeNeedRemoveMarkedItems()=0
Removes entities and updates connectivities.
virtual String name() const =0
Family name.
virtual eItemKind itemKind() const =0
Entity kind.
Int32 flags() const
Flags of the entity.
Int32 localId() const
Local number (in the subdomain) of the entity.
Flags for entity characteristics.
@ II_NeedRemove
The entity must be removed.
Internal structure of a mesh entity.
Type of an entity (Item).
static ItemTypeId fromInteger(Int64 v)
Creates an instance from an integer.
Local information about a cell edge.
Integer endNode() const
Local index in the cell of the ending node of the edge.
Integer beginNode() const
Local index in the cell of the starting node of the edge.
Local information about a cell face.
Integer node(Integer i) const
Local index in the cell of the i-th node of the face.
Integer typeId() const
Type of the face entity.
Integer nbNode() const
Number of nodes of the face.
Info on a mesh entity type.
LocalEdge localEdge(Integer id) const
Local connectivity of the i-th edge of the cell.
LocalFace localFace(Integer id) const
Local connectivity of the i-th face of the cell.
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.
View on a vector of entities.
Int32 size() const
Number of elements in the vector.
Base class for a mesh element.
impl::MutableItemBase mutableItemBase() const
Mutable internal part of the entity.
constexpr Int32 localId() const
Local identifier of the entity in the processor subdomain.
void setFlags(Int32 f)
Sets the entity flags.
1D vector of data with reference semantics.
Unicode character string.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
TraceMessageDbg debug(Trace::eDebugLevel=Trace::Medium) const
Flow for a debug message.
TraceMessage info() const
Flow for an information message.
ITraceMng * traceMng() const
Trace manager.
1D data vector with value semantics (STL style).
void removeCells(ConstArrayView< Int32 > cells_local_id)
Removes the cells whose local numbers are cells_local_id.
void _addParentCellToCell(Cell cell, Cell parent_cell)
AMR.
void addNodes2(Int64ConstArrayView nodes_uid, Integer sub_domain_id, Int32ArrayView nodes)
Ajoute des noeuds au maillage actuel. Utilise l'ajout d'item générique basé sur dépendances entre fam...
void computeFacesUniqueIds()
Calculates the unique IDs for each face.
bool m_verbose
True if messages are displayed.
void setConnectivity(Integer c)
Sets the active connectivity for the associated mesh.
void addParentCells(const ItemVectorView &items)
Add to the current mesh items coming from a parent mesh.
void addCells(Integer nb_cell, Int64ConstArrayView cell_infos, Integer sub_domain_id, Int32ArrayView cells, bool allow_build_face=true)
Adds cells to the current mesh.
void _initFaceRelationInfo(ItemData &source_item_relation_data, const ItemData &target_item_dependencies_data, Int64ConstArrayView faces_info)
Initializes face relation info.
void addParentItems(const ItemVectorView &items, const eItemKind submesh_kind)
Add to the current mesh items coming from a parent mesh.
OneMeshItemAdder * m_one_mesh_item_adder
Mesh building utilities.
void _fillFaceInfo(Integer &nb_face, Integer nb_cell, Int64Array &faces_infos, Int64ConstArrayView cells_infos, std::map< Int64, Int64SharedArray > &cell_to_face_connectivity_info)
Adds cells to the current mesh.
Int64 m_face_uid_pool
uniqueId() number used for generating faces
void resetAfterDeallocate()
Resets the structures to allow for a new allocation.
void addGhostChildFromParent(Array< Int64 > &ghost_cell_to_refine)
AMR.
void addEdges2(Integer nb_edge, Int64ConstArrayView edge_infos, Integer sub_domain_id, Int32ArrayView edges)
Adds edges to the current mesh. Uses generic item addition based on family dependencies.
Int64 m_edge_uid_pool
uniqueId() number used for generating edges
void addItems(ItemDataList &item_info_list)
Ajout générique d'items d'un ensemble de famille pour lesquelles on fournit un ItemData.
void addNodes(Int64ConstArrayView nodes_uid, Integer sub_domain_id, Int32ArrayView nodes)
Ajoute des noeuds au maillage actuel.
void addFaces(Integer nb_face, Int64ConstArrayView face_infos, Integer sub_domain_id, Int32ArrayView faces)
Ajoute des faces au maillage actuel.
void addEdges(Integer nb_edge, Int64ConstArrayView edge_infos, Integer sub_domain_id, Int32ArrayView edges)
Adds edges to the current mesh.
GhostLayerBuilder * m_ghost_layer_builder
Utility to build ghost elements.
void addHChildrenCells(Cell hParent_cell, Integer nb_cell, Int64ConstArrayView cells_infos, Int32 sub_domain_id, Int32ArrayView cells, bool allow_build_face)
Ajoute des mailles au maillage actuel.
bool m_has_edge
Info on the presence of an edge (accelerates access to general connectivity).
void addFamilyItems(ItemData &item_info)
Ajout générique d'items d'une famille, décrite par son ItemInfo.
DynamicMeshIncrementalBuilder(DynamicMesh *mesh)
Constructs an instance for the mesh mesh.
void removeNeedRemoveMarkedItems()
Removes ghost items.
void addCells3(Integer nb_cell, Int64ConstArrayView cell_infos, Integer sub_domain_id, Int32ArrayView cells, bool allow_build_face=true)
Adds cells to the current mesh. Uses generic item addition based on family dependencies.
void addFaces2(Integer nb_face, Int64ConstArrayView face_infos, Integer sub_domain_id, Int32ArrayView faces)
Ajoute des faces au maillage actuel. Utilise l'ajout d'item générique basé sur dépendances entre fami...
Integer m_connectivity
Connectivity info of the current mesh.
DynamicMesh * m_mesh
Associated mesh.
Implementation of a mesh.
IItemFamily * nodeFamily() override
Returns the node family.
IItemFamily * cellFamily() override
Returns the cell family.
IItemFamily * faceFamily() override
Returns the face family.
IItemFamilyNetwork * itemFamilyNetwork() override
Family network interface (connected families).
IItemFamily * edgeFamily() override
Returns the edge family.
Construction of ghost layers.
Construction of ghost layers.
Construction of ghost layers.
Associative array of ItemInternal.
void eachItem(const Lambda &lambda)
Template function to iterate over the instance's entities.
bool getEnableGhostItems() const override
Retrieves the flag to manage ghost particles for the family.
Array< Int64 > Int64Array
Dynamic one-dimensional array of 64-bit integers.
ArrayView< Int64 > Int64ArrayView
C equivalent of a 1D array of 64-bit integers.
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< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
UniqueArray< Int32 > Int32UniqueArray
Dynamic 1D array of 32-bit integers.
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
eItemKind
Mesh entity type.
@ IK_Particle
Particle mesh entity.
@ IK_Cell
Cell mesh entity.
@ IK_Face
Face mesh entity.
@ IK_DoF
Degree of Freedom mesh entity.
@ IK_Edge
Edge mesh entity.
std::int16_t Int16
Signed integer type of 16 bits.
std::int32_t Int32
Signed integer type of 32 bits.