14#include "arcane/mesh/EdgeFamily.h"
16#include "arcane/utils/FatalErrorException.h"
18#include "arcane/core/IMesh.h"
21#include "arcane/core/ItemPrinter.h"
22#include "arcane/core/Connectivity.h"
23#include "arcane/core/NodesOfItemReorderer.h"
25#include "arcane/mesh/NodeFamily.h"
26#include "arcane/mesh/CompactIncrementalItemConnectivity.h"
27#include "arcane/mesh/ItemConnectivitySelector.h"
28#include "arcane/mesh/AbstractItemFamilyTopologyModifier.h"
29#include "arcane/mesh/NewWithLegacyConnectivity.h"
41:
public AbstractItemFamilyTopologyModifier
45 TopologyModifier(EdgeFamily* f)
46 : AbstractItemFamilyTopologyModifier(f)
54 m_true_family->replaceNode(item_lid, index, new_lid);
59 EdgeFamily* m_true_family;
69 _setTopologyModifier(
new TopologyModifier(
this));
88 m_edge_type = itm->typeFromId(IT_Line2);
94 m_node_connectivity =
dynamic_cast<NewWithLegacyConnectivityType<EdgeFamily, NodeFamily>::type*
>(m_mesh->
itemFamilyNetwork()->getConnectivity(
this,
mesh()->nodeFamily(), connectivityName(
this,
mesh()->nodeFamily())));
95 m_face_connectivity =
dynamic_cast<NewWithLegacyConnectivityType<EdgeFamily, FaceFamily>::type*
>(m_mesh->
itemFamilyNetwork()->getConnectivity(
this,
mesh()->faceFamily(), connectivityName(
this,
mesh()->faceFamily())));
96 m_cell_connectivity =
dynamic_cast<NewWithLegacyConnectivityType<EdgeFamily, CellFamily>::type*
>(m_mesh->
itemFamilyNetwork()->getConnectivity(
this,
mesh()->cellFamily(), connectivityName(
this,
mesh()->cellFamily())));
99 m_node_connectivity =
new NodeConnectivity(
this,
mesh()->nodeFamily(),
"EdgeNode");
100 m_face_connectivity =
new FaceConnectivity(
this,
mesh()->faceFamily(),
"EdgeFace");
101 m_cell_connectivity =
new CellConnectivity(
this,
mesh()->cellFamily(),
"EdgeCell");
104 _addConnectivitySelector(m_node_connectivity);
105 _addConnectivitySelector(m_face_connectivity);
106 _addConnectivitySelector(m_cell_connectivity);
108 _buildConnectivitySelectors();
114inline void EdgeFamily::
115_createOne(ItemInternal* item,
Int64 uid)
117 m_item_internal_list->edges = _itemsInternal();
118 _allocateInfos(item, uid, m_edge_type);
119 auto nc = m_node_connectivity->trueCustomConnectivity();
121 nc->addConnectedItems(ItemLocalId(item), 2);
135 ARCANE_ASSERT((type_id == IT_Line2), (
""));
136 ARCANE_UNUSED(type_id);
150 _createOne(item, uid);
169 ARCANE_ASSERT((type_id == IT_Line2), (
""));
170 ARCANE_UNUSED(type_id);
190 _createOne(item, uid);
201 this->_preAllocate(nb_item,
true);
211 debug() <<
"Creating the list of ghosts edges";
224 if (!Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_EdgeToNode))
226 m_node_connectivity->replaceItem(edge, index, node);
235 if (!Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_EdgeToCell))
237 _checkValidSourceTargetItems(edge, new_cell);
247 if (!Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_EdgeToFace))
249 _checkValidSourceTargetItems(edge, new_face);
256inline void EdgeFamily::
257_removeEdge(
Edge edge)
274 if (!Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_EdgeToCell))
276 _checkValidItem(edge);
277 m_cell_connectivity->removeConnectedItem(
ItemLocalId(edge), cell_to_remove_lid);
286 if (!Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_EdgeToFace))
288 m_face_connectivity->removeConnectedItem(edge, face_to_remove);
297 _checkValidItem(edge);
309 m_mesh_connectivity = c;
310 m_has_edge = Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_HasEdge);
312 m_node_prealloc = Connectivity::getPrealloc(m_mesh_connectivity,
IK_Edge,
IK_Node);
313 m_face_prealloc = Connectivity::getPrealloc(m_mesh_connectivity,
IK_Edge,
IK_Face);
314 m_cell_prealloc = Connectivity::getPrealloc(m_mesh_connectivity,
IK_Edge,
IK_Cell);
316 debug() <<
"Family " <<
name() <<
" prealloc "
317 << m_node_prealloc <<
" by node, "
318 << m_face_prealloc <<
" by face, "
319 << m_cell_prealloc <<
" by cell.";
326reorientEdgesIfNeeded()
340 if (edge_type == ITI_Line2 || edge_type == ITI_Line3) {
341 new_nodes_lid.
resize(nb_node);
342 for (
Int32 i = 0; i < nb_node; ++i)
343 new_nodes_lid[i] = edge.
nodeId(i);
347 std::swap(new_nodes_lid[0], new_nodes_lid[1]);
352 ARCANE_FATAL(
"Reorientation of edge of type '{0}' not yet supported", edge_type);
354 info() <<
"End Edge Reorientation";
#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_FATAL(...)
Macro throwing a FatalErrorException.
Utility functions for the mesh.
void resize(Int64 s)
Changes the number of elements in the array to s.
Int32 nbNode() const
Number of vertices of the edge.
Int32 nbCell() const
Number of cells connected to the edge.
virtual IItemFamily * nodeFamily()=0
Returns the node family.
virtual bool useMeshItemFamilyDependencies() const =0
check if the network itemFamily dependencies is activated
virtual ItemTypeMng * itemTypeMng() const =0
Associated entity type manager.
virtual IItemFamilyNetwork * itemFamilyNetwork()=0
Family network interface (connected families).
bool isSuppressed() const
True if the entity is suppressed.
Internal structure of a mesh entity.
Index of an Item in a variable.
Type of an entity (Item).
NodeLocalId nodeId(Int32 index) const
i-th node of the entity.
Node node(Int32 i) const
i-th node of the entity
NodeConnectedListViewType nodes() const
List of nodes of the entity.
Base class for a mesh element.
ItemUniqueId uniqueId() const
Unique identifier across all domains.
ItemTypeId itemTypeId() const
Entity type.
impl::ItemBase itemBase() const
Internal part of the entity.
Utility class to reorder the nodes of an entity.
1D data array with pre-allocated stack buffer.
Unicode character string.
TraceMessageDbg debug(Trace::eDebugLevel=Trace::Medium) const
Flow for a debug message.
TraceMessage info() const
Flow for an information message.
void replaceNode(ItemLocalId item_lid, Integer index, ItemLocalId new_lid) override
Replaces a node of an entity.
void removeCellFromEdge(Edge edge, ItemLocalId cell_to_remove_lid)
Removes a cell from an edge.
virtual void computeSynchronizeInfos() override
Constructs the structures necessary for synchronization.
void removeFaceFromEdge(ItemLocalId edge, ItemLocalId face_to_remove)
Removes a face from an edge.
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 setConnectivity(const Integer c)
Sets the active connectivity for the associated mesh.
NodeFamily * m_node_family
Node family associated with this family.
void removeEdgeIfNotConnected(Edge edge)
Removes the edge if it is no longer connected.
void addFaceToEdge(Edge edge, Face new_face)
Adds a neighboring face to an edge.
void replaceNode(ItemLocalId edge, Integer index, ItemLocalId node)
Replaces the node at index index of the edge edge with * that of localId() node_lid.
Item allocOne(Int64 uid, ItemTypeId type_id, MeshInfos &mesh_info) override
Version called in generic item addition.
void addCellToEdge(Edge edge, Cell new_cell)
Adds a neighboring cell to an edge.
Incremental item->item[] connectivity.
void replaceConnectedItems(ItemLocalId source_item, Int32ConstArrayView target_local_ids) override
Replaces the entities of source_item with the entities with localId() target_local_ids.
IMesh * mesh() const override
Associated mesh.
String fullName() const override
Full family name (with the mesh's name).
ItemGroup allItems() const override
Group of all entities.
void computeSynchronizeInfos() override
Constructs the structures necessary for synchronization.
String name() const override
Family name.
Class containing mesh information.
Integer & nbEdge()
Number of edges in the mesh.
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
@ IK_Node
Node mesh entity.
@ IK_Cell
Cell mesh entity.
@ IK_Face
Face mesh entity.
@ IK_Edge
Edge mesh entity.
std::int32_t Int32
Signed integer type of 32 bits.