Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ExtraGhostItemsManager.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ExtraGhostItemsManager.cc (C) 2000-2021 */
9/* */
10/* Construction des items fantômes supplémentaires. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/mesh/ExtraGhostItemsManager.h"
15
17#include "arcane/utils/String.h"
18#include "arcane/utils/ScopedPtr.h"
19#include "arcane/IParallelMng.h"
20#include "arcane/IParallelExchanger.h"
21#include "arcane/ISerializeMessage.h"
22#include "arcane/ParallelMngUtils.h"
23
24#include <set>
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29void Arcane::mesh::ExtraGhostItemsManager::
30computeExtraGhostItems()
31{
32 const Integer nb_builder = m_builders.size();
33
34
35 if(nb_builder == 0) return;
36
37 m_trace_mng->info() << "Compute extra ghost cells";
38
39 for(Integer i=0; i<nb_builder; ++i) {
40 // Calcul de mailles extraordinaires à envoyer
41 m_builders[i]->computeExtraItemsToSend();
42 }
43
44 IParallelMng* pm = m_extra_ghost_items_adder->subDomain()->parallelMng();
45
46 auto exchanger { ParallelMngUtils::createExchangerRef(pm) };
47
48 const Integer nsd = m_extra_ghost_items_adder->subDomain()->nbSubDomain();
49
50 // Construction des items à envoyer // Voir comment rendre compatible avec le ExtraGhostBuilder
51 UniqueArray< Arcane::SharedArray<Int32> > item_to_send(nsd);
52
53 // Initialisation de l'échangeur de données
54 for(Integer isd=0;isd<nsd;++isd)
55 {
56 for(Integer i=0; i<nb_builder; ++i)
57 {
58 item_to_send[isd].addRange(m_builders[i]->extraItemsToSend(isd));
59 }
60 if (!item_to_send[isd].empty())
61 exchanger->addSender(isd);
62 }
63
64 exchanger->initializeCommunicationsMessages();
65
66 // Envoi des item
67 for(Integer i=0, ns=exchanger->nbSender(); i<ns; ++i) {
68 ISerializeMessage* sm = exchanger->messageToSend(i);
69 const Int32 rank = sm->destination().value();
70 ISerializer* s = sm->serializer();
71 const Arcane::Int32Array& items_to_send_to_rank = item_to_send[rank];
72 m_extra_ghost_items_adder->serializeGhostItems(s, items_to_send_to_rank);
73 }
74 exchanger->processExchange();
75
76 // Réception des mailles
77 for( Integer i=0, ns=exchanger->nbReceiver(); i<ns; ++i ) {
78 ISerializeMessage* sm = exchanger->messageToReceive(i);
79 ISerializer* s = sm->serializer();
80 m_extra_ghost_items_adder->addExtraGhostItems(s);
81 }
82 m_extra_ghost_items_adder->updateSynchronizationInfo(); // Collective Operation
83
84}
85
86/*---------------------------------------------------------------------------*/
87/*---------------------------------------------------------------------------*/
88
Déclarations des types utilisés dans Arcane.
Tableau d'items de types quelconques.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Int32 Integer
Type représentant un entier.