Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
CartesianPatch.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/* CartesianPatch.h (C) 2000-2026 */
9/* */
10/* AMR Patch of a Cartesian mesh. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CARTESIANMESH_CARTESIANPATCH_H
13#define ARCANE_CARTESIANMESH_CARTESIANPATCH_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19#include "arcane/cartesianmesh/ICartesianMeshPatch.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29/*!
30 * \ingroup ArcaneCartesianMesh
31 * \brief AMR Patch of a Cartesian mesh.
32 */
33class ARCANE_CARTESIANMESH_EXPORT CartesianPatch
34{
35 public:
36
37 //! Null patch.
38 CartesianPatch() = default;
39
40 //! Null patch.
41 explicit CartesianPatch(ICartesianMeshPatch* patch_interface)
42 : m_patch(patch_interface)
43 {
44 }
45 CartesianPatch& operator=(const CartesianPatch&) = default;
46 CartesianPatch& operator=(ICartesianMeshPatch* patch_interface)
47 {
48 m_patch = patch_interface;
49 return (*this);
50 }
51
52 public:
53
54 //! Cell group of the patch (including overlap cells).
55 CellGroup cells() const;
56
57 /*!
58 * \brief Cell group of the patch (excluding overlap cells).
59 *
60 * Valid only with AMR type 3 (PatchCartesianMeshOnly).
61 */
62 CellGroup inPatchCells() const;
63
64 /*!
65 * \brief Overlap cell group of the patch.
66 *
67 * Valid only with AMR type 3 (PatchCartesianMeshOnly).
68 */
70
71 //! Index of the patch in the patch array.
72 Integer index() const;
73
74 /*!
75 * \brief Patch level.
76 *
77 * Valid only with AMR type 3 (PatchCartesianMeshOnly).
78 */
79 Integer level() const
80 {
81 ARCANE_CHECK_POINTER(m_patch);
82 return m_patch->position().level();
83 }
84
85 //! List of cells in direction \a dir
87 {
88 ARCANE_CHECK_POINTER(m_patch);
89 return m_patch->cellDirection(dir);
90 }
91
92 //! List of cells in direction \a dir (0, 1 or 2)
94 {
95 ARCANE_CHECK_POINTER(m_patch);
96 return m_patch->cellDirection(idir);
97 }
98
99 //! List of faces in direction \a dir
101 {
102 ARCANE_CHECK_POINTER(m_patch);
103 return m_patch->faceDirection(dir);
104 }
105
106 //! List of faces in direction \a dir (0, 1 or 2)
108 {
109 ARCANE_CHECK_POINTER(m_patch);
110 return m_patch->faceDirection(idir);
111 }
112
113 //! List of nodes in direction \a dir
115 {
116 ARCANE_CHECK_POINTER(m_patch);
117 return m_patch->nodeDirection(dir);
118 }
119
120 //! List of nodes in direction \a dir (0, 1 or 2)
122 {
123 ARCANE_CHECK_POINTER(m_patch);
124 return m_patch->nodeDirection(idir);
125 }
126
127 //! Performs checks on the instance validity.
128 void checkValid() const
129 {
130 ARCANE_CHECK_POINTER(m_patch);
131 m_patch->checkValid();
132 }
133
134 /*!
135 * \brief Method to retrieve the patch position in the
136 * Cartesian mesh.
137 *
138 * \return A copy of the position.
139 */
141 {
142 ARCANE_CHECK_POINTER(m_patch);
143 return m_patch->position();
144 }
145
146 //! Indicates if the patch is null.
147 bool isNull() const { return !m_patch; }
148
149 //! Interface associated with the patch (for compatibility with existing code)
150 ICartesianMeshPatch* patchInterface() const { return m_patch; }
151
152 private:
153
154 ICartesianMeshPatch* m_patch = nullptr;
155};
156
157/*---------------------------------------------------------------------------*/
158/*---------------------------------------------------------------------------*/
159
160} // End namespace Arcane
161
162/*---------------------------------------------------------------------------*/
163/*---------------------------------------------------------------------------*/
164
165#endif
#define ARCANE_CHECK_POINTER(ptr)
Macro returning the pointer ptr if it is not null or throwing an exception if it is null.
Declarations of types on entities.
Class allowing the definition of a patch position in the Cartesian mesh.
AMR Patch of a Cartesian mesh.
Integer index() const
Index of the patch in the patch array.
FaceDirectionMng & faceDirection(eMeshDirection dir)
List of faces in direction dir.
NodeDirectionMng & nodeDirection(Integer idir)
List of nodes in direction dir (0, 1 or 2).
NodeDirectionMng & nodeDirection(eMeshDirection dir)
List of nodes in direction dir.
AMRPatchPosition position() const
Method to retrieve the patch position in the Cartesian mesh.
CellGroup overlapCells() const
Overlap cell group of the patch.
bool isNull() const
Indicates if the patch is null.
CellDirectionMng & cellDirection(Integer idir)
List of cells in direction dir (0, 1 or 2).
CartesianPatch()=default
Null patch.
FaceDirectionMng & faceDirection(Integer idir)
List of faces in direction dir (0, 1 or 2).
ICartesianMeshPatch * patchInterface() const
Interface associated with the patch (for compatibility with existing code).
CartesianPatch(ICartesianMeshPatch *patch_interface)
Null patch.
CellDirectionMng & cellDirection(eMeshDirection dir)
List of cells in direction dir.
void checkValid() const
Performs checks on the instance validity.
Integer level() const
Patch level.
Info about the cells in a specific X, Y, or Z direction of a structured mesh.
Info on the faces of a specific direction X, Y, or Z of a structured mesh.
Interface of an AMR patch of a Cartesian mesh.
Info about nodes in a specific direction X, Y, or Z of a structured mesh.
ItemGroupT< Cell > CellGroup
Group of cells.
Definition ItemTypes.h:184
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
eMeshDirection
Direction type for a structured mesh.