Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
NewWithLegacyConnectivity.h
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/* ConnectivityNewWithDependenciesInfo.h (C) 2000-2024 */
9/* */
10/* Info for new connectivity mode (with dependencies) */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MESH_CONNECTIVITYNEWWITHDEPENDENCIESINFO_H
13#define ARCANE_MESH_CONNECTIVITYNEWWITHDEPENDENCIESINFO_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
20
21#include "arcane/core/IIncrementalItemConnectivity.h"
22
23#include "arcane/mesh/MeshGlobal.h"
24#include "arcane/mesh/ConnectivityNewWithDependenciesTypes.h"
25#include "arcane/mesh/IncrementalItemConnectivity.h"
26#include "arcane/mesh/CompactIncrementalItemConnectivity.h"
27#include "arcane/mesh/ItemConnectivitySelector.h"
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32namespace Arcane::mesh
33{
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
38// todo rename the file in NewWithLegacyConnectivity
39
40/*---------------------------------------------------------------------------*/
45
46template <class SourceFamily, class TargetFamily, class LegacyType, class CustomType = IncrementalItemConnectivity>
47class ARCANE_MESH_EXPORT NewWithLegacyConnectivity
48: public ItemConnectivitySelectorT<LegacyType, CustomType>
51{
53
54 public:
55
56 friend class ConnectivityItemVector;
57
58 public:
59
60 NewWithLegacyConnectivity(ItemFamily* source_family, IItemFamily* target_family, const String& name)
61 : ItemConnectivitySelectorT<LegacyType, CustomType>(source_family, target_family, name)
62 {
63 //build selector
64 Base::template build<SourceFamily, TargetFamily>(); // Create adapted custom connectivity
65 }
66
67 typedef ItemConnectivitySelectorT<LegacyType, CustomType> Base;
68
69 String name() const override { return Base::trueCustomConnectivity()->name(); }
70
71 bool isEmpty() const
72 {
73 return false;
74 }
75
77 ConstArrayView<IItemFamily*> families() const override { return Base::trueCustomConnectivity()->families(); }
78
80 IItemFamily* sourceFamily() const override { return Base::trueCustomConnectivity()->sourceFamily(); }
81
83 IItemFamily* targetFamily() const override { return Base::trueCustomConnectivity()->targetFamily(); }
84
86 void addConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) override { Base::addConnectedItem(source_item, target_local_id); }
87
89 void removeConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) override { Base::removeConnectedItem(source_item, target_local_id); }
90
92 void removeConnectedItems(ItemLocalId source_item) override { Base::removeConnectedItems(source_item); }
93
95 // Why this name difference in ItemConnectivitySelector?
96 void replaceConnectedItem(ItemLocalId source_item, Integer index, ItemLocalId target_local_id) override { Base::replaceItem(source_item, index, target_local_id); }
97
99 // Why this name difference in ItemConnectivitySelector?
100 void replaceConnectedItems(ItemLocalId source_item, Int32ConstArrayView target_local_ids) override { Base::replaceItems(source_item, target_local_ids); }
101
103 bool hasConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) const override { return Base::hasConnectedItem(source_item, target_local_id); };
104
105 //TODO: use an event mechanism.
107 void notifySourceFamilyLocalIdChanged(Int32ConstArrayView new_to_old_ids) override { Base::trueCustomConnectivity()->notifySourceFamilyLocalIdChanged(new_to_old_ids); }
108
109 //TODO: use an event mechanism.
111 void notifyTargetFamilyLocalIdChanged(Int32ConstArrayView old_to_new_ids) override { Base::trueCustomConnectivity()->notifyTargetFamilyLocalIdChanged(old_to_new_ids); }
112
114 void notifySourceItemAdded(ItemLocalId item) override { Base::trueCustomConnectivity()->notifySourceItemAdded(item); }
115
117 void notifyReadFromDump() override { Base::trueCustomConnectivity()->notifyReadFromDump(); }
118
120 Integer preAllocatedSize() const override { return Base::preAllocatedSize(); }
121
123 void setPreAllocatedSize(Integer value) override { Base::setPreAllocatedSize(value); }
124
126 void dumpStats(std::ostream& out) const override { Base::trueCustomConnectivity()->dumpStats(out); }
127
129 Integer nbConnectedItem(ItemLocalId lid) const override { return Base::trueCustomConnectivity()->nbConnectedItem(lid); }
130
132 Int32 connectedItemLocalId(ItemLocalId lid, Integer index) const override { return Base::trueCustomConnectivity()->connectedItemLocalId(lid, index); }
133
135 Int32 maxNbConnectedItem() const override { return Base::trueCustomConnectivity()->maxNbConnectedItem(); }
136
146 {
147 return Base::trueCustomConnectivity()->_internalApi();
148 }
149
150 protected:
151
153 void _initializeStorage(ConnectivityItemVector* civ) override { Base::trueCustomConnectivity()->_initializeStorage(civ); };
154
156 ItemVectorView _connectedItems(ItemLocalId item, ConnectivityItemVector& con_items) const override { return Base::trueCustomConnectivity()->_connectedItems(item, con_items); }
157};
158
159template <class SourceFamily, class TargetFamily>
166
167/*---------------------------------------------------------------------------*/
168/*---------------------------------------------------------------------------*/
169
170} // namespace Arcane::mesh
171
172/*---------------------------------------------------------------------------*/
173/*---------------------------------------------------------------------------*/
174
175#endif
Arcane configuration file.
#define ARCCORE_DEFINE_REFERENCE_COUNTED_INCLASS_METHODS()
Macro to define methods managing counters of references.
Constant view of an array of type T.
Internal Arcane API for IIncrementalItemConnectivity.
Interface for managing an incremental connectivity.
Interface of an entity family.
Definition IItemFamily.h:83
Index of an Item in a variable.
Definition ItemLocalId.h:42
View on a vector of entities.
Reference to an instance.
Thread-safe implementation of a reference counter.
class holding a new connectivity but also filling the legacy one Both custom and legacy connectivitie...
ItemVectorView _connectedItems(ItemLocalId item, ConnectivityItemVector &con_items) const override
Fills con_items with the entities connected to item.
IItemFamily * sourceFamily() const override
Source family.
void _initializeStorage(ConnectivityItemVector *civ) override
Implements the initialization of civ for this connectivity.
void replaceConnectedItem(ItemLocalId source_item, Integer index, ItemLocalId target_local_id) override
Replaces the entity at index index of source_item with the entity with localId() target_local_id.
void setPreAllocatedSize(Integer value) override
Sets the number of entities to pre-allocate for the connectivity of each entity.
String name() const override
Name of the connectivity.
void removeConnectedItems(ItemLocalId source_item) override
Removes all entities connected to source_item.
void notifyTargetFamilyLocalIdChanged(Int32ConstArrayView old_to_new_ids) override
Notifies the connectivity that the target family has been compacted.
void dumpStats(std::ostream &out) const override
Dumps statistics on usage and memory used to the stream out.
void notifySourceItemAdded(ItemLocalId item) override
Notifies the connectivity that an entity has been added to the source family.
bool hasConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) const override
Tests the existence of a connectivity between source_item and the entity with localId() target_local_...
void addConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) override
Adds the entity with localId() target_local_id to the connectivity of source_item.
Ref< IIncrementalItemTargetConnectivity > toTargetReference() override
Returns a reference to the instance.
void notifyReadFromDump() override
Notifies the connectivity that a read from a dump has been performed.
IItemFamily * targetFamily() const override
Target family.
Integer nbConnectedItem(ItemLocalId lid) const override
Number of entities connected to the source entity with local number lid.
void replaceConnectedItems(ItemLocalId source_item, Int32ConstArrayView target_local_ids) override
Replaces the entities of source_item with the entities with localId() target_local_ids.
Ref< IIncrementalItemSourceConnectivity > toSourceReference() override
Returns a reference to the instance.
Int32 connectedItemLocalId(ItemLocalId lid, Integer index) const override
localId() of the index-th entity connected to the source entity with local number lid
Integer preAllocatedSize() const override
Number of pre-allocated entities for the connectivity of each entity.
Int32 maxNbConnectedItem() const override
Maximum number of entities connected to a source entity.
void removeConnectedItem(ItemLocalId source_item, ItemLocalId target_local_id) override
Removes the entity with localId() target_local_id from the connectivity of source_item.
void notifySourceFamilyLocalIdChanged(Int32ConstArrayView new_to_old_ids) override
Notifies the connectivity that the source family has been compacted.
IIncrementalItemConnectivityInternal * _internalApi() override
Internal Arcane API.
ConstArrayView< IItemFamily * > families() const override
List of families (sourceFamily() + targetFamily()).
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
Definition UtilsTypes.h:482
std::int32_t Int32
Signed integer type of 32 bits.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Creates a reference on a pointer.