Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
IVectorImpl.cc
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#include "IVectorImpl.h"
25
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32namespace Alien
33{
34
35using namespace Arccore;
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
39
41: Timestamp(multi_impl)
42, m_multi_impl(multi_impl)
44, m_vblock_sizes(nullptr)
45{}
46
47/*---------------------------------------------------------------------------*/
48/*---------------------------------------------------------------------------*/
49
50const ISpace&
52{
53 return m_multi_impl->space();
54}
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
61{
62 return m_multi_impl->distribution();
63}
64
65/*---------------------------------------------------------------------------*/
66/*---------------------------------------------------------------------------*/
67
68const Block*
70{
71 return m_multi_impl ? m_multi_impl->block() : nullptr;
72}
73
74/*---------------------------------------------------------------------------*/
75/*---------------------------------------------------------------------------*/
76
77const VBlock*
79{
80 return m_multi_impl ? m_multi_impl->vblock() : nullptr;
81}
82
83/*---------------------------------------------------------------------------*/
84/*---------------------------------------------------------------------------*/
85
86Integer
88{
89 auto& dist = m_multi_impl->distribution();
90 Integer local_size = dist.localSize();
91 if (block())
92 local_size *= block()->size();
93 else if (vblock()) {
94 if (m_vblock_sizes == nullptr)
95 m_vblock_sizes = new VBlockSizes(*vblock(), dist);
96 local_size = m_vblock_sizes->localSize();
97 }
98 return local_size;
99}
100
101/*---------------------------------------------------------------------------*/
102/*---------------------------------------------------------------------------*/
103
104Integer
106{
107 auto& dist = m_multi_impl->distribution();
108 Integer global_size = dist.globalSize();
109 if (block())
110 global_size *= block()->size();
111 else if (vblock()) {
112 if (m_vblock_sizes == nullptr)
113 m_vblock_sizes = new VBlockSizes(*vblock(), dist);
114 global_size = m_vblock_sizes->globalSize();
115 }
116 return global_size;
117}
118
119/*---------------------------------------------------------------------------*/
120/*---------------------------------------------------------------------------*/
121
122Integer
124{
125 auto& dist = m_multi_impl->distribution();
126 Integer offset = dist.offset();
127 if (block())
128 offset *= block()->size();
129 else if (vblock()) {
130 if (m_vblock_sizes == nullptr)
131 m_vblock_sizes = new VBlockSizes(*vblock(), dist);
132 offset = m_vblock_sizes->offset();
133 }
134 return offset;
135}
136
137/*---------------------------------------------------------------------------*/
138/*---------------------------------------------------------------------------*/
139
140} // namespace Alien
141
142/*---------------------------------------------------------------------------*/
143/*---------------------------------------------------------------------------*/
Block.h.
IVectorImpl.h.
MultiVectorImpl.h.
Block elements for block matrices.
Definition Block.h:45
Arccore::Integer size() const
Get square block size.
Definition Block.cc:90
Interface for algebraic space objects.
Definition ISpace.h:44
virtual Arccore::Integer scalarizedOffset() const
Get the "scalarized" offset.
const MultiVectorImpl * m_multi_impl
Pointer on vectors implementations.
virtual const Block * block() const
Get block datas of the vector.
virtual const VectorDistribution & distribution() const
Get the distribution of the vector.
IVectorImpl(const MultiVectorImpl *multi_impl, BackEndId backend="")
Constructor.
BackEndId m_backend
Backend id.
virtual Arccore::Integer scalarizedGlobalSize() const
Get the "scalarized" global size.
virtual const VBlock * vblock() const
Get block datas of the vector.
VBlockSizes * m_vblock_sizes
Variable blocks size data.
virtual Arccore::Integer scalarizedLocalSize() const
Get the "scalarized" local size.
virtual const ISpace & space() const
Get the vector space.
virtual BackEndId backend() const
Definition IVectorImpl.h:95
Compute the actual size of variable block size algebraic elements.
Definition VBlockSizes.h:51
Variable size block elements for block matrices.
Definition VBlock.h:46
Computes a vector distribution.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17