Arcane  v3.16.0.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
CartesianMeshPatchListView.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* CartesianMeshPatchListView.h (C) 2000-2025 */
9/* */
10/* Vue sur une liste de patchs. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CARTESIANMESH_CARTESIANMESPATCHLISTVIEW_H
13#define ARCANE_CARTESIANMESH_CARTESIANMESPATCHLISTVIEW_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/ArrayView.h"
18
20
21#include "arcane/cartesianmesh/CartesianPatch.h"
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arcane
27{
29
30/*!
31 * \brief Vue sur une liste de patchs.
32 *
33 * Les instances de cette classe sont invalidées si la liste des patchs évolue.
34 */
35class ARCANE_CARTESIANMESH_EXPORT CartesianMeshPatchListView
36{
37 friend CartesianMeshImpl;
38 friend CartesianPatchGroup;
39
40 public:
41
42 //! Sentinelle pour l'itération pour une liste de patchs.
44 {};
45
46 //! Itérateur pour une liste de patchs.
47 class Iterator
48 {
49 friend CartesianMeshPatchListView;
50
51 public:
52
53 typedef std::forward_iterator_tag iterator_category;
54 typedef ICartesianMeshPatch value_type;
55 typedef Int32 size_type;
56
57 public:
58
59 Iterator() = default;
60
61 public:
62
63 CartesianPatch operator*() const { return CartesianPatch(m_patches[m_index]); }
64 Iterator& operator++()
65 {
66 ++m_index;
67 return (*this);
68 }
69 friend bool operator==(const Iterator& a, const Iterator& b)
70 {
71 return (a.m_patches.data() + a.m_index) == (b.m_patches.data() + b.m_index);
72 }
73 friend bool operator!=(const Iterator& a, const Iterator& b)
74 {
75 return !(operator==(a, b));
76 }
77 friend bool operator==(const Iterator& a, const Sentinel&)
78 {
79 return a.m_patches.size() != a.m_index;
80 }
81 friend bool operator!=(const Iterator& a, const Sentinel& b)
82 {
83 return !(operator==(a, b));
84 }
85
86 private:
87
89 : m_index(index)
90 , m_patches(v)
91 {}
92
93 private:
94
95 Int32 m_index = 0;
97 };
98
99 public:
100
101 CartesianMeshPatchListView() = default;
102
103 private:
104
105 // Constructeur pour 'CartesiaMeshImpl'
106 explicit CartesianMeshPatchListView(ConstArrayView<ICartesianMeshPatch*> v)
107 : m_patches(v)
108 {}
109
110 public:
111
112 Iterator begin() const { return Iterator(m_patches, 0); }
113 Sentinel end() const { return {}; }
114 Iterator endIterator() const { return Iterator(m_patches, m_patches.size()); }
115 Int32 size() const { return m_patches.size(); }
116
117 private:
118
119 ConstArrayView<ICartesianMeshPatch*> m_patches;
120};
121
122/*---------------------------------------------------------------------------*/
123/*---------------------------------------------------------------------------*/
124
125} // End namespace Arcane
126
127/*---------------------------------------------------------------------------*/
128/*---------------------------------------------------------------------------*/
129
130#endif
131
Déclarations des types généraux de Arcane.
Sentinelle pour l'itération pour une liste de patchs.
Patch AMR d'un maillage cartésien.
Vue constante d'un tableau de type T.
Interface d'un patch AMR d'un maillage cartésien.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
std::int32_t Int32
Type entier signé sur 32 bits.