14#include "arcane/core/internal/CartesianMeshGenerationInfo.h"
16#include "arcane/utils/String.h"
17#include "arcane/utils/IUserDataList.h"
18#include "arcane/utils/AutoDestroyUserData.h"
19#include "arcane/utils/FatalErrorException.h"
21#include "arcane/IMesh.h"
22#include "arcane/Properties.h"
33CartesianMeshGenerationInfo::
34CartesianMeshGenerationInfo(IMesh* mesh)
36, m_mesh_dimension(mesh->dimension())
39 m_sub_domain_offsets =
Int32ArrayView(NB_DIM, m_sub_domain_offset_ptr);
42 m_own_cell_offsets =
Int64ArrayView(NB_DIM, m_own_cell_offset_ptr);
44 m_global_nb_cells.fill(-1);
45 m_sub_domain_offsets.fill(-1);
46 m_nb_sub_domains.fill(-1);
47 m_own_nb_cells.fill(-1);
48 m_own_cell_offsets.fill(-1);
56void CartesianMeshGenerationInfo::
59 m_own_cell_offsets[0] = x;
60 m_own_cell_offsets[1] = y;
61 m_own_cell_offsets[2] = z;
63 Properties* p = m_mesh->properties();
64 p->setInt64(
"OwnCellOffsetX", x);
65 p->setInt64(
"OwnCellOffsetY", y);
66 p->setInt64(
"OwnCellOffsetZ", z);
72void CartesianMeshGenerationInfo::
75 m_global_nb_cells[0] = x;
76 m_global_nb_cells[1] = y;
77 m_global_nb_cells[2] = z;
79 Properties* p = m_mesh->properties();
80 p->setInt64(
"GlobalNbCellX", x);
81 p->setInt64(
"GlobalNbCellY", y);
82 p->setInt64(
"GlobalNbCellZ", z);
86 m_global_nb_cell *= y;
88 m_global_nb_cell *= z;
94void CartesianMeshGenerationInfo::
97 m_sub_domain_offsets[0] = x;
98 m_sub_domain_offsets[1] = y;
99 m_sub_domain_offsets[2] = z;
101 Properties* p = m_mesh->properties();
102 p->setInt32(
"SubDomainOffsetX", x);
103 p->setInt32(
"SubDomainOffsetY", y);
104 p->setInt32(
"SubDomainOffsetZ", z);
110void CartesianMeshGenerationInfo::
113 m_nb_sub_domains[0] = x;
114 m_nb_sub_domains[1] = y;
115 m_nb_sub_domains[2] = z;
117 Properties* p = m_mesh->properties();
118 p->setInt32(
"NbSubDomainX", x);
119 p->setInt32(
"NbSubDomainY", y);
120 p->setInt32(
"NbSubDomainZ", z);
126void CartesianMeshGenerationInfo::
129 m_own_nb_cells[0] = x;
130 m_own_nb_cells[1] = y;
131 m_own_nb_cells[2] = z;
133 Properties* p = m_mesh->properties();
134 p->setInt32(
"OwnNbCellX", x);
135 p->setInt32(
"OwnNbCellY", y);
136 p->setInt32(
"OwnNbCellZ", z);
142void CartesianMeshGenerationInfo::
143setFirstOwnCellUniqueId(
Int64 uid)
145 m_first_own_cell_unique_id = uid;
147 Properties* p = m_mesh->properties();
148 p->setInt64(
"CartesianFirstOnwCellUniqueId", uid);
154void CartesianMeshGenerationInfo::
155setGlobalOrigin(Real3 pos)
157 m_global_origin = pos;
158 Properties* p = m_mesh->properties();
159 p->setReal(
"GlobalMeshOriginX", m_global_origin.x);
160 p->setReal(
"GlobalMeshOriginY", m_global_origin.y);
161 p->setReal(
"GlobalMeshOriginZ", m_global_origin.z);
167void CartesianMeshGenerationInfo::
168setGlobalLength(Real3 length)
170 m_global_length = length;
171 Properties* p = m_mesh->properties();
172 p->setReal(
"GlobalMeshLengthX", m_global_length.x);
173 p->setReal(
"GlobalMeshLengthY", m_global_length.y);
174 p->setReal(
"GlobalMeshLengthZ", m_global_length.z);
180void CartesianMeshGenerationInfo::
183 Properties* p = m_mesh->properties();
184 m_global_nb_cells[
MD_DirX] = p->getInt64WithDefault(
"GlobalNbCellX", -1);
185 m_global_nb_cells[
MD_DirY] = p->getInt64WithDefault(
"GlobalNbCellY", -1);
186 m_global_nb_cells[
MD_DirZ] = p->getInt64WithDefault(
"GlobalNbCellZ", -1);
188 m_own_nb_cells[
MD_DirX] = p->getInt32WithDefault(
"OwnNbCellX", -1);
189 m_own_nb_cells[
MD_DirY] = p->getInt32WithDefault(
"OwnNbCellY", -1);
190 m_own_nb_cells[
MD_DirZ] = p->getInt32WithDefault(
"OwnNbCellZ", -1);
192 m_sub_domain_offsets[
MD_DirX] = p->getInt32WithDefault(
"SubDomainOffsetX", -1);
193 m_sub_domain_offsets[
MD_DirY] = p->getInt32WithDefault(
"SubDomainOffsetY", -1);
194 m_sub_domain_offsets[
MD_DirZ] = p->getInt32WithDefault(
"SubDomainOffsetZ", -1);
196 m_own_cell_offsets[
MD_DirX] = p->getInt64WithDefault(
"OwnCellOffsetX", -1);
197 m_own_cell_offsets[
MD_DirY] = p->getInt64WithDefault(
"OwnCellOffsetY", -1);
198 m_own_cell_offsets[
MD_DirZ] = p->getInt64WithDefault(
"OwnCellOffsetZ", -1);
200 m_nb_sub_domains[
MD_DirX] = p->getInt32WithDefault(
"NbSubDomainX", -1);
201 m_nb_sub_domains[
MD_DirY] = p->getInt32WithDefault(
"NbSubDomainY", -1);
202 m_nb_sub_domains[
MD_DirZ] = p->getInt32WithDefault(
"NbSubDomainZ", -1);
204 m_first_own_cell_unique_id = p->getInt64WithDefault(
"CartesianFirstOnwCellUniqueId", -1);
206 m_global_origin.x = p->getRealWithDefault(
"GlobalMeshOriginX", 0.0);
207 m_global_origin.y = p->getRealWithDefault(
"GlobalMeshOriginY", 0.0);
208 m_global_origin.z = p->getRealWithDefault(
"GlobalMeshOriginZ", 0.0);
210 m_global_length.x = p->getRealWithDefault(
"GlobalMeshLengthX", 0.0);
211 m_global_length.y = p->getRealWithDefault(
"GlobalMeshLengthY", 0.0);
212 m_global_length.z = p->getRealWithDefault(
"GlobalMeshLengthZ", 0.0);
229ICartesianMeshGenerationInfo* ICartesianMeshGenerationInfo::
230getReference(IMesh* mesh,
bool create)
233 const char* name =
"CartesianMeshGenerationInfo";
234 IUserDataList* udlist = mesh->userDataList();
236 IUserData* ud = udlist->data(name,
true);
240 ICartesianMeshGenerationInfo* cm =
new impl::CartesianMeshGenerationInfo(mesh);
241 udlist->setData(name,
new AutoDestroyUserData<ICartesianMeshGenerationInfo>(cm));
244 auto* adud =
dynamic_cast<AutoDestroyUserData<ICartesianMeshGenerationInfo>*
>(ud);
246 ARCANE_FATAL(
"Can not cast to ICartesianMeshGenerationInfo");
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
ArrayView< Int64 > Int64ArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
ArrayView< Int32 > Int32ArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.