Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
MshMeshGenerationInfo.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/* MshMeshGenerationInfo.h (C) 2000-2025 */
9/* */
10/* Information about a mesh derived from the 'msh' format. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_INTERNAL_MSHMESHGENERATIONINFO_H
13#define ARCANE_CORE_INTERNAL_MSHMESHGENERATIONINFO_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/String.h"
18#include "arcane/utils/FixedArray.h"
19#include "arcane/utils/UniqueArray.h"
20
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arcane::impl
27{
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
36class ARCANE_CORE_EXPORT MshMeshGenerationInfo
37{
38 public:
39
43 class MshPhysicalName
44 {
45 public:
46
47 MshPhysicalName(Int32 dimension, Int64 tag, const String& name)
48 : m_dimension(dimension)
49 , m_tag(tag)
50 , m_name(name)
51 {}
52
54 MshPhysicalName() = default;
55
56 public:
57
59 bool isNull() const { return m_dimension == (-1); }
60 Int32 dimension() const { return m_dimension; }
61 Int64 tag() const { return m_tag; }
62 const String& name() const { return m_name; }
63
64 private:
65
66 Int32 m_dimension = -1;
67 Int64 m_tag = -1;
68 String m_name;
69 };
70
78 {
79 public:
80
81 void add(Int32 dimension, Int64 tag, const String& name)
82 {
83 m_physical_names[dimension].add(MshPhysicalName{ dimension, tag, name });
84 }
91 MshPhysicalName find(Int32 dimension, Int64 tag) const
92 {
93 for (auto& x : m_physical_names[dimension])
94 if (x.tag() == tag)
95 return x;
96 return {};
97 }
98
99 private:
100
103 };
104
106 class MshEntitiesNodes
107 {
108 public:
109
110 MshEntitiesNodes(Int64 tag, Int64 physical_tag)
111 : m_tag(tag)
112 , m_physical_tag(physical_tag)
113 {}
114
115 public:
116
117 Int64 tag() const { return m_tag; }
118 Int64 physicalTag() const { return m_physical_tag; }
119
120 private:
121
122 Int64 m_tag = -1;
123 Int64 m_physical_tag = -1;
124 };
125
127 class MshEntitiesWithNodes
128 {
129 public:
130
131 MshEntitiesWithNodes(Int32 dim, Int64 tag, Int64 physical_tag)
132 : m_dimension(dim)
133 , m_tag(tag)
134 , m_physical_tag(physical_tag)
135 {}
136
137 public:
138
139 Int32 dimension() const { return m_dimension; }
140 Int64 tag() const { return m_tag; }
141 Int64 physicalTag() const { return m_physical_tag; }
142
143 private:
144
145 Int32 m_dimension = -1;
146 Int64 m_tag = -1;
147 Int64 m_physical_tag = -1;
148 };
149
151 {
152 public:
153
154 Int32 m_entity_dim = -1;
155 Int32 m_entity_tag = -1;
156 Int32 m_entity_tag_master = -1;
159 // Number of pairs (slave, master)
160 Int32 m_nb_corresponding_node = 0;
163 };
164
167 {
168 public:
169
170 bool hasValues() const { return !m_periodic_list.empty(); }
171
172 public:
173
174 UniqueArray<MshPeriodicOneInfo> m_periodic_list;
175 };
176
177 public:
178
179 explicit MshMeshGenerationInfo(IMesh* mesh);
180
181 public:
182
183 static MshMeshGenerationInfo* getReference(IMesh* mesh, bool create);
184
185 public:
186
187 void findEntities(Int32 dimension, Int64 tag, Array<MshEntitiesWithNodes>& entities)
188 {
189 entities.clear();
190 for (auto& x : entities_with_nodes_list[dimension - 1])
191 if (x.tag() == tag)
192 entities.add(x);
193 }
194
195 MshEntitiesNodes* findNodeEntities(Int64 tag)
196 {
197 for (auto& x : entities_nodes_list)
198 if (x.tag() == tag)
199 return &x;
200 return nullptr;
201 }
202
203 MshPhysicalName findPhysicalName(Int32 dimension, Int64 tag) const
204 {
205 return physical_name_list.find(dimension, tag);
206 }
207
208 public:
209
210 MshPhysicalNameList physical_name_list;
211 UniqueArray<MshEntitiesNodes> entities_nodes_list;
212 FixedArray<UniqueArray<MshEntitiesWithNodes>, 3> entities_with_nodes_list;
213 MshPeriodicInfo m_periodic_info;
214
215 private:
216
217 IMesh* m_mesh = nullptr;
218};
219
220/*---------------------------------------------------------------------------*/
221/*---------------------------------------------------------------------------*/
222
223} // namespace Arcane::impl
224
225/*---------------------------------------------------------------------------*/
226/*---------------------------------------------------------------------------*/
227
228#endif
Declarations of Arcane's general types.
Base class for 1D data vectors.
void clear()
Removes the elements from the array.
void add(ConstReferenceType val)
Adds element val to the end of the array.
1D data vector with value semantics (STL style).
UniqueArray< double > m_affine_values
List of affine values.
UniqueArray< Int64 > m_corresponding_nodes
List of pairs (slave node uniqueId, master node unique()).
Brief information about the '$PhysicalNames' block.
FixedArray< UniqueArray< MshPhysicalName >, 4 > m_physical_names
List by dimension of the elements of the $PhysicalNames block.
MshPhysicalName find(Int32 dimension, Int64 tag) const
Retrieves the physical name associated with tag tag.
MshPhysicalName()=default
Constructs a null physical name.
bool isNull() const
Indicates if the physical name is not defined.
std::int64_t Int64
Signed integer type of 64 bits.
std::int32_t Int32
Signed integer type of 32 bits.