Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
CartesianGridDimension.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/* CartesianMeshDimension.cc (C) 2000-2023 */
9/* */
10/* Informations sur les dimensions d'un maillage cartésien. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/CartesianGridDimension.h"
15
16#include "arcane/utils/Math.h"
17
18#include <iostream>
19#include <array>
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30CartesianGridDimension::
31CartesianGridDimension(Int64 nb_cell_x, Int64 nb_cell_y, Int64 nb_cell_z)
32: m_nb_cell{ math::max(nb_cell_x, 0), math::max(nb_cell_y, 0), math::max(nb_cell_z, 0) }
33{
34 _init();
35}
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
39
40CartesianGridDimension::
41CartesianGridDimension(Int64 nb_cell_x, Int64 nb_cell_y)
42: CartesianGridDimension(nb_cell_x, nb_cell_y, 0)
43{
44}
45
46/*---------------------------------------------------------------------------*/
47/*---------------------------------------------------------------------------*/
48
49CartesianGridDimension::
50CartesianGridDimension(const Int64x2& dims)
51: CartesianGridDimension(dims.x, dims.y)
52{
53}
54
55/*---------------------------------------------------------------------------*/
56/*---------------------------------------------------------------------------*/
57
58CartesianGridDimension::
59CartesianGridDimension(const Int64x3& dims)
60: CartesianGridDimension(dims.x, dims.y, dims.z)
61{
62}
63
64/*---------------------------------------------------------------------------*/
65/*---------------------------------------------------------------------------*/
66
67CartesianGridDimension::
68CartesianGridDimension(const Int32x2& dims)
69: CartesianGridDimension(dims.x, dims.y)
70{
71}
72
73/*---------------------------------------------------------------------------*/
74/*---------------------------------------------------------------------------*/
75
76CartesianGridDimension::
77CartesianGridDimension(const Int32x3& dims)
78: CartesianGridDimension(dims.x, dims.y, dims.z)
79{
80}
81
82/*---------------------------------------------------------------------------*/
83/*---------------------------------------------------------------------------*/
84
85void CartesianGridDimension::
86_init()
87{
88 const bool is_dim3 = (m_nb_cell.z > 0);
89 const bool is_dim2_or_3 = is_dim3 || (m_nb_cell.y > 0);
90
91 m_nb_face.x = m_nb_cell.x + 1;
92 m_nb_node.x = m_nb_cell.x + 1;
93 if (is_dim2_or_3) {
94 m_nb_face.y = m_nb_cell.y + 1;
95 m_nb_node.y = m_nb_cell.y + 1;
96 }
97 if (is_dim3) {
98 m_nb_face.z = m_nb_cell.z + 1;
99 m_nb_node.z = m_nb_cell.z + 1;
100 }
101
102 m_nb_face_oriented.x = m_nb_face.x * m_nb_cell.y;
103 m_nb_face_oriented.y = m_nb_face.y * m_nb_cell.x;
104 m_nb_face_oriented.z = m_nb_cell.x * m_nb_cell.y;
105
106 m_nb_cell_xy = m_nb_cell.x * m_nb_cell.y;
107 m_total_nb_cell = m_nb_cell_xy;
108 if (is_dim3)
109 m_total_nb_cell *= m_nb_cell.z;
110}
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
115} // namespace Arcane
116
117/*---------------------------------------------------------------------------*/
118/*---------------------------------------------------------------------------*/
Informations sur les dimensions d'une grille cartésienne.
Classe gérant un vecteur de dimension 2 de type T.
Definition Vector2.h:36
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-