Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arcane/src/arcane/core/InterfaceImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
#include "arcane/core/internal/IVariableSynchronizerMngInternal.h"
#include "arcane/core/internal/IIncrementalItemConnectivityInternal.h"
#include "arcane/core/internal/IPolyhedralMeshModifier.h"
#include "arcane/core/internal/IItemFamilySerializerMngInternal.h"

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
Expand Down
56 changes: 53 additions & 3 deletions arcane/src/arcane/core/ItemAllocationInfo.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: Apache-2.0
//-----------------------------------------------------------------------------
/*---------------------------------------------------------------------------*/
/* ItemAllocationInfo (C) 2000-2023 */
/* ItemAllocationInfo (C) 2000-2025 */
/* */
/* AllocationInfo for mesh using eItemAllocationInfo mode */
/*---------------------------------------------------------------------------*/
Expand Down Expand Up @@ -37,18 +37,68 @@ class ItemAllocationInfo
String connectivity_name;
Int32ConstSmallSpan nb_connected_items_per_item;
Int64ConstSmallSpan connected_items_uids;
// If ItemAllocation has to own the data use the followings.
// In this case, Store a view in the corresponding spans using method updateViewsFromInternalData().
Int32UniqueArray _nb_connected_items_per_item_data;
Int64UniqueArray _connected_items_uids_data;

void updateViewsFromInternalData()
{
nb_connected_items_per_item = _nb_connected_items_per_item_data.constSmallSpan();
connected_items_uids = _connected_items_uids_data.constSmallSpan();
}
};

struct FamilyInfo
{
String name;
eItemKind item_kind;
Int64ConstSmallSpan item_uids;
UniqueArray<ConnectedFamilyInfo> connected_family_info;
UniqueArray<ConnectedFamilyInfo> connected_family_infos;
Real3ConstSmallSpan item_coordinates; // if needed
String item_coordinates_variable_name; // if needed
Int32UniqueArray item_owners; // if needed
// If ItemAllocation has to own the data use the followings.
// In this case, Store a view in the corresponding spans using method updateViewsFromInternalData().
Int64UniqueArray _item_uids_data;
Real3UniqueArray _item_coordinates_data;

void updateViewsFromInternalData()
{
item_uids = _item_uids_data.constSmallSpan();
item_coordinates = _item_coordinates_data.constSmallSpan();
for (auto& connected_family_info : connected_family_infos) {
connected_family_info.updateViewsFromInternalData();
}
}

void clear()
{
name = String{};
item_kind = IK_Unknown;
item_uids = Int64ConstSmallSpan{};
connected_family_infos.clear();
item_coordinates = Real3ConstSmallSpan{};
item_coordinates_variable_name = String{};
_item_uids_data.clear();
_item_coordinates_data.clear();
item_owners.clear();
}
};
UniqueArray<FamilyInfo> family_infos;

// To use if ItemAllocationInfo has to own the data. The views will point to the stored data
void updateViewsFromInternalData()
{
for (auto& family_info : family_infos) {
family_info.updateViewsFromInternalData();
}
}

void clear()
{
family_infos.clear();
}
};

} // End namespace Arcane
Expand Down
56 changes: 56 additions & 0 deletions arcane/src/arcane/core/internal/IItemFamilySerializerMngInternal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: Apache-2.0
//-----------------------------------------------------------------------------
/*---------------------------------------------------------------------------*/
/* IItemFamilySerializerMngInternal.h (C) 2000-2025 */
/* */
/* Gestionnaire des outils de sérialisation/désérialisation d'une famille. */
/*---------------------------------------------------------------------------*/
#ifndef ARCANE_CORE_IITEMFAMILYSERIALIZERMNGINTERNAL_H
#define ARCANE_CORE_IITEMFAMILYSERIALIZERMNGINTERNAL_H
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/


/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

namespace Arcane
{
class IItemFamily;

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/*!
* \brief Gère la sérialisation/désérialisation des entités d'une famille.
*/
class ARCANE_CORE_EXPORT IItemFamilySerializerMngInternal
{
public:

virtual ~IItemFamilySerializerMngInternal() = default;

public:

/*!
* \brief Finalise les allocations réalisées par les serializers enregistrés dans le gestionnaire.
*
* Utilisé pour le maillage polyédrique où les allocations ne sont réalisées qu'après avoir
* effectué toutes les sérialisations pour toutes les familles
*/
virtual void finalizeItemAllocation() = 0;
};

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

} // namespace Arcane

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

#endif

13 changes: 13 additions & 0 deletions arcane/src/arcane/core/internal/IMeshInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace Arcane

class IItemConnectivityMng;
class IPolyhedralMeshModifier;
class IItemFamilySerializerMngInternal;

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
Expand Down Expand Up @@ -62,6 +63,18 @@ class ARCANE_CORE_EXPORT IMeshInternal
* Cette méthode retourne nullptr si l'implémentation du maillage n'est pas PolyhedralMesh
*/
virtual IPolyhedralMeshModifier* polyhedralMeshModifier() const noexcept = 0;

/*!
* \brief Renvoie le gestionnaire des outils de sérialisation des familles.
*
* Ce gestionnaire est utilisé pour le maillage polyédrique, afin de lancer une
* phase de finalisation de l'ajout des items après l'appel aux méthodes de désérialisation,
* car ces méthodes sont asynchrones et il faut déclencher la phase de finalisation.
*
* @return Cette méthode retourne nullptr si le gestionnaire n'existe pas.
*/
virtual IItemFamilySerializerMngInternal* familySerializerMng() const noexcept {return nullptr;}

};


Expand Down
1 change: 1 addition & 0 deletions arcane/src/arcane/core/internal/IPolyhedralMeshModifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class ARCANE_CORE_EXPORT IPolyhedralMeshModifier
virtual ~IPolyhedralMeshModifier() = default;

virtual void addItems(Int64ConstArrayView unique_ids, Int32ArrayView local_ids, eItemKind ik, const String& family_name) = 0;
virtual void addItems(Int64ConstArrayView unique_ids, Int32ArrayView local_ids, Int32ConstArrayView owners, eItemKind ik, const String& family_name) = 0;
virtual void removeItems(Int32ConstArrayView local_ids, eItemKind ik, const String& family_name) = 0;
};

Expand Down
1 change: 1 addition & 0 deletions arcane/src/arcane/core/srcs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ set(ARCANE_INTERNAL_SOURCES
internal/VtkCellTypes.h
internal/ParallelMngInternal.h
internal/ParallelMngInternal.cc
internal/IItemFamilySerializerMngInternal.h
)

set(ARCANE_ORIGINAL_SOURCES
Expand Down
18 changes: 16 additions & 2 deletions arcane/src/arcane/mesh/ItemData.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: Apache-2.0
//-----------------------------------------------------------------------------
/*---------------------------------------------------------------------------*/
/* ItemData.cc (C) 2000-2024 */
/* ItemData.cc (C) 2000-2025 */
/* */
/* Class gathering item data : ids and connectivities */
/*---------------------------------------------------------------------------*/
Expand Down Expand Up @@ -112,6 +112,20 @@ _deserialize(ISerializer* buffer, IMesh* mesh)
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

void ItemData::
clear()
{
m_nb_items = 0;
m_item_infos.clear();
_internal_item_lids.clear();
m_item_lids = Int32ArrayView();
m_item_owners.clear();
m_item_family = nullptr;
m_item_family_modifier = nullptr;
m_subdomain_id = -1;
}


} // End namespace Arcane::mesh

/*---------------------------------------------------------------------------*/
Expand Down
21 changes: 14 additions & 7 deletions arcane/src/arcane/mesh/ItemData.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: Apache-2.0
//-----------------------------------------------------------------------------
/*---------------------------------------------------------------------------*/
/* ItemData.h (C) 2000-2018 */
/* ItemData.h (C) 2000-2025 */
/* */
/* Class gathering item data : ids and connectivities */
/*---------------------------------------------------------------------------*/
Expand Down Expand Up @@ -77,7 +77,10 @@ class ARCANE_MESH_EXPORT ItemData
, m_item_lids(item_lids)
, m_item_family(item_family)
, m_item_family_modifier(item_family_modifier)
, m_subdomain_id(subdomain_id){}
, m_subdomain_id(subdomain_id)
{
_ownerDefaultInit();
}

