Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
AbstractItemFamilyTopologyModifier.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2023 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/* AbstractItemFamilyTopologyModifier.cc (C) 2000-2023 */
9/* */
10/* Modification de la topologie des entités d'une famille. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/NotSupportedException.h"
15#include "arcane/utils/FatalErrorException.h"
16
17#include "arcane/IItemFamily.h"
18#include "arcane/Item.h"
19#include "arcane/ItemInfoListView.h"
20
21#include "arcane/mesh/AbstractItemFamilyTopologyModifier.h"
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arcane::mesh
27{
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32AbstractItemFamilyTopologyModifier::
33AbstractItemFamilyTopologyModifier(IItemFamily* afamily)
34: TraceAccessor(afamily->traceMng())
35, m_family(afamily)
36{
37}
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
42IItemFamily* AbstractItemFamilyTopologyModifier::
43family() const
44{
45 return m_family;
46}
47
48/*---------------------------------------------------------------------------*/
49/*---------------------------------------------------------------------------*/
54inline Integer AbstractItemFamilyTopologyModifier::
55_getItemIndex(const Int32* items,Integer nb_item,Int32 local_id)
56{
57 for( Integer i=0; i<nb_item; ++i )
58 if (items[i] == local_id)
59 return i;
60 ARCANE_FATAL("Can not find item to replace local_id={0}",local_id);
61}
62
63/*---------------------------------------------------------------------------*/
64/*---------------------------------------------------------------------------*/
65
66inline Integer AbstractItemFamilyTopologyModifier::
67_getItemIndex(ItemVectorView items,Int32 local_id)
68{
69 return _getItemIndex(items.localIds().data(),items.size(),local_id);
70}
71
72/*---------------------------------------------------------------------------*/
73/*---------------------------------------------------------------------------*/
74
75void AbstractItemFamilyTopologyModifier::
76_throwNotSupported()
77{
78 ARCANE_THROW(NotSupportedException,"Connectivity modification not supported for family name={0}",
79 m_family->name());
80}
81
82/*---------------------------------------------------------------------------*/
83/*---------------------------------------------------------------------------*/
84
85void AbstractItemFamilyTopologyModifier::
86replaceNode(ItemLocalId item_lid,Integer index,ItemLocalId new_node_lid)
87{
88 ARCANE_UNUSED(item_lid);
89 ARCANE_UNUSED(index);
90 ARCANE_UNUSED(new_node_lid);
91 _throwNotSupported();
92}
93
94/*---------------------------------------------------------------------------*/
95/*---------------------------------------------------------------------------*/
96
97void AbstractItemFamilyTopologyModifier::
98replaceEdge(ItemLocalId item_lid,Integer index,ItemLocalId new_edge_lid)
99{
100 ARCANE_UNUSED(item_lid);
101 ARCANE_UNUSED(index);
102 ARCANE_UNUSED(new_edge_lid);
103 _throwNotSupported();
104}
105
106/*---------------------------------------------------------------------------*/
107/*---------------------------------------------------------------------------*/
108
109void AbstractItemFamilyTopologyModifier::
110replaceFace(ItemLocalId item_lid,Integer index,ItemLocalId new_face_lid)
111{
112 ARCANE_UNUSED(item_lid);
113 ARCANE_UNUSED(index);
114 ARCANE_UNUSED(new_face_lid);
115 _throwNotSupported();
116}
117
118/*---------------------------------------------------------------------------*/
119/*---------------------------------------------------------------------------*/
120
121void AbstractItemFamilyTopologyModifier::
122replaceCell(ItemLocalId item_lid,Integer index,ItemLocalId new_cell_lid)
123{
124 ARCANE_UNUSED(item_lid);
125 ARCANE_UNUSED(index);
126 ARCANE_UNUSED(new_cell_lid);
127 _throwNotSupported();
128}
129
130/*---------------------------------------------------------------------------*/
131/*---------------------------------------------------------------------------*/
132
133void AbstractItemFamilyTopologyModifier::
134replaceHParent(ItemLocalId item_lid,Integer index,ItemLocalId new_hparent_lid)
135{
136 ARCANE_UNUSED(item_lid);
137 ARCANE_UNUSED(index);
138 ARCANE_UNUSED(new_hparent_lid);
139 _throwNotSupported();
140}
141
142/*---------------------------------------------------------------------------*/
143/*---------------------------------------------------------------------------*/
144
145void AbstractItemFamilyTopologyModifier::
146replaceHChild(ItemLocalId item_lid,Integer index,ItemLocalId new_hchild_lid)
147{
148 ARCANE_UNUSED(item_lid);
149 ARCANE_UNUSED(index);
150 ARCANE_UNUSED(new_hchild_lid);
151 _throwNotSupported();
152}
153
154/*---------------------------------------------------------------------------*/
155/*---------------------------------------------------------------------------*/
156
157void AbstractItemFamilyTopologyModifier::
158findAndReplaceNode(ItemLocalId item_lid, ItemLocalId old_node_lid,
160{
161 impl::ItemBase ii = m_family->itemInfoListView()[item_lid].itemBase();
162 Int32 index = _getItemIndex(ii.nodeList(), old_node_lid);
163 this->replaceNode(ii.itemLocalId(), index, new_node_lid);
164}
165
166/*---------------------------------------------------------------------------*/
167/*---------------------------------------------------------------------------*/
168
169void AbstractItemFamilyTopologyModifier::
170findAndReplaceEdge(ItemLocalId item_lid, ItemLocalId old_edge_lid,
172{
173 impl::ItemBase ii = m_family->itemInfoListView()[item_lid].itemBase();
174 Int32 index = _getItemIndex(ii.edgeList(), old_edge_lid);
175 this->replaceEdge(ii.itemLocalId(), index, new_edge_lid);
176}
177
178/*---------------------------------------------------------------------------*/
179/*---------------------------------------------------------------------------*/
180
181void AbstractItemFamilyTopologyModifier::
182findAndReplaceFace(ItemLocalId item_lid, ItemLocalId old_face_lid,
184{
185 impl::ItemBase ii = m_family->itemInfoListView()[item_lid].itemBase();
186 Int32 index = _getItemIndex(ii.faceList(), old_face_lid);
187 this->replaceFace(ii.itemLocalId(), index, new_face_lid);
188}
189
190/*---------------------------------------------------------------------------*/
191/*---------------------------------------------------------------------------*/
192
193void AbstractItemFamilyTopologyModifier::
194findAndReplaceCell(ItemLocalId item_lid, ItemLocalId old_cell_lid,
196{
197 impl::ItemBase ii = m_family->itemInfoListView()[item_lid].itemBase();
198 Int32 index = _getItemIndex(ii.cellList(), old_cell_lid);
199 this->replaceCell(ii.itemLocalId(), index, new_cell_lid);
200}
201
202/*---------------------------------------------------------------------------*/
203/*---------------------------------------------------------------------------*/
204
205}
206
207/*---------------------------------------------------------------------------*/
208/*---------------------------------------------------------------------------*/
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Interface d'une famille d'entités.
Classe de base pour les entités du maillage.
Index d'un Item dans une variable.
Definition ItemLocalId.h:40
Vue sur un vecteur d'entités.
Int32 size() const
Nombre d'éléments du vecteur.
Int32ConstArrayView localIds() const
Tableau des numéros locaux des entités.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
constexpr const_pointer data() const noexcept
Pointeur sur la mémoire allouée.
const String & name() const
Nom de l'exception.
Exception lorsqu'une opération n'est pas supportée.