Arcane  4.2.3.0
Developer documentation
Loading...
Searching...
No Matches
CellFamily.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/* CellFamily.h (C) 2000-2024 */
9/* */
10/* Cell Family. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MESH_CELLFAMILY_H
13#define ARCANE_MESH_CELLFAMILY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/IItemFamilyModifier.h"
18
19#include "arcane/mesh/ItemFamily.h"
20#include "arcane/mesh/ItemInternalConnectivityIndex.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane::mesh
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31class NodeFamily;
32class EdgeFamily;
33class FaceFamily;
34class CellFamily;
35class HParentCellCompactIncrementalItemConnectivity;
36class HChildCellCompactIncrementalItemConnectivity;
37
38/*---------------------------------------------------------------------------*/
39/*---------------------------------------------------------------------------*/
40
44class ARCANE_MESH_EXPORT CellFamily
45: public ItemFamily
47{
48 class TopologyModifier;
54
55 public:
56
57 CellFamily(IMesh* mesh, const String& name);
58 virtual ~CellFamily(); //<! Releases resources
59
60 public:
61
62 virtual void build() override;
65 IncrementalItemConnectivity* edgeConnectivity() const;
66 IncrementalItemConnectivity* faceConnectivity() const;
67
70
71 virtual void preAllocate(Integer nb_item);
72
73 public:
74
75 // IItemFamilyModifier interface
76 Item allocOne(Int64 uid, ItemTypeId type_id, MeshInfos& mesh_info) override;
77 Item findOrAllocOne(Int64 uid, ItemTypeId type_id, MeshInfos& mesh_info, bool& is_alloc) override;
78 IItemFamily* family() override { return this; }
79
81 Cell findOrAllocOne(Int64 uid, ItemTypeId type_id, bool& is_alloc);
82
88 void removeCell(Cell cell);
89
91 void removeCells(ConstArrayView<Int32> cells_local_id);
92
98 void detachCell(Cell cell);
99
106 void detachCells2(Int32ConstArrayView cell_local_ids);
107
113 void removeDetachedCell(Cell cell);
114
120 virtual void internalRemoveItems(Int32ConstArrayView local_ids, bool keep_ghost = false) override;
121
123
124 void setConnectivity(const Integer c);
125
126 public:
127
128 // TODO: make these methods private to enforce the use of IItemFamilyTopologyModifier.
129 void replaceNode(ItemLocalId cell, Integer index, ItemLocalId node);
130 void replaceEdge(ItemLocalId cell, Integer index, ItemLocalId edge);
131 void replaceFace(ItemLocalId cell, Integer index, ItemLocalId face);
132 void replaceHChild(ItemLocalId cell, Integer index, ItemLocalId child_cell);
133 void replaceHParent(ItemLocalId cell, Integer index, ItemLocalId parent_cell);
134
135 public:
136
138 void _addParentCellToCell(Cell cell, Cell parent_cell);
139 void _addChildCellToCell(Cell parent_cell, Integer rank, Cell child_cell);
140 void _addChildCellToCell2(Cell parent_cell, Cell child_cell);
141 void _addChildrenCellsToCell(Cell parent_cell, Int32ConstArrayView children_cells_lid);
142 void _removeParentCellToCell(Cell cell);
143 void _removeChildCellToCell(Cell parent_cell, Cell cell);
144 void _removeChildrenCellsToCell(Cell parent_cell);
145
146 public:
147
148 virtual void computeSynchronizeInfos() override;
149
150 public:
151
152 ARCANE_DEPRECATED_REASON("Y2022: Use allocOne(Int64 uid,ItemTypeId type) instead")
154
155 ARCANE_DEPRECATED_REASON("Y2022: Use findOrAllocOne(Int64 uid,ItemTypeId type_id,bool& is_alloc) instead")
156 ItemInternal* findOrAllocOne(Int64 uid, ItemTypeInfo* type, bool& is_alloc);
157
158 protected:
159 private:
160
161 Integer m_node_prealloc;
162 Integer m_edge_prealloc;
163 Integer m_face_prealloc;
164 Integer m_mesh_connectivity;
165
166 NodeFamily* m_node_family;
167 EdgeFamily* m_edge_family;
168 FaceFamily* m_face_family;
169
170 NodeConnectivity* m_node_connectivity;
171 EdgeConnectivity* m_edge_connectivity;
172 FaceConnectivity* m_face_connectivity;
173 HParentConnectivity* m_hparent_connectivity;
174 HChildConnectivity* m_hchild_connectivity;
175
176 private:
177
179 void _removeSubItems(Cell cell);
180
182 inline void _createOne(ItemInternal* item, Int64 uid, ItemTypeInfo* type);
183 inline void _createOne(ItemInternal* item, Int64 uid, ItemTypeId type_id);
184};
185
186/*---------------------------------------------------------------------------*/
187/*---------------------------------------------------------------------------*/
188
189} // End namespace Arcane::mesh
190
191/*---------------------------------------------------------------------------*/
192/*---------------------------------------------------------------------------*/
193
194#endif
Cell of a mesh.
Definition Item.h:1300
Constant view of an array of type T.
Interface for modifying a family.
Interface of an entity family.
Definition IItemFamily.h:85
Internal structure of a mesh entity.
Index of an Item in a variable.
Definition ItemLocalId.h:42
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
void _removeSubItems(Cell cell)
Item allocOne(Int64 uid, ItemTypeId type_id, MeshInfos &mesh_info) override
Allocates an element in the family and updates the corresponding mesh_info.
void allocateItemsBulk(Int64ConstArrayView uids, ItemTypeInfo *type, Int32 owner, Int32ArrayView lids)
Allocates every item of uids at once, in one pass per family array.
void detachCells2(Int32ConstArrayView cell_local_ids)
virtual void internalRemoveItems(Int32ConstArrayView local_ids, bool keep_ghost=false) override
void replaceNode(ItemLocalId cell, Integer index, ItemLocalId node)
Replaces the node at index index of the cell cell with that of localId() node.
void removeCell(Cell cell)
void removeCells(ConstArrayView< Int32 > cells_local_id)
Removes the cells whose local numbers are cells_local_id.
void removeDetachedCell(Cell cell)
virtual void computeSynchronizeInfos() override
Constructs the structures necessary for synchronization.
IncrementalItemConnectivity * nodeConnectivity() const
The true connectivity behind the selector, for a bulk fill.
void _removeNotConnectedSubItems(Cell cell)
Removes cell sub-entities that are not connected to any cell.
void _addParentCellToCell(Cell cell, Cell parent_cell)
AMR.
void replaceFace(ItemLocalId cell, Integer index, ItemLocalId face)
Replaces the face at index index of the cell cell with that of localId() face.
void detachCell(Cell cell)
void replaceEdge(ItemLocalId cell, Integer index, ItemLocalId edge)
Replaces the edge at index index of the cell cell with that of localId() edge.
void setConnectivity(const Integer c)
Defines the active connectivity for the associated mesh.
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
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:476
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
Definition UtilsTypes.h:474
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:447
std::int32_t Int32
Signed integer type of 32 bits.