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) {}
55 Int64 uniqueId()
const {
return m_cell_uid; }
57 Int32 owner()
const {
return m_owner; }
58 Integer nbNode()
const {
return m_info.size(); }
59 Integer nbFace()
const {
return m_type_info->nbLocalFace(); }
60 Integer nbEdge()
const {
return m_type_info->nbLocalEdge(); }
61 Int64 nodeUniqueId(
Integer i_node)
const {
return m_info[i_node]; }
66 bool allowBuildFace()
const {
return m_allow_build_face; }
67 bool allowBuildEdge()
const {
return m_allow_build_face; }
72 Int64 m_cell_uid = NULL_ITEM_UNIQUE_ID;
74 Int32 m_owner = A_NULL_RANK;
75 bool m_allow_build_face =
false;
84, m_mesh(mesh_builder->
mesh())
85, m_mesh_builder(mesh_builder)
86, m_cell_family(m_mesh->trueCellFamily())
87, m_node_family(m_mesh->trueNodeFamily())
88, m_face_family(m_mesh->trueFaceFamily())
89, m_edge_family(m_mesh->trueEdgeFamily())
90, m_item_type_mng(m_mesh->itemTypeMng())
94 m_work_face_orig_nodes_uid.reserve(100);
104 ItemInternal* node = m_node_family.findOrAllocOne(node_uid,is_add);
126 if (item.
nbNode()!=nb_node)
127 ARCANE_FATAL(
"Trying to add existing item (kind='{0}', uid={1}) with different number of node (existing={2} new={3})",
131 for(
Int32 i=0; i<nb_node; ++i ){
132 Int64 new_uid = nodes_uid[i];
134 if (new_uid != current_uid){
135 std::ostringstream ostr;
136 for(
Int32 k=0; k<nb_node; ++k )
138 ARCANE_FATAL(
"Trying to add existing item (kind='{0}', uid={1}) with different nodes (index={2} existing='{3}' new='{4}')",
139 item.
kind(), item.
uniqueId(), i, ostr.str(), nodes_uid);
154 if (uid!=NULL_ITEM_UNIQUE_ID)
183 m_work_face_orig_nodes_uid.resize(face_nb_node);
184 for(
Integer z=0; z<face_nb_node; ++z )
185 m_work_face_orig_nodes_uid[z] = nodes_uid[z];
191 bool is_add_face =
false;
192 Face face = m_face_family.findOrAllocOne(face_uid,type_id,is_add_face);
197 for(
Integer i_node=0; i_node<face_nb_node; ++i_node ){
199 m_face_family.replaceNode(face,i_node,node);
200 m_node_family.addFaceToNode(node, face);
208 return ItemCompatibility::_itemInternal(face);
217 m_work_edge_sorted_nodes.
resize(2);
218 m_work_edge_orig_nodes_uid.
resize(2);
221 m_work_edge_orig_nodes_uid[z] = nodes_uid[z];
225 bool is_add_edge =
false;
232 for(
Integer i_node=0; i_node<2; ++i_node ){
235 m_node_family.addEdgeToNode(current_node_internal, edge);
245Face OneMeshItemAdder::
246_findInternalFace(
Integer i_face,
const FullCellInfo& cell_info,
bool& is_add)
248 const Int64 face_unique_id = cell_info.faceUniqueId(i_face);
249 ItemTypeInfo* cell_type_info = cell_info.
typeInfo();
250 const ItemTypeInfo::LocalFace& lf = cell_type_info->
localFace(i_face);
251 ItemTypeInfo* face_type_info = m_item_type_mng->typeFromId(lf.typeId());
252 return m_face_family.findOrAllocOne(face_unique_id,face_type_info,is_add);
259Face OneMeshItemAdder::
262 const ItemInternalMap& nodes_map = m_mesh->nodesMap();
263 ItemTypeInfo* cell_type_info = cell_info.typeInfo();
264 const ItemTypeInfo::LocalFace& lf = cell_type_info->localFace(i_face);
267 if (face_internal.null()) {
271 info() <<
"BadCell uid=" << cell_info.uniqueId();
272 for(
Int32 i=0; i<cell_info.nbNode(); ++i )
273 info() <<
"Cell node I=" << i <<
" uid=" << cell_info.nodeUniqueId(i);
274 ARCANE_FATAL(
"On the fly face allocation is not allowed here.\n"
275 " You need to add faces with IMeshModifier::addFaces().\n"
276 " CellUid={0} LocalFace={1} FaceNodes={2}",
279 ItemTypeInfo* face_type = m_item_type_mng->typeFromId(lf.typeId());
282 return m_face_family.allocOne(face_unique_id,face_type);
286 return face_internal;
294Edge OneMeshItemAdder::
295_findInternalEdge(
Integer i_edge,
const FullCellInfo& cell_info,
296 Int64 first_node,
Int64 second_node,
bool& is_add)
298 ARCANE_UNUSED(first_node);
299 ARCANE_UNUSED(second_node);
301 const Int64 edge_unique_id = cell_info.edgeUniqueId(i_edge);
302 return m_edge_family.findOrAllocOne(edge_unique_id,is_add);
309Edge OneMeshItemAdder::
312 ARCANE_UNUSED(i_edge);
314 const ItemInternalMap& nodes_map = m_mesh->nodesMap();
315 Node nbi = nodes_map.findItem(first_node);
317 if (edge_internal.null()){
319 ARCANE_FATAL(
"On the fly edge allocation is not allowed here."
320 " You need to add edges before with IMeshModifier::addEdges()");
323 FixedArray<Int64,2> nodes;
324 nodes[0] = first_node;
325 nodes[1] = second_node;
326 edge_unique_id = MeshUtils::generateHashUniqueId(nodes.view());
329 return m_edge_family.allocOne(edge_unique_id);
333 return edge_internal;
360 bool allow_build_face)
362 CellInfoProxy cell_info_proxy(m_item_type_mng->typeFromId(type_id),cell_uid,sub_domain_id,nodes_uid,allow_build_face);
393 ARCANE_ASSERT(m_mesh->
itemFamilyNetwork(),(
"ItemFamilyNetwork is required to call OneMeshItemAdder::addOneItem"));
394 bool is_alloc =
true;
395 Item item = family_modifier->findOrAllocOne(item_uid,type_id,
m_mesh_info,is_alloc);
399 for (
Integer family_index = 0; family_index < nb_connected_family; ++family_index){
405 String connectivity_name = mesh::connectivityName(family,connected_family);
406 String reverse_connectivity_name = mesh::connectivityName(connected_family,family);
407 bool is_dependency =
false;
412 if(!is_dependency) _clearConnectivity(
ItemLocalId(item), family_to_connected_family);
413 if (connected_family_to_family) _clearReverseConnectivity(
ItemLocalId(item),family_to_connected_family,connected_family_to_family);
418 for (
Integer connected_item_index = 0; connected_item_index < nb_connected_item; ++connected_item_index){
419 if (family_to_connected_family) {
424 if (connected_family_to_family)
425 connected_family_to_family->
addConnectedItem(ItemLocalId(connected_item_lids[connected_item_index]),ItemLocalId(item));
427 info_index+= nb_connected_item;
431 return ItemCompatibility::_itemInternal(item);
436ItemInternal* OneMeshItemAdder::
437addOneItem2(IItemFamily* family,
438 IItemFamilyModifier* family_modifier,
446 ARCANE_ASSERT(m_mesh->itemFamilyNetwork(),(
"ItemFamilyNetwork is required to call OneMeshItemAdder::addOneItem"));
447 bool is_alloc =
true;
448 Item item = family_modifier->findOrAllocOne(item_uid,type_id,
m_mesh_info,is_alloc);
452 for (
Integer family_index = 0; family_index < nb_connected_family; ++family_index) {
457 if (nb_connected_item == 0)
continue;
458 IItemFamily* connected_family = nullptr ;
461 connected_family = m_mesh->findItemFamily(family_kind, ParticleFamily::defaultFamilyName(),
false,
false);
464 if(family->name()==GraphDoFs::dualNodeFamilyName())
465 connected_family = m_mesh->findItemFamily(family_kind, GraphDoFs::linkFamilyName(),
false,
false);
467 connected_family = m_mesh->findItemFamily(family_kind, GraphDoFs::dualNodeFamilyName(),
false,
false);
470 connected_family = m_mesh->itemFamily(family_kind);
474 String connectivity_name = mesh::connectivityName(family,connected_family);
475 bool is_dependency =
false;
476 IIncrementalItemConnectivity* family_to_connected_family = m_mesh->itemFamilyNetwork()->getConnectivity(family,connected_family,connectivity_name,is_dependency);
477 if (!family_to_connected_family)
478 ARCANE_FATAL(
"Cannot find connectivity name={0}",connectivity_name);
479 bool is_deep_connectivity = m_mesh->itemFamilyNetwork()->isDeep(family_to_connected_family) ;
480 bool is_relation = !(is_dependency && is_deep_connectivity);
484 bool do_fatal = is_relation ? false :
true;
485 connected_family->itemsUniqueIdToLocalId(connected_item_lids,connectivity_info.subView(info_index,nb_connected_item),do_fatal);
487 Integer nb_connected_item_found = nb_connected_item;
490 for (
Integer index = 0; index < connected_item_lids.size(); )
492 if (connected_item_lids[index] == NULL_ITEM_LOCAL_ID) {
493 connected_item_lids.remove(index);
494 --nb_connected_item_found;
499 for (
Integer connected_item_index = 0; connected_item_index < nb_connected_item_found; ++connected_item_index)
501 if (family_to_connected_family)
504 auto connected_item_lid = ItemLocalId{connected_item_lids[connected_item_index]};
507 if (!family_to_connected_family->hasConnectedItem(ItemLocalId(item),connected_item_lid))
509 family_to_connected_family->addConnectedItem(ItemLocalId(item),connected_item_lid);
514 family_to_connected_family->replaceConnectedItem(ItemLocalId(item),connected_item_index,connected_item_lid);
518 info_index+= nb_connected_item;
521 debug(
Trace::Highest) <<
"[addItems] ADD_ITEM " << ItemPrinter(item) <<
" in " << family->name();
524 return ItemCompatibility::_itemInternal(item);
529void OneMeshItemAdder::
530_printRelations(ItemInternal* item)
532 debug(
Trace::Highest) <<
"[addItems] RELATIONS for " << ItemPrinter(item) <<
" in " << item->family()->name();
533 for (
const auto& relation : m_mesh->itemFamilyNetwork()->getChildRelations(item->family())) {
536 ConnectivityItemVector connected_items(relation);
537 for (
const auto& connected_item : connected_items.connectedItems(ItemLocalId(item))) {
546void OneMeshItemAdder::
547_clearConnectivity(ItemLocalId item, IIncrementalItemConnectivity* connectivity)
550 ConnectivityItemVector accessor(connectivity);
552 connectivity->removeConnectedItem(item,connected_item);
559void OneMeshItemAdder::
560_clearReverseConnectivity(ItemLocalId item, IIncrementalItemConnectivity* connectivity, IIncrementalItemConnectivity* reverse_connectivity)
562 ConnectivityItemVector accessor(connectivity);
564 reverse_connectivity->removeConnectedItem(connected_item,item);
571template<>
void OneMeshItemAdder::
575 if(m_mesh->isAmrActivated()){
578 if(cell_info.
level() != 0){
579 Integer child_rank = cell_info.whichChildAmI();
580 Int64 hParent_uid = cell_info.hParentCellUniqueId();
583 Cell hParent_cell= m_cell_family.findOrAllocOne(hParent_uid,cell_type,is_add);
584 m_cell_family._addParentCellToCell(new_cell,hParent_cell);
585 m_cell_family._addChildCellToCell(hParent_cell,child_rank,new_cell);
590template<>
void OneMeshItemAdder::
591_AMR_Patch(
Cell cell,
const CellInfoProxy& cell_info)
594 ARCANE_UNUSED(cell_info);
604template<
typename CellInfo>
616 inew_cell = m_cell_family.findOrAllocOne(cell_info.uniqueId(),cell_type_id,is_add);
619 Cell cell2(inew_cell);
621 for(
Integer i=0, is=cell_info.nbNode(); i<is; ++i )
622 if (cell_info.nodeUniqueId(i)!=cell2.
node(i).
uniqueId())
623 ARCANE_FATAL(
"trying to add existing cell (uid={0}) with different nodes",
624 cell_info.uniqueId());
626 return ItemCompatibility::_itemInternal(inew_cell);
630 const bool is_verbose =
false;
632 Cell new_cell(inew_cell);
636 const bool allow_multi_dim_cell = m_mesh->meshKind().isNonManifold();
637 const Int32 cell_nb_face = cell_info.nbFace();
642 if (cell_info.nbNode()!=inew_cell.
nbNode())
643 ARCANE_FATAL(
"Incoherent number of nodes v={0} expected={1}",inew_cell.
nbNode(),cell_info.nbNode());
644 if (cell_nb_face!=inew_cell.
nbFace())
645 ARCANE_FATAL(
"Incoherent number of faces v={0} expected={1}",inew_cell.
nbFace(),cell_nb_face);
647 ARCANE_FATAL(
"Type '{0}' is not allowed for 'Cell' (cell_uid={1})",
648 cell_type_info->
typeName(),cell_info.uniqueId());
649 if (!allow_multi_dim_cell){
651 Int32 mesh_dimension = m_mesh->dimension();
652 if (cell_dimension>=0 && cell_dimension!=mesh_dimension)
653 ARCANE_FATAL(
"Incoherent dimension for cell uid={0} cell_dim={1} mesh_dim={2} type={3}",
654 cell_info.uniqueId(),cell_dimension,mesh_dimension,cell_type_info->
typeName());
663 if (m_mesh_builder->hasEdge()) {
664 const Int32 cell_nb_edge = cell_info.nbEdge();
666 for(
Integer i_edge=0; i_edge<cell_nb_edge; ++i_edge ){
669 Int64 second_node = cell_info.nodeUniqueId( le.
endNode() );
670 if (first_node > second_node)
671 std::swap(first_node,second_node);
674 Edge edge_internal = _findInternalEdge(i_edge, cell_info, first_node, second_node, is_add);
682 m_edge_family.replaceNode(
ItemLocalId(edge_internal), 0, current_node);
683 m_node_family.addEdgeToNode(current_node, edge_internal);
687 m_edge_family.replaceNode(
ItemLocalId(edge_internal), 1, current_node);
688 m_node_family.addEdgeToNode(current_node, edge_internal);
694 m_edge_family.addCellToEdge(edge_internal,inew_cell);
699 for(
Integer i_face=0; i_face<cell_nb_face; ++i_face ){
702 const bool is_reorder = _isReorder(i_face, lf, cell_info);
706 Face face = _findInternalFace(i_face, cell_info, is_add);
710 info() <<
"AddCell (uid=" << new_cell.
uniqueId() <<
": Create face (index=" << i_face
716 for(
Integer i_node=0; i_node<face_nb_node; ++i_node ){
718 m_face_family.replaceNode(face, i_node, current_node);
719 m_node_family.addFaceToNode(current_node, face);
722 if (m_mesh_builder->hasEdge()) {
724 for(
Integer i_edge=0; i_edge<face_nb_edge; ++i_edge ){
726 m_face_family.addEdgeToFace(face,current_edge);
727 m_edge_family.addFaceToEdge(current_edge,face);
732 m_cell_family.replaceFace(new_cell,i_face,face);
735 if(m_mesh->isAmrActivated()){
738 m_face_family.replaceFrontCellToFace(face,new_cell);
740 m_face_family.addFrontCellToFace(face,inew_cell);
743 m_face_family.replaceBackCellToFace(face,new_cell);
745 m_face_family.addBackCellToFace(face,inew_cell);
749 m_face_family.addFrontCellToFace(face,inew_cell);
751 m_face_family.addBackCellToFace(face,inew_cell);
756 _AMR_Patch(inew_cell, cell_info);
757 return ItemCompatibility::_itemInternal(inew_cell);
786 if (item.
type() == IT_Line2 && submesh_kind ==
IK_Cell)
788 if (item.
type() == IT_Vertex && submesh_kind ==
IK_Face)
799 switch (submesh_kind) {
801 new_item = m_node_family.findOrAllocOne(item.
uniqueId(),is_add);
805 new_item = m_edge_family.findOrAllocOne(item.
uniqueId(),is_add);
809 new_item = m_face_family.findOrAllocOne(item.
uniqueId(),
type,is_add);
815 new_item = m_cell_family.findOrAllocOne(item.
uniqueId(),type_id,is_add);
823 if (fatal_on_existing_item)
824 ARCANE_FATAL(
"Cannot add already existing parent item in submesh");
826 return ItemCompatibility::_itemInternal(new_item);
838 switch (submesh_kind) {
840 item_nb_face =
type->nbLocalFace();
841 item_nb_edge =
type->nbLocalEdge();
842 item_nb_node =
type->nbLocalNode();
845 item_nb_edge =
type->nbLocalEdge();
846 item_nb_node =
type->nbLocalNode();
849 item_nb_node =
type->nbLocalNode();
855 if (!m_mesh_builder->hasEdge())
861 for(
Integer z=0; z<item_nb_face; ++z )
862 new_item->_setFace(z,NULL_ITEM_ID);
863 for(
Integer z=0; z<item_nb_edge; ++z )
864 new_item->_setEdge(z,NULL_ITEM_ID);
865 for(
Integer z=0; z<item_nb_node; ++z )
866 new_item->_setNode(z,NULL_ITEM_ID);
871 DynamicMeshKindInfos::ItemInternalMap& nodes_map = m_mesh->nodesMap();
873 DynamicMeshKindInfos::ItemInternalMap& parent_nodes_map = parent_mesh->nodesMap();
878 const bool direct_node_order =
881 && !(item.
toFace().isSubDomainBoundaryOutside()));
884 for(
Integer i_node=0; i_node<item_nb_node; ++i_node ){
886 if (
type->typeId() == IT_FaceVertex)
889 Int32 idx = ((direct_node_order) ? i_node : (item_nb_node-1-i_node));
892 Int64 new_node_uid = nodes_uid[i_node] = parent_item.
uniqueId();
893 ItemInternal* node_internal = m_node_family.findOrAllocOne(new_node_uid,is_add);
895#ifdef ARCANE_DEBUG_DYNAMIC_MESH
896 info() <<
"Création node " << new_node_uid <<
' '
907 switch (submesh_kind) {
909 m_cell_family.replaceNode(new_item_lid,i_node, node_lid);
910 m_node_family.addCellToNode(node_internal, new_item.
toCell());
913 m_face_family.replaceNode(new_item_lid,i_node, node_lid);
914 m_node_family.addFaceToNode(node_internal, new_item.
toFace());
917 m_edge_family.replaceNode(new_item_lid,i_node, node_lid);
918 m_node_family.addEdgeToNode(node_internal, new_item.
toEdge());
926 for(
Integer i_edge=0; i_edge<item_nb_edge; ++i_edge ) {
931 if (first_node > second_node)
932 std::swap(first_node,second_node);
935 if (parent_item.
null())
940 ItemInternal* edge_internal = m_edge_family.findOrAllocOne(new_edge_uid,is_add);
942#ifdef ARCANE_DEBUG_DYNAMIC_MESH
943 info() <<
"Création edge " << new_edge_uid <<
' '
951 m_edge_family.replaceNode(
ItemLocalId(edge_internal), 0, current_node);
952 m_node_family.addEdgeToNode(current_node, edge_internal);
956 m_edge_family.replaceNode(
ItemLocalId(edge_internal), 1, current_node);
957 m_node_family.addEdgeToNode(current_node, edge_internal);
964 switch (submesh_kind) {
967 m_edge_family.addCellToEdge(edge_internal, new_item.
toCell());
971 m_edge_family.addFaceToEdge(edge_internal, new_item.
toFace());
980 for(
Integer i_face=0; i_face<item_nb_face; ++i_face ) {
985 m_work_face_orig_nodes_uid.resize(face_nb_node);
986 for(
Integer z=0; z<face_nb_node; ++z )
987 m_work_face_orig_nodes_uid[z] = nodes_uid[ lf.
node(z) ];
988 bool is_reorder =
false;
989 if (m_mesh->dimension() == 1) {
990 is_reorder = (i_face==1);
1002 if (m_mesh->dimension() == 1) {
1008 if (first_node > second_node)
1009 std::swap(first_node,second_node);
1015 if (parent_item.
null())
1020 ItemInternal* face_internal = m_face_family.findOrAllocOne(new_face_uid,face_type,is_add);
1022#ifdef ARCANE_DEBUG_DYNAMIC_MESH
1023 info() <<
"Création face " << new_face_uid <<
' '
1029 for(
Integer i_node=0; i_node<face_nb_node; ++i_node ){
1031 m_face_family.replaceNode(
ItemLocalId(face_internal), i_node, current_node);
1032 m_node_family.addFaceToNode(current_node, face_internal);
1035 if (m_mesh_builder->hasEdge()) {
1037 for(
Integer i_edge=0; i_edge<face_nb_edge; ++i_edge ){
1039 Edge current_edge = new_item.
itemBase().edgeBase(edge_idx);
1040 m_face_family.addEdgeToFace(face_internal,current_edge);
1041 m_edge_family.addFaceToEdge(current_edge,face_internal);
1048 m_face_family.addFrontCellToFace(face_internal,new_item.
toCell());
1050 m_face_family.addBackCellToFace(face_internal,new_item.
toCell());
1054 return ItemCompatibility::_itemInternal(new_item);
1062template<
typename CellInfo>
1066 Integer cell_nb_node = cell_info.nbNode();
1069 for(
Integer i_node=0; i_node<cell_nb_node; ++i_node ){
1070 Int64 node_unique_id = cell_info.nodeUniqueId(i_node);
1071 bool is_add =
false;
1072 ItemInternal* node_internal = m_node_family.findOrAllocOne(node_unique_id,is_add);
1077 m_node_family.addCellToNode(node_internal,cell);
1078 m_cell_family.replaceNode(cell,i_node,
ItemLocalId(node_internal));
1085template<
typename CellInfo>
1086bool OneMeshItemAdder::
1091 m_work_face_orig_nodes_uid.
resize(face_nb_node);
1092 for(
Integer i_node=0; i_node < face_nb_node; ++i_node)
1093 m_work_face_orig_nodes_uid[i_node] = cell_info.nodeUniqueId(lf.
node(i_node));
1094 bool is_reorder =
false;
1096 is_reorder = (i_face==1);
1125 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.
Int16 dimension() const
Dimension de l'élément (<0 si inconnu)
String typeName() const
Nom du type.
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 de 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.
eItemKind kind() const
Genre de l'entité
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é.
Int16 type() const
Type de l'entité
static eItemKind kindTranspose(eItemKind kindA, IMesh *meshA, IMesh *meshB)
Transpose le genre kindA du maillage meshA en le genre associé dans meshB.
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)
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 d'un maillage de manière incrémentale.
Implémentation d'un maillage.
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
Récupère ou alloue une arête de numéro unique uid et de type type.Ajout générique d'item.
void replaceNode(ItemLocalId edge, Integer index, ItemLocalId node)
Remplace le noeud d'index index de l'arête edge avec celui de localId() node_lid.
Infos pour créer/sérialiser une maille connaissant les uniqueId() et owner() de toutes ces sous-entit...
Integer level() const
AMR.
Tableau associatif de ItemInternal.
impl::ItemBase findItem(Int64 uid) const
Retourne l'entité de numéro unique uid.
Int32 rank() const
Numéro de ce sous-domaine.
Integer & nbEdge()
Nombre d'arêtes dans le maillage.
Integer & nbNode()
Nombre de noeuds dans le maillage.
UniqueArray< Int64 > m_work_face_sorted_nodes
Tableaux de travail.
void _checkSameItemCoherency(ItemWithNodes item, ConstArrayView< Int64 > nodes_uid)
Vérifie la cohérence des noeuds d'une entité ajouté déjà présente.
void _addNodesToCell(Cell cell, const CellInfo &cell_info)
Ajoute les noeuds nodes_uid à la maille cell.
ItemInternal * _addOneCell(const CellInfo &cell_info)
Ajoute une maille.
ItemInternal * addOneCell(ItemTypeId type_id, Int64 cell_uid, Int32 sub_domain_id, Int64ConstArrayView nodes_uid, bool allow_build_face)
Ajoute une maille.
MeshInfos m_mesh_info
Info générale sur le maillage (numéro de sous-domaine, nombre d'items...)
Int64 _checkGenerateFaceUniqueId(Int64 uid, ConstArrayView< Int64 > nodes_uid)
Génère un uniqueId() pour la face si uid est nul.
Int64 m_next_edge_uid
Numéro du uniqueId() suivant utilisé pour générer les arêtes.
void setUseNodeUniqueIdToGenerateEdgeAndFaceUniqueId(bool v)
Positionne le mécanisme de numérotation des uniqueId().
void resetAfterDeallocate()
Remise à zéro des structures pour pouvoir faire à nouveau une allocation.
bool m_use_hash_for_edge_and_face_unique_id
Si vrai, génère les uniqueId() des faces à partir de ceux des noeuds.
Int64 m_next_face_uid
Numéro du uniqueId() suivant utilisé pour générer les faces.
ItemInternal * addOneParentItem(const Item &item, const eItemKind submesh_kind, const bool fatal_on_existing_item=true)
Ajoute d'un item parent.
ItemInternal * addOneFace(ItemTypeId type_id, Int64 face_uid, Int32 owner_rank, Int64ConstArrayView nodes_uid)
Ajoute une face.
Int32 toInt32(Int64 v)
Converti un Int64 en un Int32.
@ 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.