Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
UnstructuredMeshConnectivity.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/* UnstructuredMeshConnectivity.cc (C) 2000-2023 */
9/* */
10/* Unstructured mesh connectivity information. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/UnstructuredMeshConnectivity.h"
15
16#include "arcane/utils/FatalErrorException.h"
17
18#include "arcane/core/IMesh.h"
19#include "arcane/core/IItemFamily.h"
20#include "arcane/core/internal/IItemFamilyInternal.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31namespace
32{
33
34 inline constexpr Int32 _IDX(Node*)
35 {
36 return ItemInternalConnectivityList::NODE_IDX;
37 }
38 inline constexpr Int32 _IDX(Edge*)
39 {
40 return ItemInternalConnectivityList::EDGE_IDX;
41 }
42 inline constexpr Int32 _IDX(Face*)
43 {
44 return ItemInternalConnectivityList::FACE_IDX;
45 }
46 inline constexpr Int32 _IDX(Cell*)
47 {
48 return ItemInternalConnectivityList::CELL_IDX;
49 }
50
51 template <typename ConnectivityView> inline void
52 _internalInit(ConnectivityView& cview, IMesh* mesh)
53 {
54 using ItemType1 = typename ConnectivityView::ItemType1Type;
55 using ItemType2 = typename ConnectivityView::ItemType2Type;
56
59
60 IItemFamily* family = mesh->itemFamily(ik1);
61 ItemInternalConnectivityList* clist = family->_internalApi()->unstructuredItemInternalConnectivityList();
62 auto item_index_type = _IDX((ItemType2*)nullptr);
63 auto container_view = clist->containerView(item_index_type);
64 cview = IndexedItemConnectivityViewBase(container_view, ik1, ik2);
65 }
66} // namespace
67
68/*---------------------------------------------------------------------------*/
69/*---------------------------------------------------------------------------*/
70
71void UnstructuredMeshConnectivityView::
72setMesh(IMesh* mesh)
73{
74 m_mesh = mesh;
75
76 _internalInit(m_cell_node_connectivity_view, mesh);
77 _internalInit(m_cell_edge_connectivity_view, mesh);
78 _internalInit(m_cell_face_connectivity_view, mesh);
79
80 _internalInit(m_face_node_connectivity_view, mesh);
81 _internalInit(m_face_edge_connectivity_view, mesh);
82 _internalInit(m_face_cell_connectivity_view, mesh);
83
84 _internalInit(m_node_edge_connectivity_view, mesh);
85 _internalInit(m_node_face_connectivity_view, mesh);
86 _internalInit(m_node_cell_connectivity_view, mesh);
87
88 _internalInit(m_edge_node_connectivity_view, mesh);
89 _internalInit(m_edge_face_connectivity_view, mesh);
90 _internalInit(m_edge_cell_connectivity_view, mesh);
91}
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
96void UnstructuredMeshConnectivityView::
97_checkValid() const
98{
99 if (!m_mesh)
100 ARCANE_FATAL("Can not use unitialised UnstructuredMeshConnectivityView.\n"
101 "Call the method setMesh() before");
102}
103
104/*---------------------------------------------------------------------------*/
105/*---------------------------------------------------------------------------*/
106
107} // End namespace Arcane
108
109/*---------------------------------------------------------------------------*/
110/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Cell of a mesh.
Definition Item.h:1300
Edge of a cell.
Definition Item.h:875
Face of a cell.
Definition Item.h:1032
Interface of an entity family.
Definition IItemFamily.h:83
Base class for a view on unstructured connectivity.
static eItemKind kind()
Entity kind.
Definition ItemTypes.h:629
Node of a mesh.
Definition Item.h:598
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
eItemKind
Mesh entity type.
std::int32_t Int32
Signed integer type of 32 bits.