14#include "arcane/utils/NotSupportedException.h"
16#include "arcane/cartesianmesh/CartesianConnectivity.h"
18#include "arcane/IMesh.h"
19#include "arcane/IItemFamily.h"
20#include "arcane/VariableTypes.h"
31void CartesianConnectivity::
32_setStorage(ArrayView<Index> nodes_to_cell, ArrayView<Index> cells_to_node,
33 const Permutation* permutation)
35 m_nodes_to_cell = nodes_to_cell;
36 m_cells_to_node = cells_to_node;
37 m_permutation = permutation;
48void CartesianConnectivity::
52 m_nodes = NodeInfoListView(mesh->nodeFamily());
53 m_cells = CellInfoListView(mesh->cellFamily());
55 if (mesh->dimension() == 2 || mesh->dimension() == 1)
56 _computeInfos2D(mesh, nodes_coord, cells_coord);
57 else if (mesh->dimension() == 3)
58 _computeInfos3D(mesh, nodes_coord, cells_coord);
60 throw NotSupportedException(A_FUNCINFO,
"Unknown mesh dimension");
66void CartesianConnectivity::
70 CartesianConnectivity& cc = *
this;
71 IItemFamily* node_family = mesh->nodeFamily();
72 IItemFamily* cell_family = mesh->cellFamily();
76 Real3 node_coord = nodes_coord[inode];
77 Index& idx = cc._index(node);
78 idx.fill(NULL_ITEM_LOCAL_ID);
79 Integer nb_cell = node.nbCell();
80 for (Integer i = 0; i < nb_cell; ++i) {
81 Cell cell = node.cell(i);
82 Int32 cell_lid = cell.localId();
83 Real3 cell_coord = cells_coord[cell];
84 if (cell_coord.y > node_coord.y) {
85 if (cell_coord.x > node_coord.x)
86 idx.v[P_UpperRight] = cell_lid;
88 idx.v[P_UpperLeft] = cell_lid;
91 if (cell_coord.x > node_coord.x)
92 idx.v[P_LowerRight] = cell_lid;
94 idx.v[P_LowerLeft] = cell_lid;
101 Real3 cell_coord = cells_coord[cell];
102 Index& idx = _index(cell);
103 idx.fill(NULL_ITEM_LOCAL_ID);
104 Integer nb_node = cell.nbNode();
105 for (Integer i = 0; i < nb_node; ++i) {
106 Node node = cell.node(i);
107 Int32 node_lid = node.localId();
108 Real3 node_coord = nodes_coord[node];
109 if (node_coord.y > cell_coord.y) {
110 if (node_coord.x > cell_coord.x)
111 idx.v[P_UpperRight] = node_lid;
113 idx.v[P_UpperLeft] = node_lid;
116 if (node_coord.x > cell_coord.x)
117 idx.v[P_LowerRight] = node_lid;
119 idx.v[P_LowerLeft] = node_lid;
128void CartesianConnectivity::
132 CartesianConnectivity& cc = *
this;
133 IItemFamily* node_family = mesh->nodeFamily();
134 IItemFamily* cell_family = mesh->cellFamily();
138 Real3 node_coord = nodes_coord[inode];
139 Index& idx = cc._index(node);
140 idx.fill(NULL_ITEM_LOCAL_ID);
141 Integer nb_cell = node.nbCell();
142 for (Integer i = 0; i < nb_cell; ++i) {
143 Cell cell = node.cell(i);
144 Int32 cell_lid = cell.localId();
145 Real3 cell_coord = cells_coord[cell];
147 if (cell_coord.z > node_coord.z) {
148 if (cell_coord.y > node_coord.y) {
149 if (cell_coord.x > node_coord.x)
150 idx.v[P_TopZUpperRight] = cell_lid;
152 idx.v[P_TopZUpperLeft] = cell_lid;
155 if (cell_coord.x > node_coord.x)
156 idx.v[P_TopZLowerRight] = cell_lid;
158 idx.v[P_TopZLowerLeft] = cell_lid;
162 if (cell_coord.y > node_coord.y) {
163 if (cell_coord.x > node_coord.x)
164 idx.v[P_UpperRight] = cell_lid;
166 idx.v[P_UpperLeft] = cell_lid;
169 if (cell_coord.x > node_coord.x)
170 idx.v[P_LowerRight] = cell_lid;
172 idx.v[P_LowerLeft] = cell_lid;
180 Real3 cell_coord = cells_coord[cell];
181 Index& idx = _index(cell);
182 idx.fill(NULL_ITEM_LOCAL_ID);
183 Integer nb_node = cell.nbNode();
184 for (Integer i = 0; i < nb_node; ++i) {
185 Node node = cell.node(i);
186 Int32 node_lid = node.localId();
187 Real3 node_coord = nodes_coord[node];
189 if (node_coord.z > cell_coord.z) {
190 if (node_coord.y > cell_coord.y) {
191 if (node_coord.x > cell_coord.x)
192 idx.v[P_TopZUpperRight] = node_lid;
194 idx.v[P_TopZUpperLeft] = node_lid;
197 if (node_coord.x > cell_coord.x)
198 idx.v[P_TopZLowerRight] = node_lid;
200 idx.v[P_TopZLowerLeft] = node_lid;
204 if (node_coord.y > cell_coord.y) {
205 if (node_coord.x > cell_coord.x)
206 idx.v[P_UpperRight] = node_lid;
208 idx.v[P_UpperLeft] = node_lid;
211 if (node_coord.x > cell_coord.x)
212 idx.v[P_LowerRight] = node_lid;
214 idx.v[P_LowerLeft] = node_lid;
228void CartesianConnectivity::Permutation::
232 { 0, 1, 2, 3, 4, 5, 6, 7 },
233 { 3, 0, 1, 2, 7, 4, 5, 6 },
234 { 1, 5, 6, 2, 0, 4, 7, 3 }
237 for (Int32 i = 0; i < 3; ++i)
238 for (Int32 j = 0; j < 8; ++j)
239 permutation[i][j] =
static_cast<ePosition
>(p[i][j]);
MeshVariableScalarRefT< Cell, Real3 > VariableCellReal3
Grandeur au centre des mailles de type coordonnées.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Grandeur au noeud de type coordonnées.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.