14#include "arcane/core/NodesOfItemReorderer.h"
16#include "arcane/utils/NotImplementedException.h"
18#include "arcane/core/ItemTypeId.h"
30bool NodesOfItemReorderer::
36 bool need_swap_orientation =
false;
37 Int32 min_node_index = 0;
39 Int32 nb_node = nodes_uid.size();
43 if (nodes_uid[0] < nodes_uid[1]) {
44 sorted_nodes_uid[0] = nodes_uid[0];
45 sorted_nodes_uid[1] = nodes_uid[1];
46 sorted_nodes_uid[2] = nodes_uid[2];
49 sorted_nodes_uid[0] = nodes_uid[1];
50 sorted_nodes_uid[1] = nodes_uid[0];
51 sorted_nodes_uid[2] = nodes_uid[2];
58 sorted_nodes_uid[nb_node - 1] = nodes_uid[nb_node - 1];
62 nb_node = nb_node / 2;
77 Int64 min_node = INT64_MAX;
78 for (
Integer k = 0; k < nb_node; ++k) {
79 Int64 id = nodes_uid[k];
85 Int64 next_node = nodes_uid[(min_node_index + 1) % nb_node];
86 Int64 prev_node = nodes_uid[(min_node_index + (nb_node - 1)) % nb_node];
93 if (next_node == min_node) {
94 next_node = nodes_uid[(min_node_index + (nb_node + 2)) % nb_node];
97 if (prev_node == min_node) {
98 prev_node = nodes_uid[(min_node_index + (nb_node - 2)) % nb_node];
102 if (next_node > prev_node)
103 need_swap_orientation =
true;
104 if (need_swap_orientation) {
105 for (
Integer k = 0; k < nb_node; ++k) {
106 Integer index = (nb_node - k + min_node_index + incr) % nb_node;
107 Int32 index2 = ((2*nb_node-1) + incr + min_node_index - k) % nb_node;
108 sorted_nodes_uid[k] = nodes_uid[index];
109 sorted_nodes_uid[k + nb_node] = nodes_uid[index2 + nb_node];
113 for (
Integer k = 0; k < nb_node; ++k) {
114 Integer index = (k + min_node_index + incr2) % nb_node;
115 sorted_nodes_uid[k] = nodes_uid[index];
116 sorted_nodes_uid[k + nb_node] = nodes_uid[index + nb_node];
119 return need_swap_orientation;
125bool NodesOfItemReorderer::
128 ItemTypeInfo* iti = m_item_type_mng->typeFromId(type_id);
129 Int32 order = iti->order();
130 Int32 nb_node = nodes_uids.size();
131 m_work_sorted_nodes.resize(nb_node);
133 ARCANE_THROW(NotImplementedException,
"node reordering for type of order 3 or mode");
135 return _reorderOrder2(nodes_uids, m_work_sorted_nodes, iti->hasCenterNode());
136 return MeshUtils::reorderNodesOfFace(nodes_uids, m_work_sorted_nodes);
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
Fonctions utilitaires sur le maillage.
Vue modifiable d'un tableau d'un type T.
Vue constante d'un tableau de type T.
Type d'une entité (Item).
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
std::int32_t Int32
Type entier signé sur 32 bits.