26#include <arccore/base/FatalErrorException.h>
27#include <arccore/base/TraceInfo.h>
35using namespace Arccore;
46 Internal(
const VBlock& blocks)
89 const Integer localSize = dist.
localSize();
90 const Integer localOffset = dist.
offset();
91 this->
compute(localSize, localOffset);
101 const Integer localOffset = dist.
rowOffset();
102 this->
compute(localSize, localOffset);
111 m_internal->m_local_offsets.resize(localSize + 1);
115 for (Integer i = 0; i < localSize; ++i) {
116 const Integer block_size = all_blocks_sizes.find(i + localOffset).value();
119 m_internal->m_all_offsets[i + localOffset] = sum;
125 for (VBlock::ValuePerBlock::const_iterator it = all_blocks_sizes.begin();
126 it != all_blocks_sizes.end(); ++it) {
127 const Integer globalIndex = it.key();
128 const Integer block_size = it.value();
150 auto it =
m_internal->m_all_offsets.find(index);
153 throw FatalErrorException(A_FUNCINFO,
"index is not registered");
207ConstArrayView<Integer>
216ConstArrayView<Integer>
225std::shared_ptr<VBlockImpl>
228 return std::make_shared<VBlockImpl>(*
this);
Computes a matrix distribution.
Arccore::Integer localRowSize() const
Get the local row size.
Arccore::Integer rowOffset() const
Get the row offset.
Arccore::ConstArrayView< Arccore::Integer > sizeOfLocalIndex() const
Get the block sizes for all local blocks.
Arccore::ConstArrayView< Arccore::Integer > offsetOfLocalIndex() const
Get the offsets for all local blocks.
Arccore::Integer offset(Arccore::Integer index) const
Get the offset from a global or local index.
Arccore::Integer offsetFromLocalIndex(Arccore::Integer index) const
Get the offset from a local index.
std::shared_ptr< VBlockImpl > clone() const
Copy this object.
void compute(Arccore::Integer local_size, Arccore::Integer local_offset)
Compute offsets for variable block size elements.
std::shared_ptr< Internal > m_internal
Actual implementation of the variable block offsets computation tool.
Arccore::Integer sizeFromLocalIndex(Arccore::Integer index) const
Get the block size from a local index.
VBlockImpl(const VBlock &block, const VectorDistribution &dist)
Constructor for vectors variable blocks.
Variable size block elements for block matrices.
VMap< Arccore::Integer, Arccore::Integer > ValuePerBlock
Type of the size of each block.
Computes a vector distribution.
Arccore::Integer offset() const
Get the offset.
Arccore::Integer localSize() const
Get the local size.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Internal structure for variable block offset computation tool.
VBlock::ValuePerBlock m_all_offsets
All offsets array.
const VBlock & m_blocks
Variable blocks information.
UniqueArray< Integer > m_local_sizes
Local sizes array.
static VBlockImpl::Internal * newVariableSizeBlock(const VBlock &blocks)
Compute offsets for variable block size algebraic element.
UniqueArray< Integer > m_local_offsets
Local sizes offset.