/*! Ici on ne fournit pas les item_lids qui sont donc créés en internes.
*
Expand All @@ -90,7 +93,10 @@ class ARCANE_MESH_EXPORT ItemData
, m_item_lids(_internal_item_lids)
, m_item_family(item_family)
, m_item_family_modifier(item_family_modifier)
, m_subdomain_id(subdomain_id){}
, m_subdomain_id(subdomain_id)
{
_ownerDefaultInit();
}

/** Destructeur de la classe */
virtual ~ItemData() {}
Expand All @@ -101,7 +107,8 @@ class ARCANE_MESH_EXPORT ItemData
Int64Array& itemInfos() {return m_item_infos;} // Need to return Array& since size is not always known at construction
Int64ConstArrayView itemInfos() const {return m_item_infos;}
Int32ArrayView itemLids() {return m_item_lids;}
Int32ArrayView itemOwners() { if (m_item_owners.empty()) _ownerDefaultInit(); return m_item_owners;}
Int32ArrayView itemOwners() { return m_item_owners;}
Int32ConstArrayView itemOwners() const { return m_item_owners;}
IItemFamily* itemFamily() {return m_item_family;}
IItemFamily const* itemFamily() const {return m_item_family;}
IItemFamilyModifier* itemFamilyModifier() {return m_item_family_modifier;}
Expand All @@ -110,9 +117,9 @@ class ARCANE_MESH_EXPORT ItemData
void serialize(ISerializer* buffer); // Fill the buffer from the data
void deserialize(ISerializer* buffer, IMesh* mesh); // Fill the buffer from the data : using an internal lids array
void deserialize(ISerializer* buffer, IMesh* mesh, Int32Array& item_lids); // Fill the data from the buffer using external lids array. item_lids must live as long as ItemData does...
void clear(); // Clear all internal data


private:
private:

void _deserialize(ISerializer* buffer, IMesh* mesh);
void _ownerDefaultInit() { m_item_owners.resize(m_nb_items); m_item_owners.fill(m_subdomain_id);}
Expand Down
3 changes: 2 additions & 1 deletion arcane/src/arcane/mesh/ItemGroupsSynchronize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,15 @@ checkSynchronize()
// TODO: vérifier que tous les sous-domaines ont les mêmes groupes.
Integer nb_diff = 0;
for( const ItemGroup& group : m_item_family->groups() ){
if (group.isOwn()) continue;
m_var.fill(0);
ENUMERATE_ITEM(i_item,group){
m_var[*i_item] = 1;
}
Integer diff = m_var.checkIfSync(10);
if (diff!=0){
error() << "Group is not in sync (name=" << group.name()
<< ", nb_diff=" << nb_diff << ")";
<< ", nb_diff=" << diff << ")";
}
nb_diff += diff;
}
Expand Down
10 changes: 8 additions & 2 deletions arcane/src/arcane/mesh/MeshExchanger.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: Apache-2.0
//-----------------------------------------------------------------------------
/*---------------------------------------------------------------------------*/
/* MeshExchanger.cc (C) 2000-2024 */
/* MeshExchanger.cc (C) 2000-2025 */
/* */
/* Gestion d'un échange de maillage entre sous-domaines. */
/*---------------------------------------------------------------------------*/
Expand All @@ -26,6 +26,8 @@
#include "arcane/mesh/DynamicMesh.h"
#include "arcane/mesh/MeshExchange.h"
#include "arcane/core/internal/IMeshModifierInternal.h"
#include "arcane/core/internal/IItemFamilySerializerMngInternal.h"
#include "arcane/core/internal/IMeshInternal.h"

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
Expand Down Expand Up @@ -351,6 +353,10 @@ allocateReceivedItems()
for( IItemFamilyExchanger* e : m_family_exchangers ){
e->readAndAllocItems(); // Attention, ne procède plus sur les différents sous-maillages
}
// If needed, finalize item allocations (for polyhedral meshes)
auto* family_serializer_mng = m_mesh->_internalApi()->familySerializerMng();
if (family_serializer_mng) family_serializer_mng->finalizeItemAllocation();

// Build item relations (only dependencies are build in readAndAllocItems)
// only for families registered in the graph
if (m_mesh->itemFamilyNetwork() && m_mesh->itemFamilyNetwork()->isActivated())
Expand Down
Loading
Loading