Alien  1.3.0
Developer 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
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
46class ALIEN_EXPORT Partition
47{
48 public:
54 Partition(const ISpace& space, const MatrixDistribution& distribution);
55
57 ~Partition() = default;
58
63 void create(const Arccore::UniqueArray<Arccore::String>& tags);
64
69 Arccore::Integer nbTaggedParts() const { return m_tagged_parts.size(); }
70
76 Arccore::String tag(Arccore::Integer i) const { return m_tags[i]; }
77
83 const Arccore::UniqueArray<Arccore::Integer>& taggedPart(Arccore::Integer i) const
84 {
85 return m_tagged_parts[i];
86 }
87
92 bool hasUntaggedPart() const { return !m_untagged_part.empty(); }
93
98 const Arccore::UniqueArray<Arccore::Integer>& untaggedPart() const
99 {
100 return m_untagged_part;
101 }
102
103 private:
109 Arccore::UniqueArray<Arccore::String> m_tags;
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.
const ISpace & m_space
The matrix space.
Definition Partition.h:105
~Partition()=default
Free resources.
const MatrixDistribution & m_distribution
The matrix distribution.
Definition Partition.h:107
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::UniqueArray< Arccore::String > m_tags
The array of tags.
Definition Partition.h:109
Arccore::String tag(Arccore::Integer i) const
Get the i-th tag.
Definition Partition.h:76
Arccore::UniqueArray< Arccore::UniqueArray< Arccore::Integer > > m_tagged_parts
The arrays of local ids for each tag.
Definition Partition.h:111
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