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];
57 nb_node = nb_node / 2;
72 Int64 min_node = INT64_MAX;
73 for (
Integer k = 0; k < nb_node; ++k) {
74 Int64 id = nodes_uid[k];
80 Int64 next_node = nodes_uid[(min_node_index + 1) % nb_node];
81 Int64 prev_node = nodes_uid[(min_node_index + (nb_node - 1)) % nb_node];
88 if (next_node == min_node) {
89 next_node = nodes_uid[(min_node_index + (nb_node + 2)) % nb_node];
92 if (prev_node == min_node) {
93 prev_node = nodes_uid[(min_node_index + (nb_node - 2)) % nb_node];
97 if (next_node > prev_node)
98 need_swap_orientation =
true;
99 if (need_swap_orientation) {
100 for (
Integer k = 0; k < nb_node; ++k) {
101 Integer index = (nb_node - k + min_node_index + incr) % nb_node;
102 Int32 index2 = ((2*nb_node-1) + incr + min_node_index - k) % nb_node;
103 sorted_nodes_uid[k] = nodes_uid[index];
104 sorted_nodes_uid[k + nb_node] = nodes_uid[index2 + nb_node];
108 for (
Integer k = 0; k < nb_node; ++k) {
109 Integer index = (k + min_node_index + incr2) % nb_node;
110 sorted_nodes_uid[k] = nodes_uid[index];
111 sorted_nodes_uid[k + nb_node] = nodes_uid[index + nb_node];
114 return need_swap_orientation;
120bool NodesOfItemReorderer::
123 ItemTypeInfo* iti = m_item_type_mng->typeFromId(type_id);
124 Int32 order = iti->order();
125 Int32 nb_node = nodes_uids.size();
126 m_work_sorted_nodes.resize(nb_node);
128 ARCANE_THROW(NotImplementedException,
"node reordering for type of order 3 or mode");
130 return _reorderOrder2(nodes_uids, m_work_sorted_nodes);
131 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.