Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
UnstructuredMeshUtilities.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/* UnstructuredMeshUtilities.h (C) 2000-2025 */
9/* */
10/* Utility functions for a mesh. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MESH_UNSTRUCTUREDMESHUTILITIES_H
13#define ARCANE_MESH_UNSTRUCTUREDMESHUTILITIES_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/TraceAccessor.h"
18
19#include "arcane/core/IMeshUtilities.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30class IMesh;
31class ItemPairGroup;
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
40class UnstructuredMeshUtilities
41: public TraceAccessor
42, public IMeshUtilities
43{
44 public:
45
46 explicit UnstructuredMeshUtilities(IMesh* mesh);
48
49 public:
50
51 void changeOwnersFromCells() override;
52
54 IntegerConstArrayView items_nb_node,
55 Int64ConstArrayView items_connectivity,
56 Int32ArrayView local_ids,
57 bool allow_null) override;
59 ConstArrayView<Int64> items_connectivity,
60 ArrayView<Int32> local_ids,
61 bool allow_null) override;
62
82 Real3 computeNormal(const FaceGroup& face_group,
83 const VariableNodeReal3& nodes_coord) override;
84
85 Real3 computeDirection(const NodeGroup& node_group,
86 const VariableNodeReal3& nodes_coord,
87 Real3* n1, Real3* n2) override;
88
89 void computeAdjency(ItemPairGroup adjency_array, eItemKind link_kind,
90 Integer nb_layer) override;
91
92 bool writeToFile(const String& file_name, const String& service_name) override;
93
95 bool initial_partition) override;
96
97 void mergeNodes(Int32ConstArrayView nodes_local_id,
98 Int32ConstArrayView nodes_to_merge_local_id,
99 bool allow_non_corresponding_face) override;
100
101 void computeAndSetOwnersForNodes() override;
102 void computeAndSetOwnersForEdges() override;
103 void computeAndSetOwnersForFaces() override;
104
106
107 private:
108
109 IMesh* m_mesh = nullptr;
110 BasicItemPairGroupComputeFunctor* m_compute_adjacency_functor = nullptr;
111
112 private:
113
114 Real3 _round(Real3 value);
115 Real3 _broadcastFarthestNode(Real distance, const Node& node,
116 const VariableNodeReal3& nodes_coord);
117};
118
119/*---------------------------------------------------------------------------*/
120/*---------------------------------------------------------------------------*/
121
122} // namespace Arcane
123
124/*---------------------------------------------------------------------------*/
125/*---------------------------------------------------------------------------*/
126
127#endif
Modifiable view of an array of type T.
Constant view of an array of type T.
Interface of a mesh partitioner.
Interface of a class providing utility functions on meshes.
Implementation of an array of lists of entities.
Table of entity lists.
Node of a mesh.
Definition Item.h:598
Class managing a 3-dimensional real vector.
Definition Real3.h:132
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
Real3 computeDirection(const NodeGroup &node_group, const VariableNodeReal3 &nodes_coord, Real3 *n1, Real3 *n2) override
void mergeNodes(Int32ConstArrayView nodes_local_id, Int32ConstArrayView nodes_to_merge_local_id, bool allow_non_corresponding_face) override
Merges nodes.
Real3 computeNormal(const FaceGroup &face_group, const VariableNodeReal3 &nodes_coord) override
Calculates the normal of a face group.
~UnstructuredMeshUtilities() override
Frees resources.
void partitionAndExchangeMeshWithReplication(IMeshPartitionerBase *partitioner, bool initial_partition) override
Repartitions and exchanges the mesh while managing replication.
void getFacesLocalIdFromConnectivity(ConstArrayView< ItemTypeId > items_type, ConstArrayView< Int64 > items_connectivity, ArrayView< Int32 > local_ids, bool allow_null) override
Searches for the local IDs of faces based on their connectivity.
void computeAndSetOwnersForEdges() override
Determines the owners of the edges.
void computeAdjency(ItemPairGroup adjency_array, eItemKind link_kind, Integer nb_layer) override
Calculates adjacencies, stored in adjacency_array.
bool writeToFile(const String &file_name, const String &service_name) override
Writes the mesh to a file.
void changeOwnersFromCells() override
Positions the new owners of nodes, edges, and faces based on the cells.
void localIdsFromConnectivity(eItemKind item_kind, IntegerConstArrayView items_nb_node, Int64ConstArrayView items_connectivity, Int32ArrayView local_ids, bool allow_null) override
Searches for the local IDs of entities based on their connectivity.
void recomputeItemsUniqueIdFromNodesUniqueId() override
Recalculates the uniqueId() of edges, faces, and cells based on the uniqueId() of the nodes.
void computeAndSetOwnersForFaces() override
Determines the owners of the faces.
void computeAndSetOwnersForNodes() override
Determines the owners of the nodes.
ItemGroupT< Face > FaceGroup
Group of faces.
Definition ItemTypes.h:179
ItemGroupT< Node > NodeGroup
Group of nodes.
Definition ItemTypes.h:168
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Coordinate type quantity at node.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
Definition UtilsTypes.h:480
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:453
eItemKind
Mesh entity type.
double Real
Type representing a real number.
ConstArrayView< Integer > IntegerConstArrayView
C equivalent of a 1D array of integers.
Definition UtilsTypes.h:486