Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
AMRZonePosition.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/* AMRZonePosition.h (C) 2000-2026 */
9/* */
10/* Definition of a 2D or 3D zone of a mesh. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CARTESIANMESH_AMRBOXPOSITION_H
13#define ARCANE_CARTESIANMESH_AMRBOXPOSITION_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/cartesianmesh/CartesianMeshGlobal.h"
18#include "arcane/utils/Real3.h"
19#include "arcane/core/VariableTypes.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30/*!
31 * \ingroup ArcaneCartesianMesh
32 * \brief Class allowing the definition of a mesh zone.
33 */
34class ARCANE_CARTESIANMESH_EXPORT AMRZonePosition
35{
36 public:
37
38 /*!
39 * \brief 3D zone constructor.
40 * \param position The geometric position of the zone.
41 * \param length The size of the zone.
42 */
44 : m_position(position)
45 , m_length(length)
46 , m_is_3d(true)
47 {}
48
49 /*!
50 * \brief 2D zone constructor.
51 * \param position The geometric position of the zone.
52 * \param length The size of the zone.
53 */
55 : m_position(position)
56 , m_length(length)
57 , m_is_3d(false)
58 {}
59
60 public:
61
62 /*!
63 * \brief Method allowing retrieval of the zone's position.
64 * \return The geometric position of the zone.
65 */
67 {
68 return m_position;
69 }
70
71 /*!
72 * \brief Method allowing retrieval of the zone's size.
73 * \return The size of the zone.
74 */
75 Real3 length() const
76 {
77 return m_length;
78 }
79
80 /*!
81 * \brief Method allowing determination if it is a 2D or 3D zone.
82 * \return True if it is a 3D zone.
83 */
84 bool is3d() const
85 {
86 return m_is_3d;
87 }
88
89 /*!
90 * \brief Method allowing retrieval of the cells included in the zone.
91 * \param mesh The mesh.
92 * \param cells_local_id The array that will contain the localIds of the zone's cells.
93 * Note: the array will first be cleared.
94 */
95 void cellsInPatch(IMesh* mesh, UniqueArray<Int32>& cells_local_id) const;
96
97 /*!
98 * \brief Method allowing retrieval of the cells included in the zone.
99 * An AMRPatchPosition object designating the patch position is also filled.
100 * \param mesh The mesh.
101 * \param cells_local_id The array that will contain the localIds of the zone's cells.
102 * Note: the array will first be cleared.
103 * \param position [OUT] The patch position.
104 */
105 void cellsInPatch(ICartesianMesh* mesh, UniqueArray<Int32>& cells_local_id, AMRPatchPosition& position) const;
106
107 /*!
108 * \brief Method allowing conversion of this AMRZonePosition into
109 * AMRPatchPosition.
110 *
111 * \warning The size of the overlap cell layer is not
112 * correctly defined! This must be done after calling this method.
113 *
114 * \param mesh The Cartesian mesh.
115 * \return The corresponding AMRPatchPosition.
116 */
117 AMRPatchPosition toAMRPatchPosition(ICartesianMesh* mesh) const;
118
119 private:
120
121 Real3 m_position;
122 Real3 m_length;
123 bool m_is_3d;
124};
125
126/*---------------------------------------------------------------------------*/
127/*---------------------------------------------------------------------------*/
128
129} // End namespace Arcane
130
131/*---------------------------------------------------------------------------*/
132/*---------------------------------------------------------------------------*/
133
134#endif
Class allowing the definition of a patch position in the Cartesian mesh.
Real3 length() const
Method allowing retrieval of the zone's size.
bool is3d() const
Method allowing determination if it is a 2D or 3D zone.
AMRZonePosition(const Real3 &position, const Real3 &length)
3D zone constructor.
Real3 position() const
Method allowing retrieval of the zone's position.
AMRZonePosition(const Real2 &position, const Real2 &length)
2D zone constructor.
Class managing a 2-dimensional real vector.
Definition Real2.h:122
Class managing a 3-dimensional real vector.
Definition Real3.h:132
1D data vector with value semantics (STL style).
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --