26#include <alien/kernels/simple_csr/SimpleCSRVector.h>
34using namespace Arccore;
41, m_variable_block(nullptr)
49: m_space(std::move(
space))
52, m_variable_block(nullptr)
60, m_space(impl.m_space)
61, m_distribution(impl.m_distribution)
63, m_variable_block(nullptr)
66 m_block = impl.m_block;
67 if (impl.m_variable_block)
68 m_variable_block = impl.m_variable_block;
84 m_block = blocks->
clone();
92 m_variable_block = blocks->
clone();
100 m_block.reset(
new Block(block_size));
108 for (MultiVectorImplMap::iterator i = m_impls2.begin(); i != m_impls2.end(); ++i) {
120 for (MultiVectorImplMap::iterator i = m_impls2.begin(); i != m_impls2.end(); ++i) {
131 return m_block.get();
140 return m_variable_block.get();
157 vectorCloned->setTimestamp(impl, vectorToClone.
timestamp());
159 impl->m_impls2.insert(
179void MultiVectorImpl::updateImpl(
IVectorImpl* target)
const
187 for (
auto& impl : m_impls2) {
188 auto* candidate = impl.second;
190 if (candidate->timestamp() !=
timestamp())
195 if (converter ==
nullptr)
198 converter->convert(candidate, target);
204 UniqueArray<IVectorImpl*> candidates;
205 for (
auto& impl : m_impls2) {
206 auto* candidate = impl.second;
207 if (candidate->timestamp() ==
timestamp())
208 candidates.add(candidate);
210 if (candidates.empty()) {
211 auto msg = String::format(
"Vector converter to: ", target->
backend(),
212 " internal error: no timestamp matching");
213 throw FatalErrorException(A_FUNCINFO, msg);
220 auto print_error = [&] {
222 cout() <<
"ALIEN FATAL ERROR \n"
223 <<
"Vector converting to target backend '" << target->
backend() <<
"' :\n"
224 <<
"* no converter available from source backend(s)";
226 for (
auto* candidate : candidates) {
227 cout() <<
" ** '" << candidate->backend() <<
"'";
234 auto* simplecsr = getImpl<SimpleCSRVector<Real>>(
"simplecsr");
237 auto* simplecsr_target =
241 if (simplecsr_target ==
nullptr)
245 for (
auto* candidate : candidates) {
247 candidate->backend(), simplecsr->backend());
249 if (candidat_simplecsr !=
nullptr) {
251 candidat_simplecsr->convert(candidate, simplecsr);
252 simplecsr->copyTimestamp(*candidate);
254 simplecsr_target->convert(simplecsr, target);
Block elements for block matrices.
std::shared_ptr< Block > clone() const
Clone this object.
Interface to handle abstract vectors implementation.
virtual BackEndId backend() const
~MultiVectorImpl() override
Free resources.
void free()
Free resources.
void clear()
Clear resources.
MultiVectorImpl * clone() const
Clone this object.
const AlgebraTraits< tag >::vector_type & get() const
Get a specific vector implementation.
const Block * block() const
Get uniform block datas.
const VectorDistribution & distribution() const
Get the vector distribution.
void setBlockInfos(const Block *blocks)
Set uniform block information.
const ISpace & space() const
Get the space associated with the vector.
const VBlock * vblock() const
Get variable block datas.
Int64 timestamp() const
Valeur du timestamp de référence.
virtual Int64 timestamp() const
Donne la valeur courante du timestamp.
void updateTimestamp()
Met à jour le timestamp.
void copyTimestamp(const Timestamp &v)
Copy un autre timestamp.
Variable size block elements for block matrices.
std::shared_ptr< VBlock > clone() const
Copy this object.
static IVectorConverter * getConverter(BackEndId from, BackEndId to)
Get the converter from one vector format to another one.
MultiVectorImpl()
Multi vectors representation container.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --