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 return m_node_connectivity->trueCustomConnectivity();
231faceConnectivity()
const
233 return m_face_connectivity->trueCustomConnectivity();
239IncrementalItemConnectivity* EdgeFamily::
240cellConnectivity()
const
242 return m_cell_connectivity->trueCustomConnectivity();
251 m_item_internal_list->edges = _itemsInternal();
253 m_item_internal_list->edges = _itemsInternal();
262 if (!Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_EdgeToNode))
264 m_node_connectivity->replaceItem(edge, index, node);
273 if (!Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_EdgeToCell))
275 _checkValidSourceTargetItems(edge, new_cell);
285 if (!Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_EdgeToFace))
287 _checkValidSourceTargetItems(edge, new_face);
294inline void EdgeFamily::
295_removeEdge(
Edge edge)
312 if (!Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_EdgeToCell))
314 _checkValidItem(edge);
315 m_cell_connectivity->removeConnectedItem(
ItemLocalId(edge), cell_to_remove_lid);
324 if (!Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_EdgeToFace))
326 m_face_connectivity->removeConnectedItem(edge, face_to_remove);
335 _checkValidItem(edge);
347 m_mesh_connectivity = c;
348 m_has_edge = Connectivity::hasConnectivity(m_mesh_connectivity, Connectivity::CT_HasEdge);
350 m_node_prealloc = Connectivity::getPrealloc(m_mesh_connectivity,
IK_Edge,
IK_Node);
351 m_face_prealloc = Connectivity::getPrealloc(m_mesh_connectivity,
IK_Edge,
IK_Face);
352 m_cell_prealloc = Connectivity::getPrealloc(m_mesh_connectivity,
IK_Edge,
IK_Cell);
354 debug() <<
"Family " <<
name() <<
" prealloc "
355 << m_node_prealloc <<
" by node, "
356 << m_face_prealloc <<
" by face, "
357 << m_cell_prealloc <<
" by cell.";
364reorientEdgesIfNeeded()
378 if (edge_type == ITI_Line2 || edge_type == ITI_Line3) {
379 new_nodes_lid.
resize(nb_node);
380 for (
Int32 i = 0; i < nb_node; ++i)
381 new_nodes_lid[i] = edge.
nodeId(i);
385 std::swap(new_nodes_lid[0], new_nodes_lid[1]);
390 ARCANE_FATAL(
"Reorientation of edge of type '{0}' not yet supported", edge_type);
392 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 allocateItemsBulk(Int64ConstArrayView uids, Int32 owner, Int32ArrayView lids)
Allocates every edge of uids at once, in one pass per family array.
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.
IncrementalItemConnectivity * nodeConnectivity() const
The true connectivity behind the selector, for a bulk fill.
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.
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.
void _allocateInfosBulk(Int64ConstArrayView uids, ItemTypeInfo *type, Int32 owner, Int32ArrayView lids)
Allocates every item of uids at once.
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.
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
@ 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.