14#include "arcane/core/NodesOfItemReorderer.h"
16#include "arcane/utils/NotImplementedException.h"
18#include "arcane/core/ItemTypeId.h"
31bool NodesOfItemReorderer::
37 bool need_swap_orientation =
false;
38 Int32 min_node_index = 0;
40 Int32 nb_node = nodes_uid.size();
44 ARCANE_THROW(NotImplementedException,
"Node reordering for 2D type of order 3 or more");
46 if (nodes_uid[0] < nodes_uid[1]) {
48 sorted_nodes_uid[0] = nodes_uid[0];
49 sorted_nodes_uid[1] = nodes_uid[1];
50 sorted_nodes_uid[2] = nodes_uid[2];
51 sorted_nodes_uid[3] = nodes_uid[3];
54 sorted_nodes_uid[0] = nodes_uid[1];
55 sorted_nodes_uid[1] = nodes_uid[0];
56 sorted_nodes_uid[2] = nodes_uid[3];
57 sorted_nodes_uid[3] = nodes_uid[2];
64bool NodesOfItemReorderer::
70 bool need_swap_orientation =
false;
71 Int32 min_node_index = 0;
73 Int32 nb_node = nodes_uid.size();
77 if (nodes_uid[0] < nodes_uid[1]) {
78 sorted_nodes_uid[0] = nodes_uid[0];
79 sorted_nodes_uid[1] = nodes_uid[1];
80 sorted_nodes_uid[2] = nodes_uid[2];
83 sorted_nodes_uid[0] = nodes_uid[1];
84 sorted_nodes_uid[1] = nodes_uid[0];
85 sorted_nodes_uid[2] = nodes_uid[2];
92 sorted_nodes_uid[nb_node - 1] = nodes_uid[nb_node - 1];
96 nb_node = nb_node / 2;
111 Int64 min_node = INT64_MAX;
112 for (
Integer k = 0; k < nb_node; ++k) {
113 Int64 id = nodes_uid[k];
119 Int64 next_node = nodes_uid[(min_node_index + 1) % nb_node];
120 Int64 prev_node = nodes_uid[(min_node_index + (nb_node - 1)) % nb_node];
127 if (next_node == min_node) {
128 next_node = nodes_uid[(min_node_index + (nb_node + 2)) % nb_node];
131 if (prev_node == min_node) {
132 prev_node = nodes_uid[(min_node_index + (nb_node - 2)) % nb_node];
136 if (next_node > prev_node)
137 need_swap_orientation =
true;
138 if (need_swap_orientation) {
139 for (
Integer k = 0; k < nb_node; ++k) {
140 Integer index = (nb_node - k + min_node_index + incr) % nb_node;
141 Int32 index2 = ((2*nb_node-1) + incr + min_node_index - k) % nb_node;
142 sorted_nodes_uid[k] = nodes_uid[index];
143 sorted_nodes_uid[k + nb_node] = nodes_uid[index2 + nb_node];
147 for (
Integer k = 0; k < nb_node; ++k) {
148 Integer index = (k + min_node_index + incr2) % nb_node;
149 sorted_nodes_uid[k] = nodes_uid[index];
150 sorted_nodes_uid[k + nb_node] = nodes_uid[index + nb_node];
153 return need_swap_orientation;
159bool NodesOfItemReorderer::
162 ItemTypeInfo* iti = m_item_type_mng->typeFromId(type_id);
163 Int32 order = iti->order();
164 Int32 nb_node = nodes_uids.size();
165 m_work_sorted_nodes.resize(nb_node);
167 ARCANE_THROW(NotImplementedException,
"Node reordering for type of order 4 or more");
169 return _reorderOrder3(nodes_uids, m_work_sorted_nodes, iti->hasCenterNode());
171 return _reorderOrder2(nodes_uids, m_work_sorted_nodes, iti->hasCenterNode());
172 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.