14#include <alien/kernels/simple_csr/SimpleCSRBackEnd.h>
15#include <alien/kernels/simple_csr/SimpleCSRPrecomp.h>
22template <
typename ValueT>
26 typedef ValueT ValueType;
38 Integer blockSize()
const
48 return m_own_block_size ;
52 void setBlockSize(Integer block_size)
55 const_cast<MultiVectorImpl*
>(this->
m_multi_impl)->setBlockInfos(block_size) ;
57 m_own_block_size = block_size ;
67 void resize(Integer alloc_size)
const
70 m_values.resize(alloc_size);
76 Integer getAllocSize()
const {
return m_values.size(); }
85 Arccore::ArrayView<ValueType> values()
90 Arccore::ConstArrayView<ValueType> values()
const
96 ArrayView<ValueType> fullValues() {
return m_values; }
97 ConstArrayView<ValueType> fullValues()
const {
return m_values; }
99 void setArrayValues(UniqueArray<ValueType>&& rhs) { m_values.copy(rhs); }
101 UniqueArray<ValueType>
const& getArrayValues()
const {
return m_values; }
103 ValueType* getDataPtr() {
return m_values.data(); }
104 ValueType* data() {
return m_values.data(); }
106 ValueType
const* getDataPtr()
const {
return m_values.data(); }
107 ValueType
const* data()
const {
return m_values.data(); }
108 ValueType
const* getAddressData()
const {
return m_values.data(); }
110 ValueType& operator[](Integer index) {
return m_values[index]; }
112 ValueType
const& operator[](Integer index)
const {
return m_values[index]; }
115 template <
typename E>
119 const bool need_allocate)
override
121 alien_debug([&] { cout() <<
"Initializing SimpleCSRVector " <<
this; });
130 m_own_distribution = dist;
131 m_local_size = m_own_distribution.
localSize();
135 m_values.fill(ValueT());
141 const bool need_allocate)
143 alien_debug([&] { cout() <<
"Initializing SimpleCSRVector " <<
this; });
144 setBlockSize(block_size) ;
153 m_own_distribution = dist;
154 m_local_size = m_own_distribution.
localSize();
158 m_values.fill(ValueT());
167 return m_own_distribution;
175 return m_own_distribution.localSize()*m_own_block_size;
183 return m_own_distribution.globalSize()*m_own_block_size;
191 return m_own_distribution.offset()*m_own_block_size;
194 const VBlockImpl& vblockImpl()
const {
return *m_vblock; }
199 ALIEN_ASSERT((
this == &v), (
"Unexpected error"));
207 ConstArrayView<ValueType> thisValues = this->fullValues();
208 vector->resize(thisValues.size());
209 for (Integer i = 0; i < thisValues.size(); ++i)
210 (*vector)[i] = m_values[i];
215 mutable UniqueArray<ValueT> m_values;
216 Integer m_local_size = 0;
217 Integer m_own_block_size = 1 ;
218 VectorDistribution m_own_distribution;
219 mutable std::unique_ptr<VBlockImpl> m_vblock ;
Arccore::Integer size() const
Get square block size.
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.
virtual Arccore::Integer scalarizedGlobalSize() const
Get the "scalarized" global size.
virtual const VBlock * vblock() const
Get block datas of the vector.
virtual Arccore::Integer scalarizedLocalSize() const
Get the "scalarized" local size.
SimpleCSRVector()
Constructeur sans association ? un MultiImpl.
Arccore::Integer scalarizedGlobalSize() const override
Get the "scalarized" global size.
SimpleCSRVector(const MultiVectorImpl *multi_impl)
Constructeur avec association ? un MultiImpl.
void init(const VectorDistribution &dist, const bool need_allocate) override
Initialize vector datas.
const VectorDistribution & distribution() const override
Get the distribution of the vector.
void clear() override
Wipe out internal data.
Arccore::Integer scalarizedOffset() const override
Get the "scalarized" offset.
Arccore::Integer scalarizedLocalSize() const override
Get the "scalarized" local size.
Compute block offsets for variable block elements.
Computes a vector distribution.
Arccore::Integer localSize() const
Get the local size.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --