Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
MatrixElement.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 IFPEN-CEA
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 */
18
23
24#ifndef ALIEN_COMMON_UTILS_MATRIXELEMENT_H
25#define ALIEN_COMMON_UTILS_MATRIXELEMENT_H
26
27#include <alien/utils/Precomp.h>
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32namespace Alien
33{
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
43template <typename Builder>
45{
46 public:
54 const Arccore::Integer iIndex, const Arccore::Integer jIndex, Builder& parent)
55 : m_iIndex(iIndex)
56 , m_jIndex(jIndex)
57 , m_parent(parent)
58 {}
59
64 Arccore::Real operator()() const { return m_parent.getData(m_iIndex, m_jIndex); }
65
70 void operator+=(Real value)
71 {
72 m_parent.addData(m_iIndex, m_jIndex, value);
73 }
74
79 void operator-=(Real value)
80 {
81 m_parent.addData(m_iIndex, m_jIndex, -value);
82 }
83
88 void operator=(Real value)
89 {
90 m_parent.setData(m_iIndex, m_jIndex, value);
91 }
92
97 template <typename Builder2>
99 {
100 bool test_pattern = (m_iIndex == other.m_iIndex) && (m_jIndex == other.m_jIndex);
101 // TODO: Check values.
102 return test_pattern;
103 }
104
105 private:
107 const Arccore::Integer m_iIndex;
109 const Arccore::Integer m_jIndex;
111 Builder& m_parent;
112};
113
114/*---------------------------------------------------------------------------*/
115/*---------------------------------------------------------------------------*/
116
117} // namespace Alien
118
119/*---------------------------------------------------------------------------*/
120/*---------------------------------------------------------------------------*/
121
122#endif /* ALIEN_COMMON_UTILS_MATRIXELEMENT_H */
void operator+=(Real value)
Add and set operator.
MatrixElementT(const Arccore::Integer iIndex, const Arccore::Integer jIndex, Builder &parent)
Constructor.
bool operator=(const MatrixElementT< Builder2 > &other)
Comparison operator.
void operator-=(Real value)
Minus and set operator.
void operator=(Real value)
Assignment operator.
Arccore::Real operator()() const
accessor operator
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17