Arcane  4.2.3.0
Developer documentation
Loading...
Searching...
No Matches
NodeFamily.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* NodeFamily.h (C) 2000-2025 */
9/* */
10/* Node family. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MESH_NODEFAMILY_H
13#define ARCANE_MESH_NODEFAMILY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/IItemFamilyModifier.h"
18
19#include "arcane/mesh/ItemFamily.h"
20#include "arcane/mesh/MeshInfos.h"
21#include "arcane/mesh/ItemInternalConnectivityIndex.h"
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arcane::mesh
27{
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
34class ARCANE_MESH_EXPORT NodeFamily
35: public ItemFamily
37{
38 class ItemCompare2;
39 class ItemCompare3;
40 class TopologyModifier;
41
47
48 public:
49
50 NodeFamily(IMesh* mesh, const String& name);
51 virtual ~NodeFamily(); //<! Releases resources
52
53 public:
54
55 void build() override;
56 void computeSynchronizeInfos() override;
57 void _endAllocate() override;
58
59 public:
60
61 void preAllocate(Integer nb_item);
62
63 public:
64
65 /*---------------------------------------------------------------------------*/
66 /*---------------------------------------------------------------------------*/
74
75 // IItemFamilyModifier interface
76 Item allocOne(Int64 uid, ItemTypeId type_id, MeshInfos& mesh_info) override
77 {
78 ARCANE_ASSERT((type_id == IT_Vertex), ("Creating node with a type not equal to IT_Vertex"));
79 ARCANE_UNUSED(type_id);
80 ++mesh_info.nbNode();
81 return allocOne(uid);
82 }
83
84 ItemInternal* allocOne(Int64 uid)
85 {
86 ItemInternal* item = _allocOne(uid);
87 m_item_internal_list->nodes = _itemsInternal();
88 _allocateInfos(item, uid, m_node_type);
89 return item;
90 }
91
92 // IItemFamilyModifier interface
93 Item findOrAllocOne(Int64 uid, ItemTypeId type_id, MeshInfos& mesh_info, bool& is_alloc) override
94 {
95 ARCANE_ASSERT((type_id == IT_Vertex), ("Creating node with a type not equal to IT_Vertex"));
96 ARCANE_UNUSED(type_id);
97 auto node = findOrAllocOne(uid, is_alloc);
98 if (is_alloc)
99 ++mesh_info.nbNode();
100 return node;
101 }
102
103 ItemInternal* findOrAllocOne(Int64 uid, bool& is_alloc)
104 {
105 ItemInternal* item = _findOrAllocOne(uid, is_alloc);
106 if (is_alloc) {
107 m_item_internal_list->nodes = _itemsInternal();
108 _allocateInfos(item, uid, m_node_type);
109 }
110 return item;
111 }
112
113 // IItemFamilyModifier interface
114 IItemFamily* family() override { return this; }
115
116 void replaceEdge(ItemLocalId node, Integer index, ItemLocalId edge);
117 void replaceFace(ItemLocalId node, Integer index, ItemLocalId face);
118 void replaceCell(ItemLocalId node, Integer index, ItemLocalId cell);
119
121 IncrementalItemConnectivity* edgeConnectivity() const;
122 IncrementalItemConnectivity* cellConnectivity() const;
123 IncrementalItemConnectivity* faceConnectivity() const;
124
126 void allocateItemsBulk(Int64ConstArrayView uids, Int32 owner, Int32ArrayView lids);
127
128 void addCellToNode(Node node, Cell new_cell);
129 void addFaceToNode(Node node, Face new_face);
130 void addEdgeToNode(Node node, Edge new_edge);
131 void removeEdgeFromNode(ItemLocalId node, ItemLocalId edge_to_remove);
132 void removeFaceFromNode(ItemLocalId node, ItemLocalId face_to_remove);
133 void removeCellFromNode(Node node, ItemLocalId cell_to_remove_lid);
135 void removeNodeIfNotConnected(Node node);
136
137 VariableNodeReal3& nodesCoordinates()
138 {
139 ARCANE_ASSERT((m_nodes_coords), ("NodeFamily::nodesCoordinates is available only on primary meshes"));
140 return *m_nodes_coords;
141 }
142
144
145 void setConnectivity(const Integer c);
146
147 void sortInternalReferences();
148
149 void notifyItemsUniqueIdChanged() override;
150
151 void _addChildNodeToNode(Node parent_node, Node child_node);
152 void _addParentNodeToNode(Node parent_node, Node child_node);
153
154 private:
155
157 Integer m_edge_prealloc = 0;
158 Integer m_face_prealloc = 0;
159 Integer m_cell_prealloc = 0;
160 Integer m_mesh_connectivity = 0;
161 bool m_no_face_connectivity = false;
162 VariableNodeReal3* m_nodes_coords = nullptr;
163 EdgeConnectivity* m_edge_connectivity = nullptr;
164 FaceConnectivity* m_face_connectivity = nullptr;
165 CellConnectivity* m_cell_connectivity = nullptr;
166 HParentConnectivity* m_hparent_connectivity = nullptr;
167 HChildConnectivity* m_hchild_connectivity = nullptr;
168
169 FaceFamily* m_face_family = nullptr;
170 EdgeFamily* m_edge_family = nullptr;
173
174 private:
175
176 inline void _removeNode(Node node);
177 void _sortConnectedItems(IItemFamily* family, IncrementalItemConnectivity* connectivity);
178};
179
180/*---------------------------------------------------------------------------*/
181/*---------------------------------------------------------------------------*/
182
183} // End namespace Arcane::mesh
184
185/*---------------------------------------------------------------------------*/
186/*---------------------------------------------------------------------------*/
187
188#endif
Interface for modifying a family.
Interface of an entity family.
Definition IItemFamily.h:85
Internal structure of a mesh entity.
Type of an entity (Item).
Definition ItemTypeId.h:33
Info on a mesh entity type.
Base class for a mesh element.
Definition Item.h:84
Node of a mesh.
Definition Item.h:598
Selection between historical and on-demand connectivities.
IMesh * mesh() const override
Associated mesh.
String name() const override
Family name.
Definition ItemFamily.h:140
Class containing mesh information.
Definition MeshInfos.h:36
Integer & nbNode()
Number of nodes in the mesh.
Definition MeshInfos.h:57
void computeSynchronizeInfos() override
Constructs the structures necessary for synchronization.
Item allocOne(Int64 uid, ItemTypeId type_id, MeshInfos &mesh_info) override
Allocates a face with a unique number uid and type type.
Definition NodeFamily.h:76
ItemTypeInfo * m_node_type
Instance containing the node type.
Definition NodeFamily.h:156
bool m_is_sort_connected_faces_and_edges
Indicates if connected faces and edges are sorted by nodes.
Definition NodeFamily.h:172
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Coordinate type quantity at node.
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.