Alien  1.3.0
User documentation
Loading...
Searching...
No Matches
Partition.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 Partition.h
21 * \brief Partition.h
22 */
23
24#pragma once
25
26#include <arccore/base/String.h>
27
28#include <alien/data/Space.h>
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
34namespace Alien
35{
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
39
40/*!
41 * \ingroup utils
42 * \brief Creates tags in the matrix
43 *
44 * Decorates the matrix by associating tags to entries
45 */
46class ALIEN_EXPORT Partition
47{
48 public:
49 /*!
50 * \brief Constructor
51 * \param[in] space The space of the matrix
52 * \param[in] distribution The distribution of the matrix
53 */
54 Partition(const ISpace& space, const MatrixDistribution& distribution);
55
56 //! Free resources
57 ~Partition() = default;
58
59 /*!
60 * \brief Create the tags of the matrix
61 * \param[in] tags The array of tags
62 */
63 void create(const Arccore::UniqueArray<Arccore::String>& tags);
64
65 /*!
66 * \brief Get the number of untagged parts of the matrix
67 * \returns The number of untagged parts
68 */
69 Arccore::Integer nbTaggedParts() const { return m_tagged_parts.size(); }
70
71 /*!
72 * \brief Get the i-th tag
73 * \param[in] i The requested tag
74 * \returns The tag
75 */
76 Arccore::String tag(Arccore::Integer i) const { return m_tags[i]; }
77
78 /*!
79 * \brief Get indices of a specific matching tag
80 * \param[in] i The requested tag
81 * \returns Local ids corresponding to the tag
82 */
83 const Arccore::UniqueArray<Arccore::Integer>& taggedPart(Arccore::Integer i) const
84 {
85 return m_tagged_parts[i];
86 }
87
88 /*!
89 * \brief Whether or not the matrix has untagged part
90 * \returns Whether or not the matrix has untagged part
91 */
92 bool hasUntaggedPart() const { return !m_untagged_part.empty(); }
93
94 /*!
95 * \brief Get untagged indices
96 * \returns Local ids of the untagged indices
97 */
98 const Arccore::UniqueArray<Arccore::Integer>& untaggedPart() const
99 {
100 return m_untagged_part;
101 }
102
103 private:
104 //! The matrix space
105 const ISpace& m_space;
106 //! The matrix distribution
107 const MatrixDistribution& m_distribution;
108 //! The array of tags
109 Arccore::UniqueArray<Arccore::String> m_tags;
110 //! The arrays of local ids for each tag
111 Arccore::UniqueArray<Arccore::UniqueArray<Arccore::Integer>> m_tagged_parts;
112 // The array of local ids for untagged entries
113 Arccore::UniqueArray<Arccore::Integer> m_untagged_part;
114};
115
116/*---------------------------------------------------------------------------*/
117/*---------------------------------------------------------------------------*/
118
119} // namespace Alien
120
121/*---------------------------------------------------------------------------*/
122/*---------------------------------------------------------------------------*/
MatrixDistribution.h.
Space.h.
Interface for algebraic space objects.
Definition ISpace.h:44
Computes a matrix distribution.
~Partition()=default
Free resources.
const Arccore::UniqueArray< Arccore::Integer > & untaggedPart() const
Get untagged indices.
Definition Partition.h:98
void create(const Arccore::UniqueArray< Arccore::String > &tags)
Create the tags of the matrix.
Definition Partition.cc:48
Arccore::Integer nbTaggedParts() const
Get the number of untagged parts of the matrix.
Definition Partition.h:69
Partition(const ISpace &space, const MatrixDistribution &distribution)
Constructor.
Definition Partition.cc:40
Arccore::String tag(Arccore::Integer i) const
Get the i-th tag.
Definition Partition.h:76
const Arccore::UniqueArray< Arccore::Integer > & taggedPart(Arccore::Integer i) const
Get indices of a specific matching tag.
Definition Partition.h:83
bool hasUntaggedPart() const
Whether or not the matrix has untagged part.
Definition Partition.h:92
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17