Arcane  4.1.12.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;
70 virtual void preAllocate(Integer nb_item);
71
72 public:
73
74 // IItemFamilyModifier Interface
75 Item allocOne(Int64 uid, ItemTypeId type_id, MeshInfos& mesh_info) override;
76 Item findOrAllocOne(Int64 uid, ItemTypeId type_id, MeshInfos& mesh_info, bool& is_alloc) override;
77 IItemFamily* family() override { return this; }
78
79 // TODO: DEPRECATED
81 // TODO: DEPRECATED
82 ItemInternal* findOrAllocOne(Int64 uid, ItemTypeInfo* type, bool& is_alloc);
83
85 Face findOrAllocOne(Int64 uid, ItemTypeId type, bool& is_alloc);
86
87 public:
88
90 void addBackCellToFace(Face face, Cell new_cell);
92 void addFrontCellToFace(Face face, Cell new_cell);
94 void removeCellFromFace(Face face, ItemLocalId cell_to_remove_lid);
96 void addEdgeToFace(Face face, Edge new_edge);
98
99 void removeEdgeFromFace(Face face, Edge edge_to_remove);
102
103 void replaceNode(ItemLocalId face, Integer index, ItemLocalId node);
104 void replaceEdge(ItemLocalId face, Integer index, ItemLocalId edge);
105 void replaceFace(ItemLocalId face, Integer index, ItemLocalId face2);
106 void replaceCell(ItemLocalId face, Integer index, ItemLocalId cell);
107
108 void setBackAndFrontCells(Face face, Int32 back_cell_lid, Int32 front_cell_lid);
109
111 void replaceBackCellToFace(Face face, ItemLocalId new_cell);
112 void replaceFrontCellToFace(Face face, ItemLocalId new_cell);
113 void addBackFrontCellsFromParentFace(Face subface, Face face);
114 void replaceBackFrontCellsFromParentFace(Cell subcell, Face subface, Cell cell, Face face);
115 bool isSubFaceInFace(Face subface, Face face) const;
116 bool isChildOnFace(ItemWithNodes child, Face face) const;
117 void subFaces(Face face, Array<ItemInternal*>& subfaces);
118 void allSubFaces(Face face, Array<ItemInternal*>& subfaces);
119 void activeSubFaces(Face face, Array<ItemInternal*>& subfaces);
120 void familyTree(Array<ItemInternal*>& family, Cell item, const bool reset = true) const;
121 void activeFamilyTree(Array<ItemInternal*>& family, Cell item, const bool reset = true) const;
122 void _addChildFaceToFace(Face parent_face, Face child_face);
123 void _addParentFaceToFace(Face parent_face, Face child_face);
124 // OFF AMR
125
134 void setCheckOrientation(bool is_check) { m_check_orientation = is_check; }
135
137 void applyTiedInterface(ITiedInterface* interface);
138
140 void removeTiedInterface(ITiedInterface* interface);
141
142 void setConnectivity(const Integer c);
143
144 void reorientFacesIfNeeded();
145
146 public:
147
148 virtual void computeSynchronizeInfos() override;
149
150 private:
151
152 Integer m_node_prealloc = 0;
153 Integer m_edge_prealloc = 0;
154 Integer m_cell_prealloc = 0;
155 Integer m_mesh_connectivity = 0;
156
159
162
165
166 NodeConnectivity* m_node_connectivity = nullptr;
167 EdgeConnectivity* m_edge_connectivity = nullptr;
168 FaceConnectivity* m_face_connectivity = nullptr;
169 CellConnectivity* m_cell_connectivity = nullptr;
170 HParentConnectivity* m_hparent_connectivity = nullptr;
171 HChildConnectivity* m_hchild_connectivity = nullptr;
172
173 bool m_has_face = true;
174
175 private:
176
177 void _addMasterFaceToFace(Face face, Face master_face);
178 void _addSlaveFacesToFace(Face face, Int32ConstArrayView slave_faces_lid);
179 void _removeMasterFaceToFace(Face face);
180 void _removeSlaveFacesToFace(Face face);
181
182 inline void _removeFace(Face face);
183 Real3 _computeFaceNormal(Face face, const SharedVariableNodeReal3& nodes_coord) const;
184 inline void _createOne(ItemInternal* item, Int64 uid, ItemTypeInfo* type);
185 inline void _createOne(ItemInternal* item, Int64 uid, ItemTypeId type_id);
186};
187
188/*---------------------------------------------------------------------------*/
189/*---------------------------------------------------------------------------*/
190
191} // End namespace Arcane::mesh
192
193/*---------------------------------------------------------------------------*/
194/*---------------------------------------------------------------------------*/
195
196#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:83
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.
Definition Real3.h:132
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 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:158
void setCheckOrientation(bool is_check)
Indicates whether the orientation of the cells and faces must be checked.
Definition FaceFamily.h:134
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:161
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 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:164
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:482
SharedMeshVariableScalarRefT< Node, Real3 > SharedVariableNodeReal3
Quantity at the node of coordinate type.
std::int32_t Int32
Signed integer type of 32 bits.