Reference documentation for deal.II version GIT relicensing-249-g48dc7357c7 2024-03-29 12:30:02+00:00
\(\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
Public Member Functions | Private Attributes | Related Symbols | List of all members
SUNDIALS::internal::NVectorView< VectorType > Class Template Reference

#include <deal.II/sundials/n_vector.h>

Public Member Functions

 NVectorView ()=default
 
 NVectorView (VectorType &vector, SUNContext nvector_context)
 
 NVectorView (NVectorView &&) noexcept=default
 
NVectorViewoperator= (NVectorView &&) noexcept=default
 
 NVectorView (const NVectorView &)=delete
 
NVectorViewoperator= (const NVectorView &)=delete
 
 ~NVectorView ()=default
 
 operator N_Vector () const
 
N_Vector operator-> () const
 

Private Attributes

std::unique_ptr< _generic_N_Vector, std::function< void(N_Vector)> > vector_ptr
 

Related Symbols

(Note that these are not member symbols.)

template<typename VectorType >
NVectorView< VectorType > make_nvector_view (VectorType &vector, SUNContext nvector_context)
 

Detailed Description

template<typename VectorType>
class SUNDIALS::internal::NVectorView< VectorType >

A view to a vector which can be used whenever a N_Vector is required.

Objects of this class should preferably be created by make_nvector_view() as

auto view = make_nvector_view(vector);
NVectorView< VectorType > make_nvector_view(VectorType &vector, SUNContext nvector_context)

The resulting N_Vector is a view of the actual vector and not owning memory. Also, N_VDestroy() cannot be called on the resulting N_Vector since this would lead to a double delete in the destructor.

Note
SUNDIALS will never call N_VDestroy() on a vector it didn't create itself and thus the above constraint is not limiting the user.
Template Parameters
VectorTypeType of the vector that is stored in v

Definition at line 154 of file n_vector.h.

Constructor & Destructor Documentation

◆ NVectorView() [1/4]

template<typename VectorType >
SUNDIALS::internal::NVectorView< VectorType >::NVectorView ( )
default

Default constructor.

The object is not actually viewing anything and needs to be assigned to with operator=(NVectorView &&).

◆ NVectorView() [2/4]

template<typename VectorType >
SUNDIALS::internal::NVectorView< VectorType >::NVectorView ( VectorType &  vector,
SUNContext  nvector_context 
)

Constructor. Create view of vector.

Note
Versions of this function prior to SUNDIALS 6.0 did not take a SUNContext argument.

◆ NVectorView() [3/4]

template<typename VectorType >
SUNDIALS::internal::NVectorView< VectorType >::NVectorView ( NVectorView< VectorType > &&  )
defaultnoexcept

Move assignment.

◆ NVectorView() [4/4]

template<typename VectorType >
SUNDIALS::internal::NVectorView< VectorType >::NVectorView ( const NVectorView< VectorType > &  )
delete

Explicitly delete copy ctor. This class is move-only.

◆ ~NVectorView()

template<typename VectorType >
SUNDIALS::internal::NVectorView< VectorType >::~NVectorView ( )
default

Destructor.

Note
This will not destroy the viewed vector.

Member Function Documentation

◆ operator=() [1/2]

template<typename VectorType >
NVectorView & SUNDIALS::internal::NVectorView< VectorType >::operator= ( NVectorView< VectorType > &&  )
defaultnoexcept

Move constructor.

◆ operator=() [2/2]

template<typename VectorType >
NVectorView & SUNDIALS::internal::NVectorView< VectorType >::operator= ( const NVectorView< VectorType > &  )
delete

Explicitly delete copy assignment. This class is move-only.

◆ operator N_Vector()

template<typename VectorType >
SUNDIALS::internal::NVectorView< VectorType >::operator N_Vector ( ) const

Implicit conversion to N_Vector. This operator makes the NVectorView look like an actual N_Vector and it can be used directly as an argument in many SUNDIALS functions.

◆ operator->()

template<typename VectorType >
N_Vector SUNDIALS::internal::NVectorView< VectorType >::operator-> ( ) const

Access the N_Vector that is viewed by this object.

Friends And Related Symbol Documentation

◆ make_nvector_view()

template<typename VectorType >
NVectorView< VectorType > make_nvector_view ( VectorType &  vector,
SUNContext  nvector_context 
)
related

Create a NVectorView of the given vector.

This call is intended to be used as

auto view = make_nvector_view(vector);

The resulting object view must be kept around as long as any other object will use the internally viewed N_Vector.

Template Parameters
VectorTypeType of the viewed vector. This parameter can be deduced automatically and will respect a potential const-qualifier.
Parameters
vectorThe vector to view.
nvector_contextA SUNDIALS context object to be used for the operations we want to do on this vector.
Returns
A NVectorView of the vector.
Note
Versions of this function prior to SUNDIALS 6.0 did not take a SUNContext argument.

Member Data Documentation

◆ vector_ptr

template<typename VectorType >
std::unique_ptr<_generic_N_Vector, std::function<void(N_Vector)> > SUNDIALS::internal::NVectorView< VectorType >::vector_ptr
private

Actual pointer to a vector viewed by this class.

Definition at line 230 of file n_vector.h.


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