Alien  1.3.0
User documentation
Loading...
Searching...
No Matches
ExtractionIndices.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
19/*!
20 * \file ExtractionIndices.h
21 * \brief ExtractionIndices.h
22 */
23
24#pragma once
25
26#include <alien/utils/Precomp.h>
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31namespace Alien
32{
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37/*!
38 * \ingroup utils
39 * \brief Tool to iterate over a matrix
40 */
41class ALIEN_EXPORT ExtractionIndices final
42{
43 public:
44 /*!
45 * \brief Constructor
46 * \param[in] rowStart The index of the starting row
47 * \param[in] rowRange The length of the row
48 * \param[in] colStart The index of the starting col
49 * \param[in] colRange The length of the col
50 */
51 ExtractionIndices(const Arccore::Integer rowStart, const Arccore::Integer rowRange,
52 const Arccore::Integer colStart = -1, const Arccore::Integer colRange = -1);
53
54 //! Free resources
56
57 ExtractionIndices(const ExtractionIndices&) = delete;
59 ExtractionIndices& operator=(const ExtractionIndices&) = delete;
60 ExtractionIndices& operator=(ExtractionIndices&&) = delete;
61
62 /*!
63 * \brief Get the index of the starting row
64 * \returns The index of the starting row
65 */
66 Arccore::Integer rowStart() const;
67
68 /*!
69 * \brief Get the length of the row
70 * \returns The length of the row
71 */
72 Arccore::Integer rowRange() const;
73
74 /*!
75 * \brief Get the index of the starting col
76 * \returns The index of the starting col
77 */
78 Arccore::Integer colStart() const;
79
80 /*!
81 * \brief Get the length of the col
82 * \returns The length of the col
83 */
84 Arccore::Integer colRange() const;
85
86 /*!
87 * \brief Get the local index of a row given a global index
88 * \param[in] uid The global index of a row
89 * \returns The local index of a row
90 */
91 Arccore::Integer toLocalRow(const Arccore::Integer uid) const;
92
93 /*!
94 * \brief Get the local index of a col given a global index
95 * \param[in] uid The global index of a col
96 * \returns The local index of a col
97 */
98 Arccore::Integer toLocalCol(const Arccore::Integer uid) const;
99
100 private:
101 //! Index of the starting row
102 Arccore::Integer m_starting_row;
103 //! Index of the starting col
104 Arccore::Integer m_starting_col;
105 //! Length of the row
106 Arccore::Integer m_row_range;
107 //! Length of the col
108 Arccore::Integer m_col_range;
109};
110
111/*---------------------------------------------------------------------------*/
112/*---------------------------------------------------------------------------*/
113
114} // namespace Alien
115
116/*---------------------------------------------------------------------------*/
117/*---------------------------------------------------------------------------*/
Arccore::Integer rowStart() const
Get the index of the starting row.
Arccore::Integer rowRange() const
Get the length of the row.
Arccore::Integer colStart() const
Get the index of the starting col.
Arccore::Integer toLocalCol(const Arccore::Integer uid) const
Get the local index of a col given a global index.
Arccore::Integer toLocalRow(const Arccore::Integer uid) const
Get the local index of a row given a global index.
Arccore::Integer colRange() const
Get the length of the col.
ExtractionIndices(const Arccore::Integer rowStart, const Arccore::Integer rowRange, const Arccore::Integer colStart=-1, const Arccore::Integer colRange=-1)
Constructor.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17