Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IndexedItemConnectivityView.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/* IndexedItemConnectivityView.cc (C) 2000-2026 */
9/* */
10/* Views on connectivities using indices. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/IndexedItemConnectivityView.h"
15
16#include "arcane/core/ItemGroup.h"
17#include "arcane/core/IItemFamily.h"
18#include "arcane/core/IParticleFamily.h"
19#include "arcane/core/internal/IItemFamilyInternal.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30// Function used to test compilation with access to connectivities
31
32extern "C++" void
33_internalItemTestCompile()
34{
35 IndexedCellNodeConnectivityView cell_node;
36 IndexedCellEdgeConnectivityView cell_edge;
37 IndexedCellFaceConnectivityView cell_face;
38 IndexedCellCellConnectivityView cell_cell;
39 IndexedCellDoFConnectivityView cell_dof;
40
41 IndexedFaceNodeConnectivityView face_node;
42 IndexedFaceEdgeConnectivityView face_edge;
43 IndexedFaceFaceConnectivityView face_face;
44 IndexedFaceCellConnectivityView face_cell;
45 IndexedFaceDoFConnectivityView face_dof;
46
47 IndexedEdgeNodeConnectivityView edge_node;
48 IndexedEdgeEdgeConnectivityView edge_edge;
49 IndexedEdgeFaceConnectivityView edge_face;
50 IndexedEdgeCellConnectivityView edge_cell;
51 IndexedEdgeDoFConnectivityView edge_dof;
52
53 IndexedNodeNodeConnectivityView node_node;
54 IndexedNodeEdgeConnectivityView node_edge;
55 IndexedNodeFaceConnectivityView node_face;
56 IndexedNodeCellConnectivityView node_cell;
57 IndexedNodeDoFConnectivityView node_dof;
58
59 IndexedDoFNodeConnectivityView dof_node;
60 IndexedDoFEdgeConnectivityView dof_edge;
61 IndexedDoFFaceConnectivityView dof_face;
62 IndexedDoFCellConnectivityView dof_cell;
63 IndexedDoFDoFConnectivityView dof_dof;
64
65 ItemGroup items;
66 Int64 total = 0;
67
68 ENUMERATE_ (Node, inode, items) {
69 Node xnode = *inode;
70 for (NodeLocalId node : node_node.nodes(xnode)) {
71 total += node.localId();
72 }
73 for (EdgeLocalId edge : node_edge.edges(xnode)) {
74 total += edge.localId();
75 }
76 for (FaceLocalId face : node_face.faces(xnode)) {
77 total += face.localId();
78 }
79 for (CellLocalId cell : node_cell.cells(xnode)) {
80 total += cell.localId();
81 }
82 for (DoFLocalId dof : node_dof.dofs(xnode)) {
83 total += dof.localId();
84 }
85 }
86
87 ENUMERATE_ (Cell, icell, items) {
88 Cell xcell = *icell;
89 for (NodeLocalId node : cell_node.nodes(xcell)) {
90 total += node.localId();
91 }
92 for (EdgeLocalId edge : cell_edge.edges(xcell)) {
93 total += edge.localId();
94 }
95 for (FaceLocalId face : cell_face.faces(xcell)) {
96 total += face.localId();
97 }
98 for (CellLocalId cell : cell_cell.cells(xcell)) {
99 total += cell.localId();
100 }
101 for (DoFLocalId dof : cell_dof.dofs(xcell)) {
102 total += dof.localId();
103 }
104 }
105
106 ENUMERATE_ (Edge, iedge, items) {
107 Edge xedge = *iedge;
108 for (NodeLocalId node : edge_node.nodes(xedge)) {
109 total += node.localId();
110 }
111 for (EdgeLocalId edge : edge_edge.edges(xedge)) {
112 total += edge.localId();
113 }
114 for (FaceLocalId face : edge_face.faces(xedge)) {
115 total += face.localId();
116 }
117 for (CellLocalId cell : edge_cell.cells(xedge)) {
118 total += cell.localId();
119 }
120 for (DoFLocalId dof : edge_dof.dofs(xedge)) {
121 total += dof.localId();
122 }
123 }
124
125 ENUMERATE_ (Face, iface, items) {
126 Face xface = *iface;
127 for (NodeLocalId node : face_node.nodes(xface)) {
128 total += node.localId();
129 }
130 for (EdgeLocalId edge : face_edge.edges(xface)) {
131 total += edge.localId();
132 }
133 for (FaceLocalId face : face_face.faces(xface)) {
134 total += face.localId();
135 }
136 for (CellLocalId cell : face_cell.cells(xface)) {
137 total += cell.localId();
138 }
139 for (DoFLocalId dof : face_dof.dofs(xface)) {
140 total += dof.localId();
141 }
142 }
143
144 ENUMERATE_ (DoF, idof, items) {
145 DoF xdof = *idof;
146 for (NodeLocalId node : dof_node.nodes(xdof)) {
147 total += node.localId();
148 }
149 for (EdgeLocalId edge : dof_edge.edges(xdof)) {
150 total += edge.localId();
151 }
152 for (FaceLocalId face : dof_face.faces(xdof)) {
153 total += face.localId();
154 }
155 for (CellLocalId cell : dof_cell.cells(xdof)) {
156 total += cell.localId();
157 }
158 for (DoFLocalId dof : dof_dof.dofs(xdof)) {
159 total += dof.localId();
160 }
161 }
162
163 std::cout << "TOTAL=" << total << "\n";
164}
165
166/*---------------------------------------------------------------------------*/
167/*---------------------------------------------------------------------------*/
168
169IndexedParticleCellConnectivityView::
170IndexedParticleCellConnectivityView(IParticleFamily* pf)
171: IndexedParticleCellConnectivityView(pf->itemFamily())
172{
173}
174
175/*---------------------------------------------------------------------------*/
176/*---------------------------------------------------------------------------*/
177
178IndexedParticleCellConnectivityView::
179IndexedParticleCellConnectivityView(IItemFamily* family)
180{
181 ItemInternalConnectivityList* clist = family->_internalApi()->unstructuredItemInternalConnectivityList();
182 m_container_view = clist->containerView(IK_Cell);
183}
184
185/*---------------------------------------------------------------------------*/
186/*---------------------------------------------------------------------------*/
187
188MutableIndexedParticleCellConnectivityView::
189MutableIndexedParticleCellConnectivityView(IParticleFamily* pf)
190: MutableIndexedParticleCellConnectivityView(pf->itemFamily())
191{
192}
193
194/*---------------------------------------------------------------------------*/
195/*---------------------------------------------------------------------------*/
196
197MutableIndexedParticleCellConnectivityView::
198MutableIndexedParticleCellConnectivityView(IItemFamily* family)
199{
200 ItemInternalConnectivityList* clist = family->_internalApi()->unstructuredItemInternalConnectivityList();
201 m_container_view = clist->containerView(IK_Cell);
202}
203
204/*---------------------------------------------------------------------------*/
205/*---------------------------------------------------------------------------*/
206
207} // namespace Arcane
208
209/*---------------------------------------------------------------------------*/
210/*---------------------------------------------------------------------------*/
#define ENUMERATE_(type, name, group)
Generic enumerator for an entity group.
Cell of a mesh.
Definition Item.h:1300
degree of freedom class.
Definition Item.h:1649
Edge of a cell.
Definition Item.h:875
Face of a cell.
Definition Item.h:1032
Interface of a particle family.
Mesh entity group.
Definition ItemGroup.h:51
Node of a mesh.
Definition Item.h:598
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.