Arcane  4.2.3.0
Developer documentation
Loading...
Searching...
No Matches
FaceFamily.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/* FaceFamily.h (C) 2000-2024 */
9/* */
10/* Face family. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MESH_FACEFAMILY_H
13#define ARCANE_MESH_FACEFAMILY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/FatalErrorException.h"
18
19#include "arcane/core/IItemFamilyModifier.h"
20
21#include "arcane/mesh/ItemFamily.h"
22#include "arcane/mesh/ItemInternalConnectivityIndex.h"
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane::mesh
28{
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33class EdgeFamily;
34class NodeFamily;
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
50class ARCANE_MESH_EXPORT FaceFamily
51: public ItemFamily
53{
54 class TopologyModifier;
61
62 public:
63
64 FaceFamily(IMesh* mesh, const String& name);
65 virtual ~FaceFamily(); //<! Frees resources
66
67 public:
68
69 void build() override;
78
81 IncrementalItemConnectivity* edgeConnectivity() const;
82 IncrementalItemConnectivity* cellConnectivity() const;
83
86
87 virtual void preAllocate(Integer nb_item);
88
89 public:
90
91 // IItemFamilyModifier Interface
92 Item allocOne(Int64 uid, ItemTypeId type_id, MeshInfos& mesh_info) override;
93 Item findOrAllocOne(Int64 uid, ItemTypeId type_id, MeshInfos& mesh_info, bool& is_alloc) override;
94 IItemFamily* family() override { return this; }
95
96 // TODO: DEPRECATED
98 // TODO: DEPRECATED
99 ItemInternal* findOrAllocOne(Int64 uid, ItemTypeInfo* type, bool& is_alloc);
100
102 Face findOrAllocOne(Int64 uid, ItemTypeId type, bool& is_alloc);
103
104 public:
105
107 void addBackCellToFace(Face face, Cell new_cell);
109 void addFrontCellToFace(Face face, Cell new_cell);
111 void removeCellFromFace(Face face, ItemLocalId cell_to_remove_lid);
113 void addEdgeToFace(Face face, Edge new_edge);
115
116 void removeEdgeFromFace(Face face, Edge edge_to_remove);
119
120 void replaceNode(ItemLocalId face, Integer index, ItemLocalId node);
121 void replaceEdge(ItemLocalId face, Integer index, ItemLocalId edge);
122 void replaceFace(ItemLocalId face, Integer index, ItemLocalId face2);
123 void replaceCell(ItemLocalId face, Integer index, ItemLocalId cell);
124
125 void setBackAndFrontCells(Face face, Int32 back_cell_lid, Int32 front_cell_lid);
126
128 void replaceBackCellToFace(Face face, ItemLocalId new_cell);
129 void replaceFrontCellToFace(Face face, ItemLocalId new_cell);
130 void addBackFrontCellsFromParentFace(Face subface, Face face);
131 void replaceBackFrontCellsFromParentFace(Cell subcell, Face subface, Cell cell, Face face);
132 bool isSubFaceInFace(Face subface, Face face) const;
133 bool isChildOnFace(ItemWithNodes child, Face face) const;
134 void subFaces(Face face, Array<ItemInternal*>& subfaces);
135 void allSubFaces(Face face, Array<ItemInternal*>& subfaces);
136 void activeSubFaces(Face face, Array<ItemInternal*>& subfaces);
137 void familyTree(Array<ItemInternal*>& family, Cell item, const bool reset = true) const;
138 void activeFamilyTree(Array<ItemInternal*>& family, Cell item, const bool reset = true) const;
139 void _addChildFaceToFace(Face parent_face, Face child_face);
140 void _addParentFaceToFace(Face parent_face, Face child_face);
141 // OFF AMR
142
151 void setCheckOrientation(bool is_check) { m_check_orientation = is_check; }
152
154 void applyTiedInterface(ITiedInterface* interface);
155
157 void removeTiedInterface(ITiedInterface* interface);
158
159 void setConnectivity(const Integer c);
160
161 void reorientFacesIfNeeded();
162
163 public:
164
165 virtual void computeSynchronizeInfos() override;
166
167 private:
168
169 Integer m_node_prealloc = 0;
170 Integer m_edge_prealloc = 0;
171 Integer m_cell_prealloc = 0;
172 Integer m_mesh_connectivity = 0;
173
176
179
182
183 NodeConnectivity* m_node_connectivity = nullptr;
184 EdgeConnectivity* m_edge_connectivity = nullptr;
185 FaceConnectivity* m_face_connectivity = nullptr;
186 CellConnectivity* m_cell_connectivity = nullptr;
187 HParentConnectivity* m_hparent_connectivity = nullptr;
188 HChildConnectivity* m_hchild_connectivity = nullptr;
189
190 bool m_has_face = true;
191
192 private:
193
194 void _addMasterFaceToFace(Face face, Face master_face);
195 void _addSlaveFacesToFace(Face face, Int32ConstArrayView slave_faces_lid);
196 void _removeMasterFaceToFace(Face face);
197 void _removeSlaveFacesToFace(Face face);
198
199 inline void _removeFace(Face face);
200 Real3 _computeFaceNormal(Face face, const SharedVariableNodeReal3& nodes_coord) const;
201 inline void _createOne(ItemInternal* item, Int64 uid, ItemTypeInfo* type);
202 inline void _createOne(ItemInternal* item, Int64 uid, ItemTypeId type_id);
203};
204
205/*---------------------------------------------------------------------------*/
206/*---------------------------------------------------------------------------*/
207
208} // End namespace Arcane::mesh
209
210/*---------------------------------------------------------------------------*/
211/*---------------------------------------------------------------------------*/
212
213#endif
Base class for 1D data vectors.
Cell of a mesh.
Definition Item.h:1300
Edge of a cell.
Definition Item.h:875
Face of a cell.
Definition Item.h:1032
Interface for modifying a family.
Interface of an entity family.
Definition IItemFamily.h:85
Interface of a class managing semi-conforming mesh.
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.
Mesh element based on nodes (Edge,Face,Cell).
Definition Item.h:773
Base class for a mesh element.
Definition Item.h:84
Class managing a 3-dimensional real vector.
IncrementalItemConnectivity * nodeConnectivity() const
The true connectivity behind the selector, for a bulk fill.
void replaceNode(ItemLocalId face, Integer index, ItemLocalId node)
Replaces the node at index index of the face face with that of localId() node_lid.
void setBulkBackAndFrontCells(Int32ConstArrayView back_cells, Int32ConstArrayView front_cells)
Sets the cells of every face at once.
void setBackAndFrontCells(Face face, Int32 back_cell_lid, Int32 front_cell_lid)
Positions the cell behind and in front of the face.
NodeFamily * m_node_family
Node family associated with this family.
Definition FaceFamily.h:175
void setCheckOrientation(bool is_check)
Indicates whether the orientation of the cells and faces must be checked.
Definition FaceFamily.h:151
void removeEdgeFromFace(Face face, Edge edge_to_remove)
Removes an edge from the face.
void replaceEdge(ItemLocalId face, Integer index, ItemLocalId edge)
Replaces the edge at index index of the face face with that of localId() edge_lid.
Item allocOne(Int64 uid, ItemTypeId type_id, MeshInfos &mesh_info) override
Allocates a face with unique number uid and type type. Generic item addition.
Item findOrAllocOne(Int64 uid, ItemTypeId type_id, MeshInfos &mesh_info, bool &is_alloc) override
Retrieves or allocates a face with unique number uid and type type.
EdgeFamily * m_edge_family
Edge family associated with this family.
Definition FaceFamily.h:178
void removeCellFromFace(Face face, ItemLocalId cell_to_remove_lid)
Removes a cell from the face.
void replaceCell(ItemLocalId face, Integer index, ItemLocalId cell)
Replaces the cell at index index of the face face with that of localId() cell_lid.
void allocateItemsBulk(Int64ConstArrayView uids, ItemTypeInfo *type, Int32 owner, Int32ArrayView lids)
Allocates every item of uids at once, in one pass per family array.
void addFrontCellToFace(Face face, Cell new_cell)
Adds a front cell to the face.
bool m_check_orientation
Indicates whether to check the orientation.
Definition FaceFamily.h:181
void addEdgeToFace(Face face, Edge new_edge)
Adds an edge to the face.
void removeFaceIfNotConnected(Face face)
Removes the face if it is no longer connected.
void replaceBackCellToFace(Face face, ItemLocalId new_cell)
AMR.
void addBackCellToFace(Face face, Cell new_cell)
Adds a back cell to the face.
void replaceFace(ItemLocalId face, Integer index, ItemLocalId face2)
Replaces the face at index index of the face face with that of localId() face_lid.
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
SharedMeshVariableScalarRefT< Node, Real3 > SharedVariableNodeReal3
Quantity at the node of coordinate type.
std::int32_t Int32
Signed integer type of 32 bits.