14#include "arcane/mesh/DoFFamily.h"
16#include "arcane/core/IMesh.h"
17#include "arcane/core/ItemTypeMng.h"
18#include "arcane/core/ItemTypeInfo.h"
19#include "arcane/core/IExtraGhostItemsBuilder.h"
21#include "arcane/mesh/ExtraGhostItemsManager.h"
33getMaxItemUid(IItemFamily* family)
39 item_family->itemsMap().eachItem([&](Item item) {
40 if (max_uid < item.uniqueId().asInt64())
41 max_uid = item.uniqueId().asInt64();
53, m_shared_info(nullptr)
66 m_shared_info = _findSharedInfo(dof_type_info);
76 ARCANE_ASSERT((dof_uids.
size() == dof_lids.
size()), (
"in addDofs(uids,lids) given uids and lids array must have same size"))
78 return view(dof_lids);
88 ARCANE_ASSERT((dof_uids.
size() == dof_lids.
size() && (dof_uids.
size() == owners.
size())), (
"in addGhostDofs given uids, lids and owners array must have same size"))
90 return view(dof_lids);
102 preAllocate(nb_item);
103 for (
Integer i = 0; i < nb_item; ++i) {
104 Int64 uid = unique_ids[i];
109 m_need_prepare_dump =
true;
121 preAllocate(nb_item);
122 for (
Integer i = 0; i < nb_item; ++i) {
123 Int64 uid = unique_ids[i];
124 Int32 owner = owners[i];
129 m_need_prepare_dump =
true;
138 ARCANE_UNUSED(keep_ghost);
139 _removeMany(local_ids);
141 m_need_prepare_dump =
true;
159 debug() <<
"Creating the list of ghosts dofs";
171 info() <<
"DoFFamily: added=" << nb_added
174 <<
" map_nb_bucket=" << itemsMap().
nbBucket()
175 <<
" map_size=" << nb_in_map;
187 if (nb_hash < wanted_size)
188 itemsMap().
resize(wanted_size,
true);
194ItemInternal* DoFFamily::
195_allocDoF(
const Int64 uid)
199 ItemInternal* item_internal = ItemFamily::_findOrAllocOne(uid, need_alloc);
201 item_internal->setUniqueId(uid);
203 _allocateInfos(item_internal, uid, m_shared_info);
206 item_internal->setOwner(m_sub_domain_id, m_sub_domain_id);
207 return item_internal;
213ItemInternal* DoFFamily::
214_allocDoFGhost(
const Int64 uid,
const Int32 owner)
218 ItemInternal* item_internal = ItemFamily::_findOrAllocOne(uid, need_alloc);
221 item_internal->setUniqueId(uid);
223 _allocateInfos(item_internal, uid, m_shared_info);
226 item_internal->setOwner(owner, m_sub_domain_id);
227 return item_internal;
230ItemInternal* DoFFamily::
231_findOrAllocDoF(
const Int64 uid,
bool& is_alloc)
233 ItemInternal* item_internal = ItemFamily::_findOrAllocOne(uid, is_alloc);
235 item_internal->setUniqueId(uid);
238 _allocateInfos(item_internal, uid, m_shared_info);
240 item_internal->setOwner(m_sub_domain_id, m_sub_domain_id);
242 return item_internal;
#define ARCANE_CHECK_POINTER(ptr)
Macro returning the pointer ptr if it is not null or throwing an exception if it is null.
Integer size() const
Number of elements in the vector.
constexpr Integer size() const noexcept
Returns the size of the array.
constexpr Integer size() const noexcept
Number of elements in the array.
virtual ItemTypeMng * itemTypeMng() const =0
Associated entity type manager.
virtual Int32 subDomainId() const =0
Subdomain ID associated with this manager.
Int32 localId() const
Local number (in the subdomain) of the entity.
Internal structure of a mesh entity.
Info on a mesh entity type.
Mesh entity type manager.
ItemTypeInfo * typeFromId(Integer id) const
Type corresponding to the number id.
Unicode character string.
TraceMessageDbg debug(Trace::eDebugLevel=Trace::Medium) const
Flow for a debug message.
TraceMessage info() const
Flow for an information message.
DoFVectorView addGhostDoFs(Int64ConstArrayView dof_uids, Int32ArrayView dof_lids, Int32ConstArrayView owners) override
Adding ghosts must be followed by a call to computeSynchronizeInfos.
void computeSynchronizeInfos() override
Collective operation.
DoFFamily(IMesh *mesh, const String &name)
The family cannot be created directly; the DoFManager must be used.
DoFVectorView addDoFs(Int64ConstArrayView dof_uids, Int32ArrayView dof_lids) override
Takes the uids of the dofs and retrieves their lids.
void internalRemoveItems(Int32ConstArrayView local_ids, bool keep_ghost=false) override
Removes the entities given by local_ids.
void addGhostItems(Int64ConstArrayView unique_ids, Int32ArrayView items, Int32ConstArrayView owners) override
Allocates ghost entities.
Integer nbItem() const override
Number of entities.
void _addItems(Int64ConstArrayView unique_ids, Int32ArrayView items)
Construction of the Item Family. The DoFManager is responsible for this.
String name() const override
Family name.
UniqueArray< ItemInternal * > m_internals
ItemInternals of the entities.
Int32UniqueArray m_free_internals
List of free ItemInternals from m_item_internals_buffer.
IMesh * mesh() const override
Associated mesh.
ItemVectorView view() override
View on all entities in the family.
void computeSynchronizeInfos() override
Constructs the structures necessary for synchronization.
ISubDomain * subDomain() const override
Associated sub-domain.
Int32 nbBucket() const
Number of buckets.
void resize(Int32 new_size, bool use_prime=false)
Resizes the hash table.
Int32 count() const
Number of elements in the table.
ItemVectorViewT< DoF > DoFVectorView
View over a vector of degrees of freedom.
@ ReduceMax
Maximum of values.
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.
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
@ IK_DoF
Degree of Freedom mesh entity.
std::int32_t Int32
Signed integer type of 32 bits.