Arcane  4.2.1.0
Developer documentation
Loading...
Searching...
No Matches
NumMatrixDataView.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/* NumMatrixDataView.h (C) 2000-2026 */
9/* */
10/* Specific implementation of DataView(Setter/Getter) for NumMatrix. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_NUMMATRIXDATAVIEW_H
13#define ARCANE_UTILS_NUMMATRIXDATAVIEW_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/NumMatrix.h"
18
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
32template <typename DataType_, int Row, int Column>
33class NumMatrixDataViewGetter
34{
35 public:
36
43
44 public:
45
46 explicit ARCCORE_HOST_DEVICE NumMatrixDataViewGetter(const NumMatrixType* ptr)
47 : m_ptr(ptr)
48 {}
49
50 public:
51
52 static constexpr ARCCORE_HOST_DEVICE AccessorReturnType build(const NumMatrixType* ptr)
53 {
54 return { *ptr };
55 }
56
57 public:
58
59 constexpr operator AccessorReturnType() const noexcept { return *m_ptr; }
60
61 private:
62
63 const NumMatrixType* m_ptr = nullptr;
64};
65
66/*---------------------------------------------------------------------------*/
67/*---------------------------------------------------------------------------*/
71template <typename DataType_, int Row, int Column>
72class NumMatrixDataViewGetterSetter
73: public DataViewGetterSetter<NumMatrix<DataType_, Row, Column>>
74{
75 using BaseClass = DataViewGetterSetter<NumMatrix<DataType_, Row, Column>>;
76
77 public:
78
82 using MatrixElemenAccessor = DataViewGetterSetter<DataType_>;
83
84 public:
85
86 explicit ARCCORE_HOST_DEVICE NumMatrixDataViewGetterSetter(NumMatrixType* ptr)
87 : BaseClass(ptr)
88 {}
89
90 public:
91
93 {
94 BaseClass::operator=(v);
95 return (*this);
96 }
97
98 void fill(const DataType_& v)
99 {
100 this->m_ptr->fill(v);
101 }
102};
103
104/*---------------------------------------------------------------------------*/
105/*---------------------------------------------------------------------------*/
106
107} // End namespace Arcane
108
109/*---------------------------------------------------------------------------*/
110/*---------------------------------------------------------------------------*/
111
112#endif
Class for accessing an element of a read view.
Mutable view for a NumMatrix<DataType_,Row,Column>.
Small fixed-size matrix containing RowSize rows and ColumnSize columns.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --