deal.II version GIT relicensing-6842-g793a97d2aa 2026-10-02 14:00:01+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
n_vector.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2021 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13
14#ifndef dealii_sundials_n_vector_h
15#define dealii_sundials_n_vector_h
16
17#include <deal.II/base/config.h>
18
19#ifdef DEAL_II_WITH_SUNDIALS
20# include <sundials/sundials_nvector.h>
21
22# include <functional>
23# include <memory>
24
25#endif
26
28
29#ifdef DEAL_II_WITH_SUNDIALS
30# ifndef DOXYGEN
31namespace SUNDIALS
32{
33 namespace internal
34 {
35 template <typename VectorType>
36 class NVectorView;
37 }
38} // namespace SUNDIALS
39# endif
40
41namespace SUNDIALS
42{
43 namespace internal
44 {
45# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
70 template <typename VectorType>
71 NVectorView<VectorType>
72 make_nvector_view(VectorType &vector, SUNContext nvector_context);
73# else
99 template <typename VectorType>
101 make_nvector_view(VectorType &vector);
102# endif
103
116 template <typename VectorType>
117 VectorType *
118 unwrap_nvector(N_Vector v);
119
131 template <typename VectorType>
132 const VectorType *
134
154 template <typename VectorType>
156 {
157 public:
164 NVectorView() = default;
165
166# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
173 NVectorView(VectorType &vector, SUNContext nvector_context);
174# else
181 NVectorView(VectorType &vector);
182# endif
183
187 NVectorView(NVectorView &&) noexcept = default;
188
193 operator=(NVectorView &&) noexcept = default;
194
198 NVectorView(const NVectorView &) = delete;
199
204 operator=(const NVectorView &) = delete;
205
211 ~NVectorView() = default;
212
218 operator N_Vector() const;
219
223 N_Vector
224 operator->() const;
225
226 private:
230 std::unique_ptr<_generic_N_Vector, std::function<void(N_Vector)>>
232 };
233 } // namespace internal
234} // namespace SUNDIALS
235
236#endif
237
239#endif
NVectorView(VectorType &vector, SUNContext nvector_context)
NVectorView(NVectorView &&) noexcept=default
std::unique_ptr< _generic_N_Vector, std::function< void(N_Vector)> > vector_ptr
Definition n_vector.h:231
NVectorView< VectorType > make_nvector_view(VectorType &vector, SUNContext nvector_context)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
VectorType * unwrap_nvector(N_Vector v)
const VectorType * unwrap_nvector_const(N_Vector v)
STL namespace.