9#include <kernel/lafem/container.hpp> 
   10#include <kernel/lafem/dense_vector.hpp> 
   11#include <kernel/lafem/dense_vector_blocked.hpp> 
   12#include <kernel/lafem/sparse_vector.hpp> 
   13#include <kernel/lafem/sparse_vector_blocked.hpp> 
   14#include <kernel/lafem/sparse_matrix_csr.hpp> 
   15#include <kernel/lafem/arch/mirror.hpp> 
   49    template<
typename DT_, 
typename IT_>
 
   62      template <
typename DT2_ = DT_, 
typename IT2_ = IT_>
 
   66      template <
typename DataType2_, 
typename IndexType2_>
 
   98        if(num_idx > 
Index(0))
 
  100          this->
_indices.push_back(MemoryPool::template allocate_memory<IndexType>(num_idx));
 
  117        this->
move(std::forward<BaseClass>(other));
 
  134        for(
Index i(0); i < size_in; ++i)
 
  160      template<
int block_size_>
 
  163        return VectorMirror(tmpl_vec.template size<LAFEM::Perspective::native>(), 0u);
 
  176        t.
clone(*
this, clone_mode);
 
  188      template<
typename DT2_, 
typename IT2_>
 
  200      template<
typename DT2_, 
typename IT2_>
 
  248      template<
typename DT2_, 
typename IT2_>
 
  260      template<
typename DT2_, 
typename IT2_, 
int block_size_>
 
  272      template<
typename DT2_, 
typename IT2_>
 
  284      template<
typename DT2_, 
typename IT2_, 
int block_size_>
 
  296      template<
typename Vector_>
 
  320        XASSERTM(this->
size() == vector.
size(), 
"size mismatch between mirror and vector");
 
  325        LAFEM::Arch::Mirror::gather_dv(
 
  351        XASSERTM(this->
size() == vector.
size(), 
"size mismatch between mirror and vector");
 
  356        LAFEM::Arch::Mirror::scatter_dv(
 
  372      template<
int block_size_>
 
  379        XASSERTM(this->
size() == vector.
size(), 
"size mismatch between mirror and vector");
 
  384        LAFEM::Arch::Mirror::gather_dvb(
 
  386          buffer.
elements(), vector.template elements<Perspective::pod>());
 
  404      template<
int block_size_>
 
  412        XASSERTM(this->
size() == vector.
size(), 
"size mismatch between mirror and vector");
 
  417        LAFEM::Arch::Mirror::scatter_dvb(
 
  419          buffer.
elements(), vector.template elements<Perspective::pod>(), alpha);
 
  440        XASSERTM(this->
size() == vector.
size(), 
"size mismatch between mirror and vector");
 
  445        LAFEM::Arch::Mirror::gather_sv(
 
  472        XASSERTM(this->
size() == vector.
size(), 
"size mismatch between mirror and vector");
 
  477        LAFEM::Arch::Mirror::scatter_sv(
 
  494      template<
int block_size_>
 
  501        XASSERTM(this->
size() == vector.
size(), 
"size mismatch between mirror and vector");
 
  506        LAFEM::Arch::Mirror::gather_svb(
 
  526      template<
int block_size_>
 
  534        XASSERTM(this->
size() == vector.
size(), 
"size mismatch between mirror and vector");
 
  539        LAFEM::Arch::Mirror::scatter_svb(
 
  566      template<Perspective perspective_, 
typename DT2_, 
typename IT2_>
 
  570        XASSERT(
Index(mask.size()) >= vector.template size<perspective_>());
 
  573        const IT_* idx = this->
indices();
 
  575        for(
Index i(0); i < n; ++i)
 
  576          mask[offset + idx[i]] = 
value;
 
  578        return vector.template size<perspective_>();
 
  603      template<Perspective perspective_, 
typename DT2_, 
typename IT2_, 
int block_size_>
 
  607        XASSERT(
Index(mask.size()) >= vector.template size<perspective_>());
 
  609        const IT_* idx = this->
indices();
 
  614          for(
Index i(0); i < n; ++i)
 
  615            mask[offset + idx[i]] = 
value;
 
  620          for(
Index i(0); i < n; ++i)
 
  622            const Index ibs = idx[i] * 
Index(block_size_);
 
  623            for(
int k(0); k < block_size_; ++k)
 
  627        return vector.template size<perspective_>();
 
  631      friend std::ostream & operator<< (std::ostream & lhs, 
const VectorMirror & b)
 
  637        for (
Index i(0) ; i < n ; ++i)
 
  639          lhs << 
"  " << idx[i];
 
  666        return &this->
_indices.at(0)[domain_node];
 
  673        return &this->
_indices.at(0)[domain_node+1];
 
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Index size() const
Returns the containers size.
void assign(const Container< DT2_, IT2_ > &other)
Assignment operation.
std::vector< IT_ * > _indices
List of pointers to all IT_ dependent arrays.
void clone(const Container &other, CloneMode clone_mode=CloneMode::Weak)
Clone operation.
void move(Container &&other)
Assignment move operation.
std::vector< Index > _indices_size
List of corresponding IT_ array sizes.
std::vector< Index > _scalar_index
List of scalars with datatype index.
Blocked Dense data vector class template.
Index size() const
The number of elements.
Dense data vector class template.
DT_ * elements()
Get a pointer to the data array.
Sparse vector class template.
Index size() const
The number of elements.
Index used_elements() const
Retrieve non zero element count.
IT_ * indices()
Get a pointer to the non zero indices array.
Sparse vector class template.
DT_ * elements()
Get a pointer to the data array.
IT_ * indices()
Get a pointer to the non zero indices array.
Index used_elements() const
Retrieve non zero element count.
Handles vector prolongation, restriction and serialization.
static VectorMirror make_identity(Index size_in)
Creates and returns an identity mirror.
void gather(LAFEM::DenseVector< DataType, IndexType > &buffer, const LAFEM::SparseVectorBlocked< DataType, IndexType, block_size_ > &vector, const Index buffer_offset=Index(0)) const
Gathers the buffer entries from a SparseVector.
const IT_ * indices() const
Get a pointer to the non zero indices array.
static VectorMirror make_empty(const DenseVector< DT_, IT_ > &tmpl_vec)
Creates and returns an empty mirror.
Index mask_scatter(const DenseVectorBlocked< DT2_, IT2_, block_size_ > &vector, std::vector< int > &mask, const int value, const Index offset=Index(0)) const
Updates a scatter mask vector for this mirror.
void gather(LAFEM::DenseVector< DataType, IndexType > &buffer, const LAFEM::DenseVector< DataType, IndexType > &vector, const Index buffer_offset=Index(0)) const
Gathers the buffer entries from a DenseVector.
Index buffer_size(const DenseVectorBlocked< DT2_, IT2_, block_size_ > &vector) const
Computes the required buffer size for a DenseVectorBlocked.
ImageIterator image_end(Index domain_node) const
Index get_num_nodes_domain() const
void scatter_axpy(LAFEM::SparseVectorBlocked< DataType, IndexType, block_size_ > &vector, const LAFEM::DenseVector< DataType, IndexType > &buffer, const DataType alpha=DataType(1), const Index buffer_offset=Index(0)) const
Scatters the buffer entries onto a SparseVectorBlocked.
void scatter_axpy(LAFEM::SparseVector< DataType, IndexType > &vector, const LAFEM::DenseVector< DataType, IndexType > &buffer, const DataType alpha=DataType(1), const Index buffer_offset=Index(0)) const
Scatters the buffer entries onto a SparseVector.
void gather(LAFEM::DenseVector< DataType, IndexType > &buffer, const LAFEM::SparseVector< DataType, IndexType > &vector, const Index buffer_offset=Index(0)) const
Gathers the buffer entries from a SparseVector.
Index buffer_size(const DenseVector< DT2_, IT2_ > &vector) const
Computes the required buffer size for a DenseVector.
IT_ IndexType
index-type typedef
DenseVector< DataType, IndexType > create_buffer(const Vector_ &vector) const
Creates a new buffer vector for a vector.
VectorMirror(Index size_in, Index num_idx)
Constructor.
VectorMirror()
default constructor
VectorMirror & operator=(VectorMirror &&other)
move-assign operator
void gather(LAFEM::DenseVector< DataType, IndexType > &buffer, const LAFEM::DenseVectorBlocked< DataType, IndexType, block_size_ > &vector, const Index buffer_offset=Index(0)) const
Gathers the buffer entries from a DenseVectorBlocked.
VectorMirror clone(CloneMode clone_mode=CloneMode::Weak) const
Clone operation.
Index buffer_size(const SparseVector< DT2_, IT2_ > &vector) const
Computes the required buffer size for a SparseVector.
Index mask_scatter(const DenseVector< DT2_, IT2_ > &vector, std::vector< int > &mask, const int value, const Index offset=Index(0)) const
Updates a scatter mask vector for this mirror.
void scatter_axpy(LAFEM::DenseVector< DataType, IndexType > &vector, const LAFEM::DenseVector< DataType, IndexType > &buffer, const DataType alpha=DataType(1), const Index buffer_offset=Index(0)) const
Scatters the buffer entries onto a DenseVector.
Index get_num_nodes_image() const
void scatter_axpy(LAFEM::DenseVectorBlocked< DataType, IndexType, block_size_ > &vector, const LAFEM::DenseVector< DataType, IndexType > &buffer, const DataType alpha=DataType(1), const Index buffer_offset=Index(0)) const
Scatters the buffer entries onto a DenseVectorBlocked.
IT_ * indices()
Get a pointer to the non zero indices array.
IT_ * ImageIterator
ImageIterator for Adjactor interface implementation.
static VectorMirror make_empty(const DenseVectorBlocked< DT_, IT_, block_size_ > &tmpl_vec)
Creates and returns an empty mirror.
Index num_indices() const
Returns the number of indices in the mirror.
Index buffer_size(const SparseVectorBlocked< DT2_, IT2_, block_size_ > &vector) const
Computes the required buffer size for a SparseVectorBlocked.
void clone(const VectorMirror< DT2_, IT2_ > &other, CloneMode clone_mode=CloneMode::Weak)
Clone operation.
DT_ DataType
data-type typedef
VectorMirror(VectorMirror &&other)
move-ctor
void convert(const VectorMirror< DT2_, IT2_ > &other)
Conversion method.
bool empty() const
Checks whether the mirror is empty.
Container< DT_, IT_ > BaseClass
our base class
ImageIterator image_begin(Index domain_node) const
@ value
specifies whether the space should supply basis function values
std::uint64_t Index
Index data type.