Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
NodesOfItemReorderer.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/* NodesOfItemReorderer.h (C) 2000-2025 */
9/* */
10/* Utility class to reorder the nodes of an entity. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_NODESOFITEMREORDERER_H
13#define ARCANE_CORE_NODESOFITEMREORDERER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/SmallArray.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25class ItemTypeMng;
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30/*!
31 * \brief Utility class to reorder the nodes of an entity.
32 */
33class ARCANE_CORE_EXPORT NodesOfItemReorderer
34{
35 friend class NodesOfItemReordererTester;
36
37 public:
38
39 NodesOfItemReorderer() = default;
40 explicit NodesOfItemReorderer(ItemTypeMng* itm)
41 : m_item_type_mng(itm)
42 {}
43
44 public:
45
46 void setItemTypeMng(ItemTypeMng* itm) { m_item_type_mng = itm; }
47
48 public:
49
50 bool reorder(ItemTypeId type_id, ConstArrayView<Int64> nodes_uids);
51 bool reorder1D(Int32 face_index, Int64 node_uid)
52 {
53 m_work_sorted_nodes.resize(1);
54 m_work_sorted_nodes[0] = node_uid;
55 return (face_index == 1);
56 }
57 ConstArrayView<Int64> sortedNodes() const { return m_work_sorted_nodes; }
58
59 private:
60
61 static bool _reorderOrder2(ConstArrayView<Int64> nodes_uids,
62 ArrayView<Int64> sorted_nodes_uids, bool has_center_node);
63 static bool _reorderOrder3(ConstArrayView<Int64> nodes_uids,
64 ArrayView<Int64> sorted_nodes_uids, bool has_center_node);
65
66 private:
67
68 ItemTypeMng* m_item_type_mng = nullptr;
69 SmallArray<Int64, 16> m_work_sorted_nodes;
70};
71
72/*---------------------------------------------------------------------------*/
73/*---------------------------------------------------------------------------*/
74
75} // End namespace Arcane
76
77/*---------------------------------------------------------------------------*/
78/*---------------------------------------------------------------------------*/
79
80#endif
Declarations of types on entities.
Modifiable view of an array of type T.
Constant view of an array of type T.
Type of an entity (Item).
Definition ItemTypeId.h:33
Mesh entity type manager.
Definition ItemTypeMng.h:66
1D data array with pre-allocated stack buffer.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
std::int32_t Int32
Signed integer type of 32 bits.