Reference documentation for deal.II version 9.6.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
StridedArrayView< ElementType, stride > Class Template Reference

#include <deal.II/base/array_view.h>

Public Types

using value_type = ElementType
 

Public Member Functions

 StridedArrayView (value_type *starting_element, const std::size_t n_elements)
 
std::size_t size () const
 
bool empty () const
 
value_typedata () const noexcept
 
value_typeoperator[] (const std::size_t i) const
 

Protected Attributes

value_typestarting_element
 
std::size_t n_elements
 

Detailed Description

template<typename ElementType, std::size_t stride = 1>
class StridedArrayView< ElementType, stride >

A variation of ArrayView which allows strided access into the view. This is particularly useful when you want to access only one lane of a VectorizedArray.

Definition at line 753 of file array_view.h.

Member Typedef Documentation

◆ value_type

template<typename ElementType , std::size_t stride = 1>
using StridedArrayView< ElementType, stride >::value_type = ElementType

An alias that denotes the "value_type" of this container-like class, i.e., the type of the element it "stores" or points to.

Definition at line 760 of file array_view.h.

Constructor & Destructor Documentation

◆ StridedArrayView()

template<typename ElementType , std::size_t stride>
StridedArrayView< ElementType, stride >::StridedArrayView ( value_type * starting_element,
const std::size_t n_elements )

Constructor.

Parameters
[in]starting_elementA pointer to the first element of the array this object should represent.
[in]n_elementsThe length (in elements) of the chunk of memory this object should represent.
Note
The object that is constructed from these arguments has no knowledge how large the object into which it points really is. As a consequence, whenever you call ArrayView::operator[], the array view can check that the given index is within the range of the view, but it can't check that the view is indeed a subset of the valid range of elements of the underlying object that allocated that range. In other words, you need to ensure that the range of the view specified by the two arguments to this constructor is in fact a subset of the elements of the array into which it points. The appropriate way to do this is to use the make_array_view() functions.

Definition at line 875 of file array_view.h.

Member Function Documentation

◆ size()

template<typename ElementType , std::size_t stride>
std::size_t StridedArrayView< ElementType, stride >::size ( ) const

Return the size (in elements) of the view of memory this object represents.

Definition at line 867 of file array_view.h.

◆ empty()

template<typename ElementType , std::size_t stride>
bool StridedArrayView< ElementType, stride >::empty ( ) const

Return a bool whether the array view is empty.

Definition at line 858 of file array_view.h.

◆ data()

template<typename ElementType , std::size_t stride>
StridedArrayView< ElementType, stride >::value_type * StridedArrayView< ElementType, stride >::data ( ) const
noexcept

Return a pointer to the underlying array serving as element storage. In case the container is empty a nullptr is returned.

Definition at line 846 of file array_view.h.

◆ operator[]()

template<typename ElementType , std::size_t stride>
StridedArrayView< ElementType, stride >::value_type & StridedArrayView< ElementType, stride >::operator[] ( const std::size_t i) const

Return a reference to the \(i\)th element of the range represented by the current object.

This function is marked as const because it does not change the view object. It may however return a reference to a non-const memory location depending on whether the template type of the class is const or not.

This function is only allowed to be called if the underlying data is indeed stored in CPU memory.

Definition at line 835 of file array_view.h.

Member Data Documentation

◆ starting_element

template<typename ElementType , std::size_t stride = 1>
value_type* StridedArrayView< ElementType, stride >::starting_element
protected

A pointer to the first element of the range of locations in memory that this object represents.

Definition at line 823 of file array_view.h.

◆ n_elements

template<typename ElementType , std::size_t stride = 1>
std::size_t StridedArrayView< ElementType, stride >::n_elements
protected

The length of the array this object represents.

Definition at line 828 of file array_view.h.


The documentation for this class was generated from the following file: