14#include "arcane/mesh/OneMeshItemAdder.h"
16#include "arcane/utils/NotSupportedException.h"
17#include "arcane/utils/ValueConvert.h"
18#include "arcane/utils/FixedArray.h"
21#include "arcane/core/MeshToMeshTransposer.h"
22#include "arcane/core/IParallelMng.h"
23#include "arcane/core/ItemPrinter.h"
25#include "arcane/mesh/DynamicMesh.h"
26#include "arcane/mesh/DynamicMeshIncrementalBuilder.h"
27#include "arcane/mesh/ItemTools.h"
28#include "arcane/mesh/ConnectivityNewWithDependenciesTypes.h"
29#include "arcane/mesh/GraphDoFs.h"
48 bool allow_build_face =
false)
49 : m_type_info(type_info)
50 , m_cell_uid(cell_uid)
52 , m_owner(sub_domain_id)
53 , m_allow_build_face(allow_build_face)
56 Int64 uniqueId()
const {
return m_cell_uid; }
58 Int32 owner()
const {
return m_owner; }
59 Integer nbNode()
const {
return m_info.size(); }
60 Integer nbFace()
const {
return m_type_info->nbLocalFace(); }
61 Integer nbEdge()
const {
return m_type_info->nbLocalEdge(); }
62 Int64 nodeUniqueId(
Integer i_node)
const {
return m_info[i_node]; }
67 bool allowBuildFace()
const {
return m_allow_build_face; }
68 bool allowBuildEdge()
const {
return m_allow_build_face; }
73 Int64 m_cell_uid = NULL_ITEM_UNIQUE_ID;
75 Int32 m_owner = A_NULL_RANK;
76 bool m_allow_build_face =
false;
85, m_mesh(mesh_builder->
mesh())
86, m_mesh_builder(mesh_builder)
87, m_cell_family(m_mesh->trueCellFamily())
88, m_node_family(m_mesh->trueNodeFamily())
89, m_face_family(m_mesh->trueFaceFamily())
90, m_edge_family(m_mesh->trueEdgeFamily())
91, m_item_type_mng(m_mesh->itemTypeMng())
96 m_work_face_orig_nodes_uid.reserve(100);
106 ItemInternal* node = m_node_family.findOrAllocOne(node_uid, is_add);
128 if (item.
nbNode() != nb_node)
129 ARCANE_FATAL(
"Trying to add existing item (kind='{0}', uid={1}) with different number of node (existing={2} new={3})",
133 for (
Int32 i = 0; i < nb_node; ++i) {
134 Int64 new_uid = nodes_uid[i];
136 if (new_uid != current_uid) {
137 std::ostringstream ostr;
138 for (
Int32 k = 0; k < nb_node; ++k)
140 ARCANE_FATAL(
"Trying to add existing item (kind='{0}', uid={1}) with different nodes (index={2} existing='{3}' new='{4}')",
141 item.
kind(), item.
uniqueId(), i, ostr.str(), nodes_uid);
156 if (uid != NULL_ITEM_UNIQUE_ID)
195 bool is_add_face =
false;
196 Face face = m_face_family.findOrAllocOne(face_uid, type_id, is_add_face);
201 for (
Integer i_node = 0; i_node < face_nb_node; ++i_node) {
203 m_face_family.replaceNode(face, i_node, node);
204 m_node_family.addFaceToNode(node, face);
212 return ItemCompatibility::_itemInternal(face);
221 m_work_edge_sorted_nodes.
resize(2);
222 m_work_edge_orig_nodes_uid.
resize(2);
224 for (
Integer z = 0; z < 2; ++z)
225 m_work_edge_orig_nodes_uid[z] = nodes_uid[z];
229 bool is_add_edge =
false;
236 for (
Integer i_node = 0; i_node < 2; ++i_node) {
239 m_node_family.addEdgeToNode(current_node_internal, edge);
249Face OneMeshItemAdder::
250_findInternalFace(
Integer i_face,
const FullCellInfo& cell_info,
bool& is_add)
252 const Int64 face_unique_id = cell_info.faceUniqueId(i_face);
253 ItemTypeInfo* cell_type_info = cell_info.
typeInfo();
254 const ItemTypeInfo::LocalFace& lf = cell_type_info->
localFace(i_face);
255 ItemTypeInfo* face_type_info = m_item_type_mng->typeFromId(lf.typeId());
256 return m_face_family.findOrAllocOne(face_unique_id, face_type_info, is_add);
263Face OneMeshItemAdder::
266 const ItemInternalMap& nodes_map = m_mesh->nodesMap();
267 ItemTypeInfo* cell_type_info = cell_info.typeInfo();
268 const ItemTypeInfo::LocalFace& lf = cell_type_info->localFace(i_face);
270 Int64 face_unique_id = NULL_ITEM_UNIQUE_ID;
280 face_internal = m_face_family.itemsMap().tryFind(face_unique_id);
285 Node nbi = nodes_map.findItem(face_sorted_nodes[0]);
288 if (face_internal.null()) {
292 info() <<
"BadCell uid=" << cell_info.uniqueId();
293 for (
Int32 i = 0; i < cell_info.nbNode(); ++i)
294 info() <<
"Cell node I=" << i <<
" uid=" << cell_info.nodeUniqueId(i);
295 ARCANE_FATAL(
"On the fly face allocation is not allowed here.\n"
296 " You need to add faces with IMeshModifier::addFaces().\n"
297 " CellUid={0} LocalFace={1} FaceNodes={2}",
298 cell_info.uniqueId(), i_face, face_sorted_nodes);
304 ItemTypeInfo* face_type = m_item_type_mng->typeFromId(lf.typeId());
305 return m_face_family.allocOne(face_unique_id, face_type);
309 return face_internal;
317Edge OneMeshItemAdder::
318_findInternalEdge(
Integer i_edge,
const FullCellInfo& cell_info,
319 Int64 first_node,
Int64 second_node,
bool& is_add)
321 ARCANE_UNUSED(first_node);
322 ARCANE_UNUSED(second_node);
324 const Int64 edge_unique_id = cell_info.edgeUniqueId(i_edge);
325 return m_edge_family.findOrAllocOne(edge_unique_id, is_add);
332Edge OneMeshItemAdder::
335 ARCANE_UNUSED(i_edge);
338 FixedArray<Int64, 2> nodes;
339 Int64 edge_unique_id = NULL_ITEM_UNIQUE_ID;
342 nodes[0] = first_node;
343 nodes[1] = second_node;
344 edge_unique_id = MeshUtils::generateHashUniqueId(nodes.view());
345 edge_internal = m_edge_family.itemsMap().tryFind(edge_unique_id);
348 const ItemInternalMap& nodes_map = m_mesh->nodesMap();
349 Node nbi = nodes_map.findItem(first_node);
352 if (edge_internal.null()) {
353 if (!cell_info.allowBuildEdge() && !use_hash)
354 ARCANE_FATAL(
"On the fly edge allocation is not allowed here."
355 " You need to add edges before with IMeshModifier::addEdges()");
359 return m_edge_family.allocOne(edge_unique_id);
363 return edge_internal;
390 bool allow_build_face)
392 CellInfoProxy cell_info_proxy(m_item_type_mng->typeFromId(type_id), cell_uid, sub_domain_id, nodes_uid, allow_build_face);
423 ARCANE_ASSERT(m_mesh->
itemFamilyNetwork(), (
"ItemFamilyNetwork is required to call OneMeshItemAdder::addOneItem"));
424 bool is_alloc =
true;
425 Item item = family_modifier->findOrAllocOne(item_uid, type_id,
m_mesh_info, is_alloc);
429 for (
Integer family_index = 0; family_index < nb_connected_family; ++family_index) {
432 Int32 nb_connected_item = CheckedConvert::toInt32(connectivity_info[info_index++]);
435 String connectivity_name = mesh::connectivityName(family, connected_family);
436 String reverse_connectivity_name = mesh::connectivityName(connected_family, family);
437 bool is_dependency =
false;
443 _clearConnectivity(
ItemLocalId(item), family_to_connected_family);
444 if (connected_family_to_family)
445 _clearReverseConnectivity(
ItemLocalId(item), family_to_connected_family, connected_family_to_family);
450 for (
Integer connected_item_index = 0; connected_item_index < nb_connected_item; ++connected_item_index) {
451 if (family_to_connected_family) {
458 if (connected_family_to_family)
459 connected_family_to_family->
addConnectedItem(ItemLocalId(connected_item_lids[connected_item_index]), ItemLocalId(item));
461 info_index += nb_connected_item;
465 return ItemCompatibility::_itemInternal(item);
470ItemInternal* OneMeshItemAdder::
471addOneItem2(IItemFamily* family,
472 IItemFamilyModifier* family_modifier,
480 ARCANE_ASSERT(m_mesh->itemFamilyNetwork(), (
"ItemFamilyNetwork is required to call OneMeshItemAdder::addOneItem"));
481 bool is_alloc =
true;
482 Item item = family_modifier->findOrAllocOne(item_uid, type_id,
m_mesh_info, is_alloc);
486 for (
Integer family_index = 0; family_index < nb_connected_family; ++family_index) {
490 Int32 nb_connected_item = CheckedConvert::toInt32(connectivity_info[info_index++]);
491 if (nb_connected_item == 0)
493 IItemFamily* connected_family =
nullptr;
494 switch (family_kind) {
496 connected_family = m_mesh->findItemFamily(family_kind, ParticleFamily::defaultFamilyName(),
false,
false);
499 if (family->name() == GraphDoFs::dualNodeFamilyName())
500 connected_family = m_mesh->findItemFamily(family_kind, GraphDoFs::linkFamilyName(),
false,
false);
502 connected_family = m_mesh->findItemFamily(family_kind, GraphDoFs::dualNodeFamilyName(),
false,
false);
505 connected_family = m_mesh->itemFamily(family_kind);
509 String connectivity_name = mesh::connectivityName(family, connected_family);
510 bool is_dependency =
false;
511 IIncrementalItemConnectivity* family_to_connected_family = m_mesh->itemFamilyNetwork()->getConnectivity(family, connected_family, connectivity_name, is_dependency);
512 if (!family_to_connected_family)
513 ARCANE_FATAL(
"Cannot find connectivity name={0}", connectivity_name);
514 bool is_deep_connectivity = m_mesh->itemFamilyNetwork()->isDeep(family_to_connected_family);
515 bool is_relation = !(is_dependency && is_deep_connectivity);
519 bool do_fatal = is_relation ? false :
true;
520 connected_family->itemsUniqueIdToLocalId(connected_item_lids, connectivity_info.subView(info_index, nb_connected_item), do_fatal);
522 Integer nb_connected_item_found = nb_connected_item;
524 for (
Integer index = 0; index < connected_item_lids.size();) {
525 if (connected_item_lids[index] == NULL_ITEM_LOCAL_ID) {
526 connected_item_lids.remove(index);
527 --nb_connected_item_found;
533 for (
Integer connected_item_index = 0; connected_item_index < nb_connected_item_found; ++connected_item_index) {
534 if (family_to_connected_family) {
536 auto connected_item_lid = ItemLocalId{ connected_item_lids[connected_item_index] };
538 if (!family_to_connected_family->hasConnectedItem(ItemLocalId(item), connected_item_lid)) {
539 family_to_connected_family->addConnectedItem(ItemLocalId(item), connected_item_lid);
543 family_to_connected_family->replaceConnectedItem(ItemLocalId(item), connected_item_index, connected_item_lid);
547 info_index += nb_connected_item;
550 debug(
Trace::Highest) <<
"[addItems] ADD_ITEM " << ItemPrinter(item) <<
" in " << family->name();
553 return ItemCompatibility::_itemInternal(item);
558void OneMeshItemAdder::
559_printRelations(ItemInternal* item)
561 debug(
Trace::Highest) <<
"[addItems] RELATIONS for " << ItemPrinter(item) <<
" in " << item->family()->name();
562 for (
const auto& relation : m_mesh->itemFamilyNetwork()->getChildRelations(item->family())) {
565 ConnectivityItemVector connected_items(relation);
566 for (
const auto& connected_item : connected_items.connectedItems(ItemLocalId(item))) {
575void OneMeshItemAdder::
576_clearConnectivity(ItemLocalId item, IIncrementalItemConnectivity* connectivity)
579 ConnectivityItemVector accessor(connectivity);
581 connectivity->removeConnectedItem(item, connected_item);
588void OneMeshItemAdder::
589_clearReverseConnectivity(ItemLocalId item, IIncrementalItemConnectivity* connectivity, IIncrementalItemConnectivity* reverse_connectivity)
591 ConnectivityItemVector accessor(connectivity);
593 reverse_connectivity->removeConnectedItem(connected_item, item);
600template <>
void OneMeshItemAdder::
604 if (m_mesh->isAmrActivated()) {
607 if (cell_info.
level() != 0) {
608 Integer child_rank = cell_info.whichChildAmI();
609 Int64 hParent_uid = cell_info.hParentCellUniqueId();
612 Cell hParent_cell = m_cell_family.findOrAllocOne(hParent_uid, cell_type, is_add);
613 m_cell_family._addParentCellToCell(new_cell, hParent_cell);
614 m_cell_family._addChildCellToCell(hParent_cell, child_rank, new_cell);
619template <>
void OneMeshItemAdder::
620_AMR_Patch(
Cell cell,
const CellInfoProxy& cell_info)
623 ARCANE_UNUSED(cell_info);
633template <
typename CellInfo>
641 const bool is_verbose =
false;
643 info() <<
"AddNewCell type_id=" << cell_type_id <<
" nb_node=" << cell_info.nbNode()
644 <<
" type=" << cell_type_info->
typeName();
649 inew_cell = m_cell_family.findOrAllocOne(cell_info.uniqueId(), cell_type_id, is_add);
652 Cell cell2(inew_cell);
654 for (
Integer i = 0, is = cell_info.nbNode(); i < is; ++i)
655 if (cell_info.nodeUniqueId(i) != cell2.
node(i).
uniqueId())
656 ARCANE_FATAL(
"trying to add existing cell (uid={0}) with different nodes",
657 cell_info.uniqueId());
659 return ItemCompatibility::_itemInternal(inew_cell);
663 Cell new_cell(inew_cell);
667 const MeshKind& mesh_kind = m_mesh->meshKind();
669 const Int32 cell_nb_face = cell_info.nbFace();
672 mut_cell.
addFlags(ItemFlags::II_HasEdgeFor1DItems);
676 if (cell_info.nbNode() != inew_cell.
nbNode())
677 ARCANE_FATAL(
"Incoherent number of nodes v={0} expected={1}", inew_cell.
nbNode(), cell_info.nbNode());
678 if (cell_nb_face != inew_cell.
nbFace())
679 ARCANE_FATAL(
"Incoherent number of faces v={0} expected={1}", inew_cell.
nbFace(), cell_nb_face);
681 ARCANE_FATAL(
"Type '{0}' is not allowed for 'Cell' (cell_uid={1})",
682 cell_type_info->
typeName(), cell_info.uniqueId());
683 if (!allow_multi_dim_cell) {
685 Int32 mesh_dimension = m_mesh->dimension();
686 if (cell_dimension >= 0 && cell_dimension != mesh_dimension)
687 ARCANE_FATAL(
"Incoherent dimension for cell uid={0} cell_dim={1} mesh_dim={2} type={3}",
688 cell_info.uniqueId(), cell_dimension, mesh_dimension, cell_type_info->
typeName());
697 if (m_mesh_builder->hasEdge()) {
698 const Int32 cell_nb_edge = cell_info.nbEdge();
700 for (
Integer i_edge = 0; i_edge < cell_nb_edge; ++i_edge) {
703 Int64 second_node = cell_info.nodeUniqueId(le.
endNode());
704 if (first_node > second_node)
705 std::swap(first_node, second_node);
708 Edge edge_internal = _findInternalEdge(i_edge, cell_info, first_node, second_node, is_add);
716 m_edge_family.replaceNode(
ItemLocalId(edge_internal), 0, current_node);
717 m_node_family.addEdgeToNode(current_node, edge_internal);
721 m_edge_family.replaceNode(
ItemLocalId(edge_internal), 1, current_node);
722 m_node_family.addEdgeToNode(current_node, edge_internal);
728 m_edge_family.addCellToEdge(edge_internal, inew_cell);
733 for (
Integer i_face = 0; i_face < cell_nb_face; ++i_face) {
737 const bool is_reorder = _isReorder(i_face, lf, cell_info);
740 Face face = _findInternalFace(i_face, cell_info, is_add);
747 info() <<
"AddFaceToCell (cell_uid=" << new_cell.
uniqueId() <<
": Create face (index=" << i_face
750 <<
" type=" << face_type_info->
typeName()
751 <<
" face_nb_linear_node=" << face_nb_linear_node
752 <<
" sorted_nodes=" << face_sorted_nodes;
756 for (
Integer i_node = 0; i_node < face_nb_node; ++i_node) {
758 info() <<
"AddNodeToFace i_node=" << i_node <<
" uid=" << face_sorted_nodes[i_node];
759 Node current_node = nodes_map.
findItem(face_sorted_nodes[i_node]);
760 m_face_family.replaceNode(face, i_node, current_node);
761 if (i_node < face_nb_linear_node) {
762 m_node_family.addFaceToNode(current_node, face);
766 if (m_mesh_builder->hasEdge()) {
768 for (
Integer i_edge = 0; i_edge < face_nb_edge; ++i_edge) {
770 m_face_family.addEdgeToFace(face, current_edge);
771 m_edge_family.addFaceToEdge(current_edge, face);
776 m_cell_family.replaceFace(new_cell, i_face, face);
779 if (m_mesh->isAmrActivated()) {
782 m_face_family.replaceFrontCellToFace(face, new_cell);
784 m_face_family.addFrontCellToFace(face, inew_cell);
788 m_face_family.replaceBackCellToFace(face, new_cell);
790 m_face_family.addBackCellToFace(face, inew_cell);
795 m_face_family.addFrontCellToFace(face, inew_cell);
798 m_face_family.addBackCellToFace(face, inew_cell);
803 _AMR_Patch(inew_cell, cell_info);
804 return ItemCompatibility::_itemInternal(inew_cell);
832 if (item.
type() == IT_Line2 && submesh_kind ==
IK_Cell)
834 if (item.
type() == IT_Vertex && submesh_kind ==
IK_Face)
845 switch (submesh_kind) {
847 new_item = m_node_family.findOrAllocOne(item.
uniqueId(), is_add);
851 new_item = m_edge_family.findOrAllocOne(item.
uniqueId(), is_add);
855 new_item = m_face_family.findOrAllocOne(item.
uniqueId(),
type, is_add);
861 new_item = m_cell_family.findOrAllocOne(item.
uniqueId(), type_id, is_add);
869 if (fatal_on_existing_item)
870 ARCANE_FATAL(
"Cannot add already existing parent item in submesh");
872 return ItemCompatibility::_itemInternal(new_item);
884 switch (submesh_kind) {
886 item_nb_face =
type->nbLocalFace();
887 item_nb_edge =
type->nbLocalEdge();
888 item_nb_node =
type->nbLocalNode();
891 item_nb_edge =
type->nbLocalEdge();
892 item_nb_node =
type->nbLocalNode();
895 item_nb_node =
type->nbLocalNode();
901 if (!m_mesh_builder->hasEdge())
907 for (
Integer z = 0; z < item_nb_face; ++z)
908 new_item->_setFace(z, NULL_ITEM_ID);
909 for (
Integer z = 0; z < item_nb_edge; ++z)
910 new_item->_setEdge(z, NULL_ITEM_ID);
911 for (
Integer z = 0; z < item_nb_node; ++z)
912 new_item->_setNode(z, NULL_ITEM_ID);
917 DynamicMeshKindInfos::ItemInternalMap& nodes_map = m_mesh->nodesMap();
919 DynamicMeshKindInfos::ItemInternalMap& parent_nodes_map = parent_mesh->nodesMap();
924 const bool direct_node_order =
928 for (
Integer i_node = 0; i_node < item_nb_node; ++i_node) {
930 if (
type->typeId() == IT_FaceVertex)
933 Int32 idx = ((direct_node_order) ? i_node : (item_nb_node - 1 - i_node));
936 Int64 new_node_uid = nodes_uid[i_node] = parent_item.
uniqueId();
937 ItemInternal* node_internal = m_node_family.findOrAllocOne(new_node_uid, is_add);
939#ifdef ARCANE_DEBUG_DYNAMIC_MESH
940 info() <<
"Création node " << new_node_uid <<
' '
951 switch (submesh_kind) {
953 m_cell_family.replaceNode(new_item_lid, i_node, node_lid);
954 m_node_family.addCellToNode(node_internal, new_item.
toCell());
957 m_face_family.replaceNode(new_item_lid, i_node, node_lid);
958 m_node_family.addFaceToNode(node_internal, new_item.
toFace());
961 m_edge_family.replaceNode(new_item_lid, i_node, node_lid);
962 m_node_family.addEdgeToNode(node_internal, new_item.
toEdge());
970 for (
Integer i_edge = 0; i_edge < item_nb_edge; ++i_edge) {
975 if (first_node > second_node)
976 std::swap(first_node, second_node);
979 if (parent_item.
null())
984 ItemInternal* edge_internal = m_edge_family.findOrAllocOne(new_edge_uid, is_add);
986#ifdef ARCANE_DEBUG_DYNAMIC_MESH
987 info() <<
"Création edge " << new_edge_uid <<
' '
995 m_edge_family.replaceNode(
ItemLocalId(edge_internal), 0, current_node);
996 m_node_family.addEdgeToNode(current_node, edge_internal);
1000 m_edge_family.replaceNode(
ItemLocalId(edge_internal), 1, current_node);
1001 m_node_family.addEdgeToNode(current_node, edge_internal);
1007 switch (submesh_kind) {
1010 m_edge_family.addCellToEdge(edge_internal, new_item.
toCell());
1014 m_edge_family.addFaceToEdge(edge_internal, new_item.
toFace());
1023 for (
Integer i_face = 0; i_face < item_nb_face; ++i_face) {
1027 m_work_face_orig_nodes_uid.resize(face_nb_node);
1028 for (
Integer z = 0; z < face_nb_node; ++z)
1029 m_work_face_orig_nodes_uid[z] = nodes_uid[lf.
node(z)];
1030 bool is_reorder =
false;
1031 if (m_mesh->dimension() == 1) {
1032 is_reorder =
m_face_reorderer.reorder1D(i_face, m_work_face_orig_nodes_uid[0]);
1044 if (m_mesh->dimension() == 1) {
1045 parent_item = parent_nodes_map.
findItem(face_sorted_nodes[0]);
1049 Int64 first_node = face_sorted_nodes[0];
1050 Int64 second_node = face_sorted_nodes[1];
1051 if (first_node > second_node)
1052 std::swap(first_node, second_node);
1058 if (parent_item.
null())
1063 ItemInternal* face_internal = m_face_family.findOrAllocOne(new_face_uid, face_type, is_add);
1065#ifdef ARCANE_DEBUG_DYNAMIC_MESH
1066 info() <<
"Création face " << new_face_uid <<
' '
1072 for (
Integer i_node = 0; i_node < face_nb_node; ++i_node) {
1073 Node current_node = nodes_map.
findItem(face_sorted_nodes[i_node]);
1074 m_face_family.replaceNode(
ItemLocalId(face_internal), i_node, current_node);
1075 m_node_family.addFaceToNode(current_node, face_internal);
1078 if (m_mesh_builder->hasEdge()) {
1080 for (
Integer i_edge = 0; i_edge < face_nb_edge; ++i_edge) {
1082 Edge current_edge = new_item.
itemBase().edgeBase(edge_idx);
1083 m_face_family.addEdgeToFace(face_internal, current_edge);
1084 m_edge_family.addFaceToEdge(current_edge, face_internal);
1091 m_face_family.addFrontCellToFace(face_internal, new_item.
toCell());
1094 m_face_family.addBackCellToFace(face_internal, new_item.
toCell());
1098 return ItemCompatibility::_itemInternal(new_item);
1106template <
typename CellInfo>
1110 Integer cell_nb_node = cell_info.nbNode();
1113 for (
Integer i_node = 0; i_node < cell_nb_node; ++i_node) {
1114 Int64 node_unique_id = cell_info.nodeUniqueId(i_node);
1115 bool is_add =
false;
1116 ItemInternal* node_internal = m_node_family.findOrAllocOne(node_unique_id, is_add);
1121 m_node_family.addCellToNode(node_internal, cell);
1122 m_cell_family.replaceNode(cell, i_node,
ItemLocalId(node_internal));
1129template <
typename CellInfo>
1130bool OneMeshItemAdder::
1134 m_work_face_orig_nodes_uid.
resize(face_nb_node);
1135 for (
Integer i_node = 0; i_node < face_nb_node; ++i_node)
1136 m_work_face_orig_nodes_uid[i_node] = cell_info.nodeUniqueId(lf.
node(i_node));
1137 bool is_reorder =
false;
1139 is_reorder =
m_face_reorderer.reorder1D(i_face, m_work_face_orig_nodes_uid[0]);
1167 ARCANE_FATAL(
"Can not call this method when edge or face are already created");
#define ARCANE_CHECK_POINTER(ptr)
Macro retournant le pointeur ptr s'il est non nul ou lancant une exception s'il est nul.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Fonctions utilitaires sur le maillage.
bool reorderNodesOfFace(Int64ConstArrayView before_ids, Int64ArrayView after_ids)
Réordonne les noeuds d'une face.
Int64 generateHashUniqueId(SmallSpan< const Int64 > nodes_unique_id)
Génère un identifiant unique à partir d'une liste d'identifiants de noeuds.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
Face face(Int32 i) const
i-ème face de la maille
Int32 nbFace() const
Nombre de faces de la maille.
Edge edge(Int32 i) const
i-ème arête de la maille
Vue constante d'un tableau de type T.
constexpr ConstArrayView< T > subView(Integer abegin, Integer asize) const noexcept
Sous-vue (constante) à partir de l'élément abegin et contenant asize éléments.
constexpr Integer size() const noexcept
Nombre d'éléments du tableau.
Int32 nbCell() const
Nombre de mailles de la face (1 ou 2).
bool isSubDomainBoundary() const
Indique si la face est au bord du sous-domaine (i.e nbCell()==1).
Interface pour gérer une connectivité incrémentale.
virtual void replaceConnectedItem(ItemLocalId source_item, Integer index, ItemLocalId target_local_id)=0
Remplace l'entité d'index index de source_item par l'entité de localId() target_local_id.
virtual void addConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id)=0
Ajoute l'entité de localId() target_local_id à la connectivité de source_item.
Interface de modification d'une famille.
virtual IIncrementalItemConnectivity * getStoredConnectivity(IItemFamily *source_family, IItemFamily *target_family, const String &name)=0
Retourne, si elle est associée à un stockage, la connectivité entre les familles source_family et tar...
Interface d'une famille d'entités.
virtual String name() const =0
Nom de la famille.
virtual void itemsUniqueIdToLocalId(Int32ArrayView local_ids, Int64ConstArrayView unique_ids, bool do_fatal=true) const =0
Converti un tableau de numéros uniques en numéros locaux.
ItemUniqueId uniqueId() const
Numéro unique de l'entité
ItemTypeInfo * typeInfo() const
Type de l'entité.
Int32 localId() const
Numéro local (au sous-domaine) de l'entité
Structure interne d'une entité de maillage.
Index d'un Item dans une variable.
Type d'une entité (Item).
static ItemTypeId fromInteger(Int64 v)
Créé une instance à partir d'un entier.
Informations locales sur une arête d'une maille.
Integer endNode() const
Indice local à la maille du sommet extrémité de l'arête.
Integer beginNode() const
Indice local à la maille du sommet origine de l'arête.
Informations locales sur une face d'une maille.
Integer node(Integer i) const
Indice locale dans la maille du i-ème noeud de la face.
Integer nbEdge() const
Nombre d'arête de la face.
Integer typeId() const
Type de l'entité face.
Integer edge(Integer i) const
Arête de la face.
Integer nbNode() const
Nombre de noeuds de la face.
Infos sur un type d'entité du maillage.
LocalEdge localEdge(Integer id) const
Connectivité locale de la i-ème arête de la maille.
LocalFace localFace(Integer id) const
Connectivité locale de la i-ème face de la maille.
const ItemTypeInfo * linearTypeInfo() const
Type de l'élément linéaire correspondant.
Int16 dimension() const
Dimension de l'élément (<0 si inconnu).
Integer nbLocalNode() const
Nombre de noeuds de l'entité
String typeName() const
Nom du type.
Integer nbLocalFace() const
Nombre de faces de l'entité
bool isValidForCell() const
Indique si le type est valide pour créér une maille (Cell).
ItemTypeId itemTypeId() const
Numéro du type.
Gestionnaire des types d'entités d'un maillage.
ItemTypeInfo * typeFromId(Integer id) const
Type correspondant au numéro id.
Elément de maillage s'appuyant sur des noeuds (Edge,Face,Cell).
Node node(Int32 i) const
i-ème noeud de l'entité
Int32 nbNode() const
Nombre de noeuds de l'entité
Classe de base d'un élément de maillage.
impl::MutableItemBase mutableItemBase() const
Partie interne modifiable de l'entité.
constexpr Int32 localId() const
Identifiant local de l'entité dans le sous-domaine du processeur.
Edge toEdge() const
Converti l'entité en le genre Edge.
Int32 owner() const
Numéro du sous-domaine propriétaire de l'entité
ItemWithNodes toItemWithNodes() const
Converti l'entité en le genre ItemWithNodes.
Cell toCell() const
Converti l'entité en le genre Cell.
ItemUniqueId uniqueId() const
Identifiant unique sur tous les domaines.
constexpr bool null() const
true si l'entité est nul (i.e. non connecté au maillage)
Face toFace() const
Converti l'entité en le genre Edge.
impl::ItemBase itemBase() const
Partie interne de l'entité.
constexpr eItemKind kind() const
Genre de l'entité
Int16 type() const
Type de l'entité
Caractéristiques d'un maillage.
bool isMonoDimension() const
Vrai si la structure du maillage est eMeshCellDimensionKind::MonoDimension.
static eItemKind kindTranspose(eItemKind kindA, IMesh *meshA, IMesh *meshB)
Transpose le genre kindA du maillage meshA en le genre associé dans meshB.
Méthodes permettant de modifier ItemBase.
void setOwner(Integer suid, Int32 current_sub_domain)
Positionne le numéro du sous-domaine propriétaire de l'entité.
void setParent(Int32 aindex, Int32 parent_local_id)
Positionne le i-ème parent (actuellement aindex doit valoir 0).
void addFlags(Int32 added_flags)
Ajoute les flags added_flags à ceux de l'entité
Exception lorsqu'une opération n'est pas supportée.
Chaîne de caractères unicode.
TraceAccessor(ITraceMng *m)
Construit un accesseur via le gestionnaire de trace m.
TraceMessageDbg debug(Trace::eDebugLevel=Trace::Medium) const
Flot pour un message de debug.
TraceMessage info() const
Flot pour un message d'information.
ITraceMng * traceMng() const
Gestionnaire de trace.
Construction of a mesh incrementally.
Implementation of a mesh.
IItemFamily * itemFamily(eItemKind ik) override
Retourne la famille d'entité de type ik.
Integer dimension() override
Dimension du maillage (1D, 2D ou 3D).
IItemFamilyNetwork * itemFamilyNetwork() override
Interface du réseau de familles (familles connectées).
Item findOrAllocOne(Int64 uid, ItemTypeId type_id, MeshInfos &mesh_info, bool &is_alloc) override
Retrieves or allocates a unique numbered edge uid and of type type.Generic item addition.
void replaceNode(ItemLocalId edge, Integer index, ItemLocalId node)
Replaces the node at index index of the edge edge with * that of localId() node_lid.
Info to create/serialize a mesh knowing the uniqueId() and owner() of all these sub-entities (cells,...
Integer level() const
AMR.
Associative array of ItemInternal.
impl::ItemBase findItem(Int64 uid) const
Returns the unique ID entity uid.
Int32 rank() const
Number of this subdomain.
Integer & nbEdge()
Number of edges in the mesh.
Integer & nbNode()
Number of nodes in the mesh.
void _checkSameItemCoherency(ItemWithNodes item, ConstArrayView< Int64 > nodes_uid)
Checks the coherence of nodes for an already added item.
void _addNodesToCell(Cell cell, const CellInfo &cell_info)
Adds the nodes nodes_uid to the mesh cell.
NodesOfItemReorderer m_face_reorderer
Work arrays.
ItemInternal * _addOneCell(const CellInfo &cell_info)
Adds a cell.
ItemInternal * addOneCell(ItemTypeId type_id, Int64 cell_uid, Int32 sub_domain_id, Int64ConstArrayView nodes_uid, bool allow_build_face)
Adds a cell.
MeshInfos m_mesh_info
General information about the mesh (sub-domain number, number of items...).
Int64 _checkGenerateFaceUniqueId(Int64 uid, ConstArrayView< Int64 > nodes_uid)
Generates a uniqueId() for the face if uid is null.
Int64 m_next_edge_uid
Next uniqueId() number used for generating edges.
void setUseNodeUniqueIdToGenerateEdgeAndFaceUniqueId(bool v)
Positions the uniqueId() numbering mechanism.
void resetAfterDeallocate()
Resets the structures to allow for re-allocation.
bool m_use_hash_for_edge_and_face_unique_id
If true, generates face uniqueIds from node uniqueIds.
Int64 m_next_face_uid
Next uniqueId() number used for generating faces.
ItemInternal * addOneParentItem(const Item &item, const eItemKind submesh_kind, const bool fatal_on_existing_item=true)
Adds a parent item.
ItemInternal * addOneFace(ItemTypeId type_id, Int64 face_uid, Int32 owner_rank, Int64ConstArrayView nodes_uid)
Adds a face.
@ Highest
Niveau le plus élevé
bool arcaneIsCheck()
Vrai si on est en mode vérification.
UniqueArray< Int64 > Int64UniqueArray
Tableau dynamique à une dimension d'entiers 64 bits.
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
ConstArrayView< Int64 > Int64ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
UniqueArray< Int32 > Int32UniqueArray
Tableau dynamique à une dimension d'entiers 32 bits.
eItemKind
Genre d'entité de maillage.
@ IK_Particle
Entité de maillage de genre particule.
@ IK_Node
Entité de maillage de genre noeud.
@ IK_Cell
Entité de maillage de genre maille.
@ IK_Face
Entité de maillage de genre face.
@ IK_DoF
Entité de maillage de genre degre de liberte.
@ IK_Edge
Entité de maillage de genre arête.
std::int32_t Int32
Type entier signé sur 32 bits.