Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
GeomElementView.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/* GeomElementView.h (C) 2000-2026 */
9/* */
10/* Views on geometric elements. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_GEOMETRIC_GEOMELEMENTVIEW_H
13#define ARCANE_GEOMETRIC_GEOMELEMENTVIEW_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/Real3.h"
18
19#include "arcane/geometry/GeometricGlobal.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane::geometric
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29/*!
30 * \ingroup ArcaneGeometric
31 * \brief Base class for constant views on geometric elements.
32 *
33 * The views of this type are only valid as long as the instance
34 * they originate from exists. Consequently, these views are primarily
35 * used for argument passing and should not be retained.
36 */
37class GeomElementConstViewBase
38{
39 public:
40
41 explicit GeomElementConstViewBase(ARCANE_RESTRICT const Real3POD* ptr)
42 : m_s(ptr)
43 {}
44
45 public:
47 //! Retrieves the value of the i-th node
48 inline const Real3 operator[](Integer i) const
49 {
50 return Real3(m_s[i].x, m_s[i].y, m_s[i].z);
51 }
52
53 /*!
54 * \brief Retrieves the value of the i-th node.
55 * \deprecated Use operator[] instead.
56 */
57 //ARCANE_DEPRECATED inline const Real3 s(Integer i) const
58 inline const Real3 s(Integer i) const
59 {
60 return Real3(m_s[i].x, m_s[i].y, m_s[i].z);
61 }
62
63 protected:
64
65 ARCANE_RESTRICT const Real3POD* m_s;
66};
67
68/*---------------------------------------------------------------------------*/
69/*---------------------------------------------------------------------------*/
70/*!
71 * \ingroup ArcaneGeometric
72 * \brief Base class for modifiable views on geometric elements.
73 *
74 * The views of this type are only valid as long as the instance
75 * they originate from exists. Consequently, these views are primarily
76 * used for argument passing and should not be retained.
77 */
78class GeomElementViewBase
79{
80 public:
81
82 explicit GeomElementViewBase(ARCANE_RESTRICT Real3POD* ptr)
83 : m_s(ptr)
84 {}
85
86 public:
87
88 //! Retrieves the value of the i-th node
89 const Real3 operator[](Integer i) const
90 {
91 return Real3(m_s[i].x, m_s[i].y, m_s[i].z);
92 }
93
94 //! Sets the value of the i-th node to v.
96 {
97 m_s[i].x = v.x;
98 m_s[i].y = v.y;
99 m_s[i].z = v.z;
100 }
101
102 protected:
104 ARCANE_RESTRICT Real3POD* m_s;
105};
106
107/*---------------------------------------------------------------------------*/
108/*---------------------------------------------------------------------------*/
109
110#include "arcane/geometry/GeneratedGeomElementView.h"
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
115} // namespace Arcane::geometric
116
117/*---------------------------------------------------------------------------*/
118/*---------------------------------------------------------------------------*/
119
120#endif
Class managing a 3-dimensional real vector.
Definition Real3.h:132
const Real3 s(Integer i) const
Retrieves the value of the i-th node.
const Real3 operator[](Integer i) const
Retrieves the value of the i-th node.
void setValue(Integer i, Real3 v)
Sets the value of the i-th node to v.
const Real3 operator[](Integer i) const
Retrieves the value of the i-th node.
Int32 Integer
Type representing an integer.
Real y
second component of the triplet
Definition Real3.h:36
Real z
third component of the triplet
Definition Real3.h:37
Real x
first component of the triplet
Definition Real3.h:35