Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ItemsExchangeInfo2.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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/* ItemsExchangeInfo2.cc (C) 2000-2024 */
9/* */
10/* Exchange of entities and their variables. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/mesh/ItemsExchangeInfo2.h"
15
16#include "arcane/utils/NotSupportedException.h"
17#include "arcane/utils/PlatformUtils.h"
18#include "arcane/utils/ValueConvert.h"
19
20#include "arcane/core/IMesh.h"
21#include "arcane/core/VariableTypes.h"
23
24#include "arcane/core/ISubDomain.h"
25#include "arcane/core/IParticleFamily.h"
26#include "arcane/core/IParallelMng.h"
27#include "arcane/core/ItemPrinter.h"
28#include "arcane/core/IParallelExchanger.h"
29#include "arcane/core/ISerializer.h"
30#include "arcane/core/ISerializeMessage.h"
31#include "arcane/core/SerializeBuffer.h"
32#include "arcane/core/MeshToMeshTransposer.h"
33#include "arcane/core/IItemFamilyPolicyMng.h"
34#include "arcane/core/IItemFamilySerializer.h"
35#include "arcane/core/ItemFamilySerializeArgs.h"
36#include "arcane/core/ParallelMngUtils.h"
37#include "arcane/core/internal/IItemFamilyInternal.h"
38
39#include "arcane/mesh/ItemGroupsSerializer2.h"
40#include "arcane/mesh/TiedInterfaceExchanger.h"
41#include "arcane/mesh/ItemFamilyVariableSerializer.h"
42
43// TODO: to be removed
44#include "arcane/mesh/DynamicMesh.h"
45#include "arcane/mesh/DynamicMeshIncrementalBuilder.h"
46
47#include "arcane/IVariableAccessor.h"
48
49/*---------------------------------------------------------------------------*/
50/*---------------------------------------------------------------------------*/
51
52namespace Arcane
53{
54class ItemFamilyExchange;
55}
56
57/*---------------------------------------------------------------------------*/
58/*---------------------------------------------------------------------------*/
59
60namespace Arcane::mesh
61{
62namespace
63{
64 const Integer GROUPS_MAGIC_NUMBER = 0x3a9e4325;
65}
66/*---------------------------------------------------------------------------*/
67/*---------------------------------------------------------------------------*/
68
69ItemsExchangeInfo2::
70ItemsExchangeInfo2(IItemFamily* item_family)
71: TraceAccessor(item_family->traceMng())
72, m_item_family(item_family)
73, m_groups_serializers()
74, m_exchanger(ParallelMngUtils::createExchangerRef(item_family->parallelMng()))
75, m_family_serializer(nullptr)
76{
77 m_family_serializer = item_family->policyMng()->createSerializer();
78
79 // Positionne infos pour l'affichage listing
80 m_exchanger->setName(item_family->name());
81
82 // Celui ci doit toujours être le premier de la phase de sérialisation des variables.
83 addSerializeStep(new ItemFamilyVariableSerializer(item_family));
84}
85
86/*---------------------------------------------------------------------------*/
87/*---------------------------------------------------------------------------*/
88
89ItemsExchangeInfo2::
90~ItemsExchangeInfo2()
91{
92 for (IItemFamilySerializeStep* step : m_serialize_steps)
93 delete step;
94 delete m_family_serializer;
95 for (Integer i = 0; i < m_groups_serializers.size(); ++i)
96 delete m_groups_serializers[i];
97}
98
99/*---------------------------------------------------------------------------*/
100/*---------------------------------------------------------------------------*/
101
102inline void ItemsExchangeInfo2::
103_addItemToSend(Int32 sub_domain_id, Item item)
104{
105 if (m_send_local_ids[sub_domain_id].empty())
106 // If it is the first element, add the sub-domain to the list of
107 // communicating sub-domains
108 m_exchanger->addSender(sub_domain_id);
109 m_send_local_ids[sub_domain_id].add(item.localId());
110}
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
115bool ItemsExchangeInfo2::
116computeExchangeInfos()
117{
118 // Determines the list of variables to exchange
119 // It also includes variables from child families
120 {
121 m_families_to_exchange.add(itemFamily()); // The current family
122 IItemFamilyCollection child_families = itemFamily()->childFamilies();
123 for (IItemFamily* child_family : child_families)
124 m_families_to_exchange.add(child_family);
125
126 for (IItemFamily* current_family : m_families_to_exchange) {
127 // If the family does not have a uniqueId table, it must not
128 // transfer the groups because it is not possible to convert
129 // uniqueIds to localIds and the serializer needs it.
130 // TODO: remove this requirement in the serializer
131 if (current_family->hasUniqueIdMap())
132 m_groups_serializers.add(new ItemGroupsSerializer2(current_family, m_exchanger.get()));
133 }
134 }
135
136 for (IItemFamilySerializeStep* step : m_serialize_steps) {
137 step->initialize();
138 }
139
140 bool r = m_exchanger->initializeCommunicationsMessages();
141 m_receive_local_ids.resize(m_exchanger->nbReceiver());
142 return r;
143}
144
145/*---------------------------------------------------------------------------*/
146/*---------------------------------------------------------------------------*/
147
148void ItemsExchangeInfo2::
149setExchangeItems(ConstArrayView<std::set<Int32>> items_to_send)
150{
151 Int32 nb_part = m_item_family->mesh()->meshPartInfo().nbPart();
152 m_send_local_ids.resize(nb_part);
153
154 for (Integer i = 0, is = items_to_send.size(); i < is; ++i) {
155 Int64 n = items_to_send[i].size();
156 if (n != 0) {
157 m_exchanger->addSender(i);
158 //ItemInternalList items = m_item_family->itemsInternal();
159 std::set<Int32>::const_iterator iids = items_to_send[i].begin();
160 std::set<Int32>::const_iterator ids_end = items_to_send[i].end();
161 //info() << "SEND kind=" << itemKindName(itemKind()) << " dest=" << i << " nb=" << n;
162 for (; iids != ids_end; ++iids) {
163 m_send_local_ids[i].add(*iids);
164 }
165 }
166 }
167}
168
169/*---------------------------------------------------------------------------*/
170/*---------------------------------------------------------------------------*/
183void ItemsExchangeInfo2::
184computeExchangeItems()
185{
186 if (m_item_family->itemKind() != IK_Particle)
187 ARCANE_FATAL("This call is only valid for ParticleFamily. family={0}",
188 itemFamily()->name());
189
190 Int32 nb_part = m_item_family->mesh()->meshPartInfo().nbPart();
191 // Contains for each sub-domain the list of entities to send
192 m_send_local_ids.resize(nb_part);
193 // List of sub-domains with which I must communicate.
194 VariableItemInt32& items_owner(itemFamily()->itemsNewOwner());
195
196 // To determine the list of entities to send, it is sufficient to compare
197 // the owner() field of the entity containing the owner of the current entity
198 // with the itemsNewOwner() variable which contains the new owner.
199 // If these two values are different, the entity must be sent.
200 // WARNING: above all, do not use ownItems(), because these are calculated on the fly
201 // (lazy evaluation)
202 ENUMERATE_ITEM (i_item, itemFamily()->allItems()) {
203 Item item = *i_item;
204 Int32 new_owner = items_owner[item];
205 Int32 current_owner = item.owner();
206 if (item.isOwn() && new_owner != current_owner) {
207 _addItemToSend(new_owner, item);
208 }
209 }
210}
211
212/*---------------------------------------------------------------------------*/
213/*---------------------------------------------------------------------------*/
214
215void ItemsExchangeInfo2::
216prepareToSend()
217{
218 info(4) << "ItemsExchangeInfo2::prepareToSend() for " << itemFamily()->name();
219 info(4) << "Number of groups to serialize: " << m_groups_serializers.size();
220
221 // Preparation of group serializers
222 for (Integer i_serializer = 0; i_serializer < m_groups_serializers.size(); ++i_serializer) {
223 ItemGroupsSerializer2* groups_serializer = m_groups_serializers[i_serializer];
224 if (groups_serializer->itemFamily() == itemFamily()) {
225 // This is the original family, so no transformation
226 groups_serializer->prepareData(m_send_local_ids);
227 }
228 else {
229 // This is a sub-family
230 UniqueArray<SharedArray<Int32>> subitems_to_send(m_send_local_ids.size());
231 for (Integer i_dest = 0; i_dest < m_send_local_ids.size(); ++i_dest) {
232 ItemVector subitems = MeshToMeshTransposer::transpose(itemFamily(), groups_serializer->itemFamily(), itemFamily()->view(m_send_local_ids[i_dest]));
233 Int32Array& current_subitem_lids = subitems_to_send[i_dest];
234 ENUMERATE_ITEM (iitem, subitems)
235 if (iitem.localId() != NULL_ITEM_LOCAL_ID)
236 current_subitem_lids.add(iitem.localId());
237 }
238 groups_serializer->prepareData(subitems_to_send);
239 }
240 }
241
242 // Generates info for each processor to which entities will be sent
243 ItemInfoListView items_internal(itemFamily());
244 IItemFamilyCollection child_families = itemFamily()->childFamilies();
245
246 const Integer nb_send = m_exchanger->nbSender();
247 {
249 for (IItemFamilySerializeStep* step : m_serialize_steps)
250 step->notifyAction(IItemFamilySerializeStep::NotifyActionArgs(action, nb_send));
251 }
252
253 for (Integer i = 0; i < nb_send; ++i) {
254 ISerializeMessage* comm = m_exchanger->messageToSend(i);
255 Int32 dest_sub_domain = comm->destination().value();
256 // List of localId() of entities to send
257 Int32ConstArrayView dest_items_local_id = m_send_local_ids[dest_sub_domain];
258 info(5) << "Processing message to " << dest_sub_domain
259 << " for family " << itemFamily()->fullName();
260
261 ISerializer* sbuf = comm->serializer();
262
263 ItemFamilySerializeArgs serialize_args(sbuf, dest_sub_domain, dest_items_local_id, i);
264
265 // Reserves memory for serialization
266 sbuf->setMode(ISerializer::ModeReserve);
267
268 // Reserves for the items and uids of the sub-items
269 m_family_serializer->serializeItems(sbuf, dest_items_local_id);
270 m_family_serializer->serializeItemRelations(sbuf, dest_items_local_id);
271
272 // Reserves for the uids of the sub-items (duplicate calculation of MeshToMeshTransposer::transpose with the put)
273 for (IItemFamily* child_family : child_families) {
274 ItemVectorView dest_items(items_internal, dest_items_local_id);
275 ItemVector sub_dest_items = MeshToMeshTransposer::transpose(itemFamily(), child_family, dest_items);
276 Integer sub_dest_item_count = 0;
277 ENUMERATE_ITEM (iitem, sub_dest_items) {
278 Int32 lid = iitem.localId();
279 if (lid != NULL_ITEM_LOCAL_ID)
280 ++sub_dest_item_count;
281 }
282 sbuf->reserveInt64(1);
283 sbuf->reserveSpan(eBasicDataType::Int64, sub_dest_item_count);
284 }
285
286 _applySerializeStep(IItemFamilySerializeStep::PH_Item, serialize_args);
287
288 sbuf->reserveInteger(1); // For magic number for group serialization
289
290 // Reserves for the groups
291 for (Integer i_serializer = 0; i_serializer < m_groups_serializers.size(); ++i_serializer)
292 m_groups_serializers[i_serializer]->serialize(serialize_args);
293
294 _applySerializeStep(IItemFamilySerializeStep::PH_Group, serialize_args);
295
296 // The following objects are deserialized in readVariables()
297
298 // Reserves for variable serialization
299 _applySerializeStep(IItemFamilySerializeStep::PH_Variable, serialize_args);
300
301 sbuf->allocateBuffer();
302
303 // Serializes the info
305
306 m_family_serializer->serializeItems(sbuf, dest_items_local_id);
307 m_family_serializer->serializeItemRelations(sbuf, dest_items_local_id);
308
309 // Serialization of sub-item uids (duplicate calculation of MeshToMeshTransposer::transpose with reserves)
310 for (IItemFamily* child_family : child_families) {
311 ItemVectorView dest_items(items_internal, dest_items_local_id);
312 ItemVector sub_dest_items = MeshToMeshTransposer::transpose(itemFamily(), child_family, dest_items);
313 Int64UniqueArray sub_dest_uids;
314 sub_dest_uids.reserve(sub_dest_items.size());
315 ENUMERATE_ITEM (iitem, sub_dest_items) {
316 Int32 lid = iitem.localId();
317 if (lid != NULL_ITEM_LOCAL_ID)
318 sub_dest_uids.add(iitem->uniqueId());
319 }
320 sbuf->putInt64(sub_dest_uids.size());
321 sbuf->putSpan(sub_dest_uids);
322 }
323
324 _applySerializeStep(IItemFamilySerializeStep::PH_Item, serialize_args);
325
326 sbuf->put(GROUPS_MAGIC_NUMBER);
327
328 // Serializes the list of groups
329 for (Integer i_serializer = 0; i_serializer < m_groups_serializers.size(); ++i_serializer)
330 m_groups_serializers[i_serializer]->serialize(serialize_args);
331
332 _applySerializeStep(IItemFamilySerializeStep::PH_Group, serialize_args);
333
334 // Serializes the info for variables
335 _applySerializeStep(IItemFamilySerializeStep::PH_Variable, serialize_args);
336 }
337
338 {
340 for (IItemFamilySerializeStep* step : m_serialize_steps)
341 step->notifyAction(IItemFamilySerializeStep::NotifyActionArgs(action, nb_send));
342 }
343}
344
345void ItemsExchangeInfo2::
346releaseBuffer()
347{
348 for (Integer i = 0, is = m_exchanger->senderRanks().size(); i < is; ++i) {
349 ISerializeMessage* comm = m_exchanger->messageToSend(i);
350
351 ISerializer* isbuf = comm->serializer();
352 SerializeBuffer* sbuf = dynamic_cast<SerializeBuffer*>(isbuf);
353
354 if (sbuf)
355 sbuf->releaseBuffer();
356 }
357}
358
359/*---------------------------------------------------------------------------*/
360/*---------------------------------------------------------------------------*/
361
362void ItemsExchangeInfo2::
363readAndAllocItems()
364{
365 info(4) << "ItemsExchangeInfo2::readAndAllocItems() " << itemFamily()->name();
366
367 // The organization of the loops and the switch is not identical here to
368 // prepareToSend; for readability, they should be made similar.
369
370 // Retrieves the info of the cells of each receiver and creates the entities.
371 for (Integer i = 0, is = m_exchanger->nbReceiver(); i < is; ++i) {
372 ISerializeMessage* comm = m_exchanger->messageToReceive(i);
373 ISerializer* sbuf = comm->serializer();
374 info(5) << "Processing item message from " << comm->destination()
375 << " for family " << itemFamily()->fullName();
376 m_family_serializer->deserializeItems(sbuf, &m_receive_local_ids[i]);
377 }
378}
379
380/*---------------------------------------------------------------------------*/
381/*---------------------------------------------------------------------------*/
382
383void ItemsExchangeInfo2::
384readAndAllocSubMeshItems()
385{
386 IItemFamilyCollection child_families = itemFamily()->childFamilies();
387 for (Integer i = 0, is = m_exchanger->nbReceiver(); i < is; ++i) {
388 ISerializeMessage* comm = m_exchanger->messageToReceive(i);
389 ISerializer* sbuf = comm->serializer();
390
391 for (IItemFamily* child_family : child_families) {
392 Int64 sub_dest_item_count = sbuf->getInt64();
393 Int64UniqueArray sub_dest_uids;
394 sub_dest_uids.resize(sub_dest_item_count);
395 sbuf->getSpan(sub_dest_uids);
396 IntegerUniqueArray parent_sub_dest_lids(sub_dest_item_count);
397 itemFamily()->itemsUniqueIdToLocalId(parent_sub_dest_lids, sub_dest_uids, true);
398 ItemVectorView parent_sub_dest_items(itemFamily()->view(parent_sub_dest_lids));
399 // Temporary hack to find the associated sub-mesh
400 DynamicMesh* dn = dynamic_cast<DynamicMesh*>(child_family->mesh());
402 dn->incrementalBuilder()->addParentItems(parent_sub_dest_items, child_family->itemKind());
403 }
404 }
405
406 _applyDeserializePhase(IItemFamilySerializeStep::PH_Item);
407}
408
409/*---------------------------------------------------------------------------*/
410/*---------------------------------------------------------------------------*/
411
412void ItemsExchangeInfo2::
413readAndAllocItemRelations()
414{
415 info(4) << "ItemsExchangeInfo2::readAndAllocItemRelations() " << itemFamily()->name();
416
417 // The organization of the loops and the switch is not identical here to
418 // prepareToSend; for readability, they should be made similar.
419
420 // Retrieves the info of the cells of each receiver and creates the entities.
421 for (Integer i = 0, is = m_exchanger->nbReceiver(); i < is; ++i) {
422 ISerializeMessage* comm = m_exchanger->messageToReceive(i);
423 ISerializer* sbuf = comm->serializer();
424 info(5) << "Processing item message from " << comm->destination()
425 << " for family " << itemFamily()->fullName();
426 m_family_serializer->deserializeItemRelations(sbuf, &m_receive_local_ids[i]);
427 }
428}
429
430/*---------------------------------------------------------------------------*/
431/*---------------------------------------------------------------------------*/
432
433void ItemsExchangeInfo2::
434readGroups()
435{
436 info(4) << "ItemsExchangeInfo2::readGroups() for "
437 << m_item_family->name();
438
439 Int64UniqueArray items_in_groups_uid;
440
441 // Retrieves the info for the groups
442 for (Integer i = 0, is = m_exchanger->nbReceiver(); i < is; ++i) {
443 ISerializeMessage* comm = m_exchanger->messageToReceive(i);
444 ISerializer* sbuf = comm->serializer();
445
446 info(4) << "Processing group message from " << comm->destination()
447 << " for family " << itemFamily()->fullName();
448
449 // Checks for serialization errors.
450 Integer magic_number = sbuf->getInteger();
451 if (magic_number != GROUPS_MAGIC_NUMBER)
452 ARCANE_FATAL("Internal error: bad magic number expected={0} found={1}",
453 GROUPS_MAGIC_NUMBER, magic_number);
454
455 // Deserializes the groups
456 for (Integer i_serializer = 0; i_serializer < m_groups_serializers.size(); ++i_serializer)
457 m_groups_serializers[i_serializer]->get(sbuf, items_in_groups_uid);
458 }
459
460 _applyDeserializePhase(IItemFamilySerializeStep::PH_Group);
461}
462
463/*---------------------------------------------------------------------------*/
464/*---------------------------------------------------------------------------*/
465
466void ItemsExchangeInfo2::
467readVariables()
468{
469 info(4) << "ItemsExchangeInfo2::readVariables() for " << m_item_family->name();
470
471 // Optionally resizes the data associated with variables.
472 // NOTE GG: normally it seems to me that this is already done during
473 // the call to DynamicMesh::_internalEndUpdateInit() in _exchangeItemsNew()
474 // for all families.
475 for (IItemFamily* family : m_families_to_exchange)
476 family->_internalApi()->resizeVariables(true);
477
478 _applyDeserializePhase(IItemFamilySerializeStep::PH_Variable);
479}
480
481/*---------------------------------------------------------------------------*/
482/*---------------------------------------------------------------------------*/
483
484void ItemsExchangeInfo2::
485removeSentItems()
486{
487 // NOTE: This method is only called for particle families without ghosts.
488 IItemFamily* family = itemFamily();
489 IParticleFamily* pfamily = family->toParticleFamily();
490 if (!pfamily)
491 ARCANE_FATAL("This call is only valid for ParticleFamily. family={0}",
492 itemFamily()->name());
493 if (pfamily->getEnableGhostItems())
494 ARCANE_FATAL("This call is only valid for ParticleFamily without ghost",
495 itemFamily()->name());
496
497 info(4) << "ItemsExchangeInfo2::removeSentItems(): " << family->name();
498
499 for (Integer i = 0, is = m_exchanger->nbSender(); i < is; ++i) {
500 ISerializeMessage* comm = m_exchanger->messageToSend(i);
501 Int32 dest_rank = comm->destination().value();
502 Int32ConstArrayView dest_items_local_id = m_send_local_ids[dest_rank];
503
504 ItemVectorView dest_items = family->view(dest_items_local_id);
505
506 //NOTE: (HP) Never tested on sub-meshes with particles
507 IItemFamilyCollection child_families = itemFamily()->childFamilies();
508 for (IItemFamily* child_family : child_families) {
509 ItemVector sub_dest_items = MeshToMeshTransposer::transpose(family, child_family, dest_items);
510 IParticleFamily* child_pfamily = child_family->toParticleFamily();
511 ARCANE_CHECK_POINTER(child_pfamily);
512 child_pfamily->removeParticles(sub_dest_items.view().localIds());
513 child_family->endUpdate();
514 }
515 pfamily->removeParticles(dest_items_local_id);
516 }
517 family->endUpdate(); // Isn't this too strong because it also resizes the variables (but does it also handle groups vs partialEndUpdate)?
518}
519
520/*---------------------------------------------------------------------------*/
521/*---------------------------------------------------------------------------*/
522
523void ItemsExchangeInfo2::
524processExchange()
525{
526 m_exchanger->processExchange(m_exchanger_option);
527}
528
529/*---------------------------------------------------------------------------*/
530/*---------------------------------------------------------------------------*/
531
532void ItemsExchangeInfo2::
533finalizeExchange()
534{
535 for (IItemFamilySerializeStep* step : m_serialize_steps) {
536 step->finalize();
537 }
538}
539
540/*---------------------------------------------------------------------------*/
541/*---------------------------------------------------------------------------*/
542
543void ItemsExchangeInfo2::
544addSerializeStep(IItemFamilySerializeStep* step)
545{
546 m_serialize_steps.add(step);
547}
548
549/*---------------------------------------------------------------------------*/
550/*---------------------------------------------------------------------------*/
551
552void ItemsExchangeInfo2::
553_applySerializeStep(IItemFamilySerializeStep::ePhase phase, const ItemFamilySerializeArgs& args)
554{
555 for (IItemFamilySerializeStep* step : m_serialize_steps) {
556 if (step->phase() == phase)
557 step->serialize(args);
558 }
559}
560
561/*---------------------------------------------------------------------------*/
562/*---------------------------------------------------------------------------*/
563
564void ItemsExchangeInfo2::
565_applyDeserializePhase(IItemFamilySerializeStep::ePhase phase)
566{
567 for (IItemFamilySerializeStep* step : m_serialize_steps) {
568 if (step->phase() != phase)
569 continue;
570
571 Integer nb_receive = m_exchanger->nbReceiver();
572 {
573 auto action = IItemFamilySerializeStep::eAction::AC_BeginReceive;
574 step->notifyAction(IItemFamilySerializeStep::NotifyActionArgs(action, nb_receive));
575 }
576 for (Integer i = 0; i < nb_receive; ++i) {
577 ISerializeMessage* comm = m_exchanger->messageToReceive(i);
578 ISerializer* sbuf = comm->serializer();
579 Int32ConstArrayView local_ids = m_receive_local_ids[i].view();
580 ItemFamilySerializeArgs serialize_args(sbuf, comm->destination().value(), local_ids, i);
581 step->serialize(serialize_args);
582 }
583 {
584 auto action = IItemFamilySerializeStep::eAction::AC_EndReceive;
585 step->notifyAction(IItemFamilySerializeStep::NotifyActionArgs(action, nb_receive));
586 }
587 }
588}
589
590/*---------------------------------------------------------------------------*/
591/*---------------------------------------------------------------------------*/
592
593void ItemsExchangeInfo2::
594setParallelExchangerOption(const ParallelExchangerOptions& option)
595{
596 m_exchanger_option = option;
597 m_exchanger->setVerbosityLevel(option.verbosityLevel());
598}
599
600/*---------------------------------------------------------------------------*/
601/*---------------------------------------------------------------------------*/
602
603} // End namespace Arcane::mesh
604
605/*---------------------------------------------------------------------------*/
606/*---------------------------------------------------------------------------*/
#define ARCANE_CHECK_POINTER(ptr)
Macro returning the pointer ptr if it is not null or throwing an exception if it is null.
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Types and macros for iterating over mesh entities.
#define ENUMERATE_ITEM(name, group)
Generic enumerator for a node group.
Integer size() const
Number of elements in the vector.
void resize(Int64 s)
Changes the number of elements in the array to s.
void add(ConstReferenceType val)
Adds element val to the end of the array.
void reserve(Int64 new_capacity)
Reserves memory for new_capacity elements.
Constant view of an array of type T.
Interface for a step in the serialization of entity families.
virtual void notifyAction(const NotifyActionArgs &args)=0
Notifies the instance that we are entering a certain phase of the exchange.
virtual ePhase phase() const =0
Serialization phase where this instance is involved.
virtual void serialize(const ItemFamilySerializeArgs &args)=0
Serializes into/from buf.
Interface of an entity family.
Definition IItemFamily.h:83
virtual IParticleFamily * toParticleFamily()=0
Returns the interface of the particle family for this family.
virtual String name() const =0
Family name.
virtual ItemVectorView view(Int32ConstArrayView local_ids)=0
View on the entities.
virtual void endUpdate()=0
Notifies the end of modification of the entity list.
Interface of a particle family.
virtual bool getEnableGhostItems() const =0
Retrieves the flag to manage ghost particles for the family.
virtual Integer getInteger()=0
Retrieve a size.
virtual Int64 getInt64()=0
Retrieve a size.
virtual void allocateBuffer()=0
Allocates the serializer memory.
virtual void put(Span< const Real > values)=0
Add the array values.
virtual void putSpan(Span< const Real > values)
Add the array values.
virtual void getSpan(Span< Real > values)
Retrieve the array values.
virtual void reserveSpan(eBasicDataType dt, Int64 n)=0
Reserves memory for n values of dt.
virtual void setMode(eMode new_mode)=0
Sets the current mode.
virtual void putInt64(Int64 value)=0
Add the integer value.
Arguments for the serialization callbacks of entity families.
View of a list to obtain information about entities.
View on a vector of entities.
Int32ConstArrayView localIds() const
Array of local IDs of entities.
Entity vector.
Definition ItemVector.h:60
ItemVectorView view() const
View of the vector.
Definition ItemVector.h:115
Int32 size() const
Number of elements in the vector.
Definition ItemVector.h:106
Base class for a mesh element.
Definition Item.h:84
Int32 owner() const
Owner subdomain number of the entity.
Definition Item.h:252
constexpr bool isOwn() const
true if the entity belongs to the subdomain
Definition Item.h:267
static ItemVector transpose(IMesh *meshA, IMesh *meshB, ItemVectorView itemsA, bool do_fatal=false)
Transpose itemsA from meshB to items on meshB.
virtual MessageRank destination() const =0
Destination rank (if isSend() is true) or sender.
virtual ISerializer * serializer()=0
Serializer.
Int32 value() const
Rank value.
Definition MessageRank.h:76
Options for IParallelMng::processExchange().
Int32 verbosityLevel() const
Verbosity level.
void setVerbosityLevel(Int32 v)
Sets the verbosity level.
Implementation of a buffer for serialization.
TraceMessage info() const
Flow for an information message.
1D data vector with value semantics (STL style).
void addParentItems(const ItemVectorView &items, const eItemKind submesh_kind)
Add to the current mesh items coming from a parent mesh.
Implementation of a mesh.
Definition DynamicMesh.h:98
Serializes the entities of the groups.
UniqueArray< ItemGroupsSerializer2 * > m_groups_serializers
Serializer of groups.
UniqueArray< SharedArray< Int32 > > m_receive_local_ids
List of local IDs of received entities.
UniqueArray< IItemFamily * > m_families_to_exchange
List of families included in the exchange.
IItemFamily * itemFamily() override
Associated family.
UniqueArray< SharedArray< Int32 > > m_send_local_ids
List of entities to send to each processor.
ItemVariableScalarRefT< Int32 > VariableItemInt32
32-bit integer type quantity
Ref< IParallelExchanger > createExchangerRef(IParallelMng *pm)
Returns an interface to transfer messages between ranks.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
UniqueArray< Int64 > Int64UniqueArray
Dynamic 1D array of 64-bit integers.
Definition UtilsTypes.h:339
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
Collection< IItemFamily * > IItemFamilyCollection
Collection of item families.
@ IK_Particle
Particle mesh entity.
ARCCORE_SERIALIZE_EXPORT Ref< ISerializer > createSerializer()
Creates an instance of ISerializer.
Array< Int32 > Int32Array
Dynamic one-dimensional array of 32-bit integers.
Definition UtilsTypes.h:127
UniqueArray< Integer > IntegerUniqueArray
Dynamic 1D array of integers.
Definition UtilsTypes.h:347
std::int32_t Int32
Signed integer type of 32 bits.