Arcane  4.1.12.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;
63 virtual void preAllocate(Integer nb_item);
64
65 public:
66
67 // IItemFamilyModifier interface
68 Item allocOne(Int64 uid, ItemTypeId type_id, MeshInfos& mesh_info) override;
69 Item findOrAllocOne(Int64 uid, ItemTypeId type_id, MeshInfos& mesh_info, bool& is_alloc) override;
70 IItemFamily* family() override { return this; }
71
73 Cell findOrAllocOne(Int64 uid, ItemTypeId type_id, bool& is_alloc);
74
80 void removeCell(Cell cell);
81
83 void removeCells(ConstArrayView<Int32> cells_local_id);
84
90 void detachCell(Cell cell);
91
98 void detachCells2(Int32ConstArrayView cell_local_ids);
99
105 void removeDetachedCell(Cell cell);
106
112 virtual void internalRemoveItems(Int32ConstArrayView local_ids, bool keep_ghost = false) override;
113
115
116 void setConnectivity(const Integer c);
117
118 public:
119
120 // TODO: make these methods private to enforce the use of IItemFamilyTopologyModifier.
121 void replaceNode(ItemLocalId cell, Integer index, ItemLocalId node);
122 void replaceEdge(ItemLocalId cell, Integer index, ItemLocalId edge);
123 void replaceFace(ItemLocalId cell, Integer index, ItemLocalId face);
124 void replaceHChild(ItemLocalId cell, Integer index, ItemLocalId child_cell);
125 void replaceHParent(ItemLocalId cell, Integer index, ItemLocalId parent_cell);
126
127 public:
128
130 void _addParentCellToCell(Cell cell, Cell parent_cell);
131 void _addChildCellToCell(Cell parent_cell, Integer rank, Cell child_cell);
132 void _addChildCellToCell2(Cell parent_cell, Cell child_cell);
133 void _addChildrenCellsToCell(Cell parent_cell, Int32ConstArrayView children_cells_lid);
134 void _removeParentCellToCell(Cell cell);
135 void _removeChildCellToCell(Cell parent_cell, Cell cell);
136 void _removeChildrenCellsToCell(Cell parent_cell);
137
138 public:
139
140 virtual void computeSynchronizeInfos() override;
141
142 public:
143
144 ARCANE_DEPRECATED_REASON("Y2022: Use allocOne(Int64 uid,ItemTypeId type) instead")
146
147 ARCANE_DEPRECATED_REASON("Y2022: Use findOrAllocOne(Int64 uid,ItemTypeId type_id,bool& is_alloc) instead")
148 ItemInternal* findOrAllocOne(Int64 uid, ItemTypeInfo* type, bool& is_alloc);
149
150 protected:
151 private:
152
153 Integer m_node_prealloc;
154 Integer m_edge_prealloc;
155 Integer m_face_prealloc;
156 Integer m_mesh_connectivity;
157
158 NodeFamily* m_node_family;
159 EdgeFamily* m_edge_family;
160 FaceFamily* m_face_family;
161
162 NodeConnectivity* m_node_connectivity;
163 EdgeConnectivity* m_edge_connectivity;
164 FaceConnectivity* m_face_connectivity;
165 HParentConnectivity* m_hparent_connectivity;
166 HChildConnectivity* m_hchild_connectivity;
167
168 private:
169
171 void _removeSubItems(Cell cell);
172
174 inline void _createOne(ItemInternal* item, Int64 uid, ItemTypeInfo* type);
175 inline void _createOne(ItemInternal* item, Int64 uid, ItemTypeId type_id);
176};
177
178/*---------------------------------------------------------------------------*/
179/*---------------------------------------------------------------------------*/
180
181} // End namespace Arcane::mesh
182
183/*---------------------------------------------------------------------------*/
184/*---------------------------------------------------------------------------*/
185
186#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:83
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 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.
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:482