13#include "arcane/aleph/AlephArcane.h"
14#include "arcane/core/IMesh.h"
29AlephOrdering(AlephKernel* kernel)
30: TraceAccessor(kernel->parallel()->traceMng())
39AlephOrdering(AlephKernel* kernel,
40 Integer global_nb_row,
43: TraceAccessor(kernel->parallel()->traceMng())
48 ItacFunction(AlephOrdering);
50 debug() <<
"\t[AlephOrdering::AlephOrdering] No ordering!";
53 debug() <<
"\t[AlephOrdering::AlephOrdering] Ordering!";
55 if (m_kernel->nbRanksPerSolver() != 1)
56 throw FatalErrorException(
"AlephOrdering",
"Ordering not allowed in parallel");
58 Integer local_nb_cell = m_kernel->subDomain()->defaultMesh()->ownCells().size();
59 Integer total_nb_cell = m_kernel->subDomain()->parallelMng()->reduce(Parallel::ReduceSum, local_nb_cell);
61 if ((local_nb_cell == local_nb_row) && (total_nb_cell == global_nb_row)) {
62 debug() <<
"\t[AlephOrdering::AlephOrdering] Now cell ordering";
63 this->initCellOrder();
67 if ((2 * local_nb_cell == local_nb_row) && (2 * total_nb_cell == global_nb_row)) {
68 debug() <<
"\t[AlephOrdering::AlephOrdering] Now 2*cell ordering";
69 this->initTwiceCellOrder();
73 Integer local_nb_face = m_kernel->subDomain()->defaultMesh()->ownFaces().size();
74 Integer total_nb_face = m_kernel->subDomain()->parallelMng()->reduce(Parallel::ReduceSum, local_nb_face);
75 if (((local_nb_cell + local_nb_face) == local_nb_row) && ((total_nb_cell + total_nb_face) == global_nb_row)) {
76 debug() <<
"\t[AlephOrdering::AlephOrdering] Now cell+face ordering";
77 this->initCellFaceOrder();
81 if ((local_nb_face == local_nb_row) && (total_nb_face == global_nb_row)) {
82 debug() <<
"\t[AlephOrdering::AlephOrdering] Now face ordering";
83 this->initFaceOrder();
87 Integer local_nb_node = m_kernel->subDomain()->defaultMesh()->ownNodes().size();
88 Integer total_nb_node = m_kernel->subDomain()->parallelMng()->reduce(Parallel::ReduceSum, local_nb_node);
90 if ((((local_nb_cell + local_nb_node)) == local_nb_row) && (((total_nb_cell + total_nb_node)) == global_nb_row)) {
91 debug() <<
"\t[AlephOrdering::AlephOrdering] Now (cell+node) ordering";
92 this->initCellNodeOrder();
96 if (((2 * (local_nb_cell + local_nb_node)) == local_nb_row) && ((2 * (total_nb_cell + total_nb_node)) == global_nb_row)) {
97 debug() <<
"\t[AlephOrdering::AlephOrdering] Now 2*(cell+node) ordering";
98 this->initTwiceCellNodeOrder();
102 throw FatalErrorException(
"AlephOrdering",
"Could not guess cell||face||cell+face");
110 debug() <<
"\33[5m\t[~AlephOrdering]\33[0m";
119 ItacFunction(AlephOrdering);
120 debug() <<
"\t[AlephOrdering::InitializeCellOrder] " << m_kernel->topology()->gathered_nb_row(m_kernel->size());
121 m_swap.resize(m_kernel->topology()->gathered_nb_row(m_kernel->size()));
122 UniqueArray<Int64> all;
124 ENUMERATE_CELL (cell, m_kernel->subDomain()->defaultMesh()->ownCells()) {
125 all.add(cell->uniqueId().asInt64());
128 debug() <<
"\t[AlephOrdering::InitializeCellOrder] added=" << added;
129 m_kernel->parallel()->allGatherVariable(all, m_swap);
137initTwiceCellOrder(
void)
139 ItacFunction(AlephOrdering);
140 debug() <<
"\t[AlephOrdering::InitializeTwiceCellOrder] " << m_kernel->topology()->gathered_nb_row(m_kernel->size());
141 m_swap.resize(m_kernel->topology()->gathered_nb_row(m_kernel->size()));
142 UniqueArray<Int64> all;
144 ENUMERATE_CELL (cell, m_kernel->subDomain()->defaultMesh()->ownCells()) {
145 all.add(2 * cell->uniqueId().asInt64());
147 all.add(2 * cell->uniqueId().asInt64() + 1);
150 debug() <<
"\t[AlephOrdering::InitializeTwiceCellOrder] added=" << added;
151 m_kernel->parallel()->allGatherVariable(all, m_swap);
160 ItacFunction(AlephOrdering);
161 debug() <<
"\t[AlephOrdering::InitializeFaceOrder] " << m_kernel->topology()->gathered_nb_row(m_kernel->size());
162 m_swap.resize(m_kernel->topology()->gathered_nb_row(m_kernel->size()));
163 UniqueArray<Int64> all;
165 ENUMERATE_FACE (face, m_kernel->subDomain()->defaultMesh()->ownFaces()) {
166 all.add(face->uniqueId().asInt64());
169 debug() <<
"\t[AlephOrdering::InitializeFaceOrder] added=" << added;
170 m_kernel->parallel()->allGatherVariable(all, m_swap);
177initCellFaceOrder(
void)
179 ItacFunction(AlephOrdering);
180 debug() <<
"\t[AlephOrdering::InitializeCellFaceOrder] " << m_kernel->topology()->gathered_nb_row(m_kernel->size());
182 UniqueArray<Integer> all_cells;
183 UniqueArray<Integer> all_faces;
184 UniqueArray<Integer> gathered_nb_cells(m_kernel->size());
185 UniqueArray<Integer> gathered_nb_faces(m_kernel->size());
186 all_cells.add(m_kernel->subDomain()->defaultMesh()->ownCells().size());
187 all_faces.add(m_kernel->subDomain()->defaultMesh()->ownFaces().size());
188 m_kernel->parallel()->allGather(all_cells, gathered_nb_cells);
189 m_kernel->parallel()->allGather(all_faces, gathered_nb_faces);
196 UniqueArray<Int64> all;
197 UniqueArray<Int64> m_swap_cell;
198 ENUMERATE_CELL (cell, m_kernel->subDomain()->defaultMesh()->ownCells()) {
199 all.add(cell->uniqueId().asInt64());
202 m_kernel->parallel()->allGatherVariable(all, m_swap_cell);
207 UniqueArray<Int64> m_swap_face;
208 ENUMERATE_FACE (face, m_kernel->subDomain()->defaultMesh()->ownFaces()) {
209 all.add(face->uniqueId().asInt64());
212 m_kernel->parallel()->allGatherVariable(all, m_swap_face);
217 Int64 cell_offset = m_swap_cell.size();
227 m_swap.resize(m_swap_cell.size() + m_swap_face.size());
230 for (Integer i = 0; i < m_kernel->size(); ++i) {
231 Integer offset = m_kernel->topology()->gathered_nb_row(i);
232 for (Integer j = 0; j < gathered_nb_cells.at(i); ++j) {
234 m_swap[offset + j] = m_swap_cell.at(iCell);
240 for (Integer i = 0; i < m_kernel->size(); ++i) {
243 offset = m_kernel->topology()->gathered_nb_row(i);
244 offset += gathered_nb_cells.at(i);
245 for (Integer j = 0; j < gathered_nb_faces.at(i); ++j) {
247 m_swap[offset + j] = cell_offset + m_swap_face.at(iFace);
262initCellNodeOrder(
void)
264 ItacFunction(AlephOrdering);
265 debug() <<
"\t[AlephOrdering::InitializeCellNodeOrder] " << m_kernel->topology()->gathered_nb_row(m_kernel->size());
267 UniqueArray<Integer> all_cells;
268 UniqueArray<Integer> all_nodes;
269 UniqueArray<Integer> gathered_nb_cells(m_kernel->size());
270 UniqueArray<Integer> gathered_nb_nodes(m_kernel->size());
271 all_cells.add(m_kernel->subDomain()->defaultMesh()->ownCells().size());
272 all_nodes.add(m_kernel->subDomain()->defaultMesh()->ownNodes().size());
273 m_kernel->parallel()->allGather(all_cells, gathered_nb_cells);
274 m_kernel->parallel()->allGather(all_nodes, gathered_nb_nodes);
276 UniqueArray<Int64> all;
277 UniqueArray<Int64> m_swap_cell;
278 ENUMERATE_CELL (cell, m_kernel->subDomain()->defaultMesh()->ownCells()) {
279 all.add(cell->uniqueId().asInt64());
281 m_kernel->parallel()->allGatherVariable(all, m_swap_cell);
283 UniqueArray<Int64> m_swap_node;
284 ENUMERATE_NODE (node, m_kernel->subDomain()->defaultMesh()->ownNodes()) {
285 all.add(node->uniqueId().asInt64());
287 m_kernel->parallel()->allGatherVariable(all, m_swap_node);
289 Int64 cell_offset = m_swap_cell.size();
291 m_swap.resize(m_swap_cell.size() + m_swap_node.size());
293 for (Integer i = 0; i < m_kernel->size(); ++i) {
294 AlephInt offset = m_kernel->topology()->gathered_nb_row(i);
295 for (Integer j = 0; j < gathered_nb_cells.at(i); ++j) {
296 m_swap[offset + j] = m_swap_cell.at(iCell);
301 for (Integer i = 0; i < m_kernel->size(); ++i) {
304 offset = m_kernel->topology()->gathered_nb_row(i);
305 offset += gathered_nb_cells.at(i);
306 for (Integer j = 0; j < gathered_nb_nodes.at(i); ++j) {
307 m_swap[offset + j] = cell_offset + m_swap_node.at(iNode);
314initTwiceCellNodeOrder(
void)
316 ItacFunction(AlephOrdering);
317 debug() <<
"\t[AlephOrdering::initTwiceCellNodeOrder] " << m_kernel->topology()->gathered_nb_row(m_kernel->size());
319 UniqueArray<Integer> all_cells;
320 UniqueArray<Integer> all_nodes;
321 UniqueArray<Integer> gathered_nb_cells(m_kernel->size());
322 UniqueArray<Integer> gathered_nb_nodes(m_kernel->size());
323 all_cells.add(m_kernel->subDomain()->defaultMesh()->ownCells().size());
324 all_nodes.add(m_kernel->subDomain()->defaultMesh()->ownNodes().size());
325 m_kernel->parallel()->allGather(all_cells, gathered_nb_cells);
326 m_kernel->parallel()->allGather(all_nodes, gathered_nb_nodes);
328 UniqueArray<Int64> all;
329 UniqueArray<Int64> m_swap_cell;
330 ENUMERATE_CELL (cell, m_kernel->subDomain()->defaultMesh()->ownCells()) {
331 all.add(2 * cell->uniqueId().asInt64());
332 all.add(2 * cell->uniqueId().asInt64() + 1);
334 m_kernel->parallel()->allGatherVariable(all, m_swap_cell);
336 UniqueArray<Int64> m_swap_node;
337 ENUMERATE_NODE (node, m_kernel->subDomain()->defaultMesh()->ownNodes()) {
338 all.add(2 * node->uniqueId().asInt64());
339 all.add(2 * node->uniqueId().asInt64() + 1);
341 m_kernel->parallel()->allGatherVariable(all, m_swap_node);
343 Int64 cell_offset = m_swap_cell.size();
345 m_swap.resize(m_swap_cell.size() + m_swap_node.size());
347 for (Integer i = 0; i < m_kernel->size(); ++i) {
348 Integer offset = m_kernel->topology()->gathered_nb_row(i);
349 for (Integer j = 0; j < gathered_nb_cells.at(i); ++j) {
350 m_swap[offset + j] = m_swap_cell.at(iCell);
355 for (Integer i = 0; i < m_kernel->size(); ++i) {
358 offset = m_kernel->topology()->gathered_nb_row(i);
359 offset += gathered_nb_cells.at(i);
360 for (Integer j = 0; j < gathered_nb_nodes.at(i); ++j) {
361 m_swap[offset + j] = cell_offset + m_swap_node.at(iNode);
Lecteur des fichiers de maillage via la bibliothèque LIMA.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
int AlephInt
Type par défaut pour indexer les lignes et les colonnes des matrices et vecteurs.
Int32 Integer
Type représentant un entier